mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Communicator leak fixed (I think)
This commit is contained in:
parent
896f3a8002
commit
237a8ec918
@ -49,6 +49,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv)
|
|||||||
|
|
||||||
Grid_quiesce_nodes();
|
Grid_quiesce_nodes();
|
||||||
|
|
||||||
|
// Never clean up as done once.
|
||||||
MPI_Comm_dup (MPI_COMM_WORLD,&communicator_world);
|
MPI_Comm_dup (MPI_COMM_WORLD,&communicator_world);
|
||||||
|
|
||||||
GlobalSharedMemory::Init(communicator_world);
|
GlobalSharedMemory::Init(communicator_world);
|
||||||
@ -88,6 +89,8 @@ CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
|||||||
GlobalSharedMemory::OptimalCommunicator (processors,optimal_comm); // Remap using the shared memory optimising routine
|
GlobalSharedMemory::OptimalCommunicator (processors,optimal_comm); // Remap using the shared memory optimising routine
|
||||||
InitFromMPICommunicator(processors,optimal_comm);
|
InitFromMPICommunicator(processors,optimal_comm);
|
||||||
SetCommunicator(optimal_comm);
|
SetCommunicator(optimal_comm);
|
||||||
|
// Free the temp communicator
|
||||||
|
MPI_Comm_free(&optimal_comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
@ -183,8 +186,8 @@ CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
srank = 0;
|
srank = 0;
|
||||||
comm_split = parent.communicator;
|
int ierr = MPI_Comm_dup (parent.communicator,&comm_split);
|
||||||
// std::cout << " Inherited communicator " <<comm_split <<std::endl;
|
assert(ierr==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -197,6 +200,9 @@ CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
SetCommunicator(comm_split);
|
SetCommunicator(comm_split);
|
||||||
|
|
||||||
|
// Free the temp communicator
|
||||||
|
MPI_Comm_free(&comm_split);
|
||||||
|
|
||||||
if(0){
|
if(0){
|
||||||
std::cout << " ndim " <<_ndimension<<" " << parent._ndimension << std::endl;
|
std::cout << " ndim " <<_ndimension<<" " << parent._ndimension << std::endl;
|
||||||
for(int d=0;d<processors.size();d++){
|
for(int d=0;d<processors.size();d++){
|
||||||
@ -210,6 +216,9 @@ CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,
|
|||||||
|
|
||||||
void CartesianCommunicator::InitFromMPICommunicator(const std::vector<int> &processors, MPI_Comm communicator_base)
|
void CartesianCommunicator::InitFromMPICommunicator(const std::vector<int> &processors, MPI_Comm communicator_base)
|
||||||
{
|
{
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
// Creates communicator, and the communicator_halo
|
||||||
|
////////////////////////////////////////////////////
|
||||||
_ndimension = processors.size();
|
_ndimension = processors.size();
|
||||||
_processor_coor.resize(_ndimension);
|
_processor_coor.resize(_ndimension);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user