1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01:00

Extra communicator free that I had missed.

Hard to audit them all as this is complex
This commit is contained in:
paboyle 2018-02-20 15:12:31 +00:00
parent 2dd63aa7a4
commit 4790e99817
4 changed files with 17 additions and 2 deletions

View File

@ -89,10 +89,16 @@ void CartesianCommunicator::ProcessorCoorFromRank(int rank, std::vector<int> &c
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors) CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
{ {
MPI_Comm optimal_comm; MPI_Comm optimal_comm;
GlobalSharedMemory::OptimalCommunicator (processors,optimal_comm); // Remap using the shared memory optimising routine ////////////////////////////////////////////////////
// Remap using the shared memory optimising routine
// The remap creates a comm which must be freed
////////////////////////////////////////////////////
GlobalSharedMemory::OptimalCommunicator (processors,optimal_comm);
InitFromMPICommunicator(processors,optimal_comm); InitFromMPICommunicator(processors,optimal_comm);
SetCommunicator(optimal_comm); SetCommunicator(optimal_comm);
///////////////////////////////////////////////////
// Free the temp communicator // Free the temp communicator
///////////////////////////////////////////////////
MPI_Comm_free(&optimal_comm); MPI_Comm_free(&optimal_comm);
} }
@ -202,8 +208,10 @@ CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,
// Take the right SHM buffers // Take the right SHM buffers
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
SetCommunicator(comm_split); SetCommunicator(comm_split);
///////////////////////////////////////////////
// Free the temp communicator // Free the temp communicator
///////////////////////////////////////////////
MPI_Comm_free(&comm_split); MPI_Comm_free(&comm_split);
if(0){ if(0){

View File

@ -133,6 +133,7 @@ class SharedMemory
public: public:
SharedMemory() {}; SharedMemory() {};
~SharedMemory();
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
// set the buffers & sizes // set the buffers & sizes
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////

View File

@ -399,5 +399,9 @@ void *SharedMemory::ShmBufferTranslate(int rank,void * local_p)
return (void *) remote; return (void *) remote;
} }
} }
SharedMemory::~SharedMemory()
{
MPI_Comm_free(&ShmComm);
};
} }

View File

@ -122,5 +122,7 @@ void *SharedMemory::ShmBufferTranslate(int rank,void * local_p)
{ {
return NULL; return NULL;
} }
SharedMemory::~SharedMemory()
{};
} }