Commit 261e07a6 authored by Andrew J. Burns (Cont's avatar Andrew J. Burns (Cont

changes to allow for openmpi use

parent 053a30bd
......@@ -74,6 +74,7 @@ XdmfDSMCommMPI::XdmfDSMCommMPI()
XdmfDSMCommMPI::~XdmfDSMCommMPI()
{
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) {
int status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) {
......@@ -96,6 +97,7 @@ XdmfDSMCommMPI::~XdmfDSMCommMPI()
}
}
}
#endif
}
void
......@@ -170,7 +172,7 @@ XdmfDSMCommMPI::ClosePort()
{
if (Id == 0) {
int status;
status = MPI_Open_port(MPI_INFO_NULL, DsmPortName);
status = MPI_Close_port(DsmPortName);
if (status != MPI_SUCCESS) {
try {
std::string message = "Failed to close port ";
......@@ -254,6 +256,7 @@ XdmfDSMCommMPI::Connect()
void
XdmfDSMCommMPI::Disconnect()
{
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) {
int status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) {
......@@ -265,6 +268,7 @@ XdmfDSMCommMPI::Disconnect()
}
}
}
#endif
InterComm = MPI_COMM_NULL;
}
......@@ -273,6 +277,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm)
{
if (IntraComm != comm) {
int status;
#ifndef OPEN_MPI
if (IntraComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&IntraComm);
if (status != MPI_SUCCESS) {
......@@ -284,6 +289,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm)
}
}
}
#endif
if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &IntraComm);
if (status != MPI_SUCCESS) {
......@@ -307,6 +313,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm)
{
if (InterComm != comm) {
int status;
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) {
......@@ -318,6 +325,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm)
}
}
}
#endif
if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &InterComm);
if (status != MPI_SUCCESS) {
......
......@@ -457,6 +457,7 @@ void XdmfHDF5ControllerDSM::setServerMode(bool newMode)
void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm)
{
int status;
#ifndef OPEN_MPI
if (mWorkerComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&mWorkerComm);
if (status != MPI_SUCCESS) {
......@@ -468,6 +469,7 @@ void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm)
}
}
}
#endif
if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &mWorkerComm);
if (status != MPI_SUCCESS) {
......
......@@ -406,6 +406,7 @@ void XdmfHDF5WriterDSM::setServerMode(bool newMode)
void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm)
{
int status;
#ifndef OPEN_MPI
if (mWorkerComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&mWorkerComm);
if (status != MPI_SUCCESS) {
......@@ -417,6 +418,7 @@ void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm)
}
}
}
#endif
if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &mWorkerComm);
if (status != MPI_SUCCESS) {
......
......@@ -90,7 +90,10 @@ int main(int argc, char *argv[])
//#ClosePort begin
exampleWriter->getServerBuffer()->GetComm()->ClosePort();
if (id == 0)
{
exampleWriter->getServerBuffer()->GetComm()->ClosePort();
}
//#ClosePort end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment