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() ...@@ -74,6 +74,7 @@ XdmfDSMCommMPI::XdmfDSMCommMPI()
XdmfDSMCommMPI::~XdmfDSMCommMPI() XdmfDSMCommMPI::~XdmfDSMCommMPI()
{ {
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) { if (InterComm != MPI_COMM_NULL) {
int status = MPI_Comm_free(&InterComm); int status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -96,6 +97,7 @@ XdmfDSMCommMPI::~XdmfDSMCommMPI() ...@@ -96,6 +97,7 @@ XdmfDSMCommMPI::~XdmfDSMCommMPI()
} }
} }
} }
#endif
} }
void void
...@@ -170,7 +172,7 @@ XdmfDSMCommMPI::ClosePort() ...@@ -170,7 +172,7 @@ XdmfDSMCommMPI::ClosePort()
{ {
if (Id == 0) { if (Id == 0) {
int status; int status;
status = MPI_Open_port(MPI_INFO_NULL, DsmPortName); status = MPI_Close_port(DsmPortName);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
try { try {
std::string message = "Failed to close port "; std::string message = "Failed to close port ";
...@@ -254,6 +256,7 @@ XdmfDSMCommMPI::Connect() ...@@ -254,6 +256,7 @@ XdmfDSMCommMPI::Connect()
void void
XdmfDSMCommMPI::Disconnect() XdmfDSMCommMPI::Disconnect()
{ {
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) { if (InterComm != MPI_COMM_NULL) {
int status = MPI_Comm_free(&InterComm); int status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -265,6 +268,7 @@ XdmfDSMCommMPI::Disconnect() ...@@ -265,6 +268,7 @@ XdmfDSMCommMPI::Disconnect()
} }
} }
} }
#endif
InterComm = MPI_COMM_NULL; InterComm = MPI_COMM_NULL;
} }
...@@ -273,6 +277,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm) ...@@ -273,6 +277,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm)
{ {
if (IntraComm != comm) { if (IntraComm != comm) {
int status; int status;
#ifndef OPEN_MPI
if (IntraComm != MPI_COMM_NULL) { if (IntraComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&IntraComm); status = MPI_Comm_free(&IntraComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -284,6 +289,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm) ...@@ -284,6 +289,7 @@ XdmfDSMCommMPI::DupComm(MPI_Comm comm)
} }
} }
} }
#endif
if (comm != MPI_COMM_NULL) { if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &IntraComm); status = MPI_Comm_dup(comm, &IntraComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -307,6 +313,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm) ...@@ -307,6 +313,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm)
{ {
if (InterComm != comm) { if (InterComm != comm) {
int status; int status;
#ifndef OPEN_MPI
if (InterComm != MPI_COMM_NULL) { if (InterComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&InterComm); status = MPI_Comm_free(&InterComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -318,6 +325,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm) ...@@ -318,6 +325,7 @@ XdmfDSMCommMPI::DupInterComm(MPI_Comm comm)
} }
} }
} }
#endif
if (comm != MPI_COMM_NULL) { if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &InterComm); status = MPI_Comm_dup(comm, &InterComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
......
...@@ -457,6 +457,7 @@ void XdmfHDF5ControllerDSM::setServerMode(bool newMode) ...@@ -457,6 +457,7 @@ void XdmfHDF5ControllerDSM::setServerMode(bool newMode)
void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm) void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm)
{ {
int status; int status;
#ifndef OPEN_MPI
if (mWorkerComm != MPI_COMM_NULL) { if (mWorkerComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&mWorkerComm); status = MPI_Comm_free(&mWorkerComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -468,6 +469,7 @@ void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm) ...@@ -468,6 +469,7 @@ void XdmfHDF5ControllerDSM::setWorkerComm(MPI_Comm comm)
} }
} }
} }
#endif
if (comm != MPI_COMM_NULL) { if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &mWorkerComm); status = MPI_Comm_dup(comm, &mWorkerComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
......
...@@ -406,6 +406,7 @@ void XdmfHDF5WriterDSM::setServerMode(bool newMode) ...@@ -406,6 +406,7 @@ void XdmfHDF5WriterDSM::setServerMode(bool newMode)
void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm) void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm)
{ {
int status; int status;
#ifndef OPEN_MPI
if (mWorkerComm != MPI_COMM_NULL) { if (mWorkerComm != MPI_COMM_NULL) {
status = MPI_Comm_free(&mWorkerComm); status = MPI_Comm_free(&mWorkerComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
...@@ -417,6 +418,7 @@ void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm) ...@@ -417,6 +418,7 @@ void XdmfHDF5WriterDSM::setWorkerComm(MPI_Comm comm)
} }
} }
} }
#endif
if (comm != MPI_COMM_NULL) { if (comm != MPI_COMM_NULL) {
status = MPI_Comm_dup(comm, &mWorkerComm); status = MPI_Comm_dup(comm, &mWorkerComm);
if (status != MPI_SUCCESS) { if (status != MPI_SUCCESS) {
......
...@@ -90,7 +90,10 @@ int main(int argc, char *argv[]) ...@@ -90,7 +90,10 @@ int main(int argc, char *argv[])
//#ClosePort begin //#ClosePort begin
exampleWriter->getServerBuffer()->GetComm()->ClosePort(); if (id == 0)
{
exampleWriter->getServerBuffer()->GetComm()->ClosePort();
}
//#ClosePort end //#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