I'm not sure if the following behavior is intended or not. If GetClientCommSize is called on the client then it always returns a size of zero. Also, if GetServerCommSize is called on the server it always returns zero.
It seems like these functions should return the correct size both on the client and server. Alternatively, this could be split into two functions e.g., SendClientCommSize which is only available on the RDV client and ReceiveClientCommSize which is only available on the server.
Another alternative might be to rename GetServerCommSize to SendReceiveServerCommSize? This seems more clear to me that this is about doing the communication of communicator size.
|
redev::LO Redev::GetClientCommSize(adios2::IO& c2sIO, adios2::Engine& c2sEngine) { |
|
REDEV_FUNCTION_TIMER; |
|
int commSize; |
|
MPI_Comm_size(comm, &commSize); |
|
const auto varName = "redev client communicator size"; |
|
auto status = c2sEngine.BeginStep(); |
|
REDEV_ALWAYS_ASSERT(status == adios2::StepStatus::OK); |
|
redev::LO clientCommSz = 0; |
|
if(processType == ProcessType::Client) { |
|
auto var = c2sIO.DefineVariable<redev::LO>(varName); |
|
if(!rank) |
|
c2sEngine.Put(var, commSize); |
|
} else { |
|
auto var = c2sIO.InquireVariable<redev::LO>(varName); |
|
if(var && !rank) { |
|
c2sEngine.Get(var, clientCommSz); |
|
c2sEngine.PerformGets(); //default read mode is deferred |
|
} |
|
} |
|
c2sEngine.EndStep(); |
|
if(processType==ProcessType::Server) |
|
redev::Broadcast(&clientCommSz,1,0,comm); |
|
return clientCommSz; |
|
} |
|
|
|
/* |
|
* return the number of processes in the server's MPI communicator |
|
*/ |
|
redev::LO Redev::GetServerCommSize(adios2::IO& s2cIO, adios2::Engine& s2cEngine) { |
|
REDEV_FUNCTION_TIMER; |
|
int commSize; |
|
MPI_Comm_size(comm, &commSize); |
|
const auto varName = "redev server communicator size"; |
|
auto status = s2cEngine.BeginStep(); |
|
REDEV_ALWAYS_ASSERT(status == adios2::StepStatus::OK); |
|
redev::LO serverCommSz = 0; |
|
if(processType==ProcessType::Server) { |
|
auto var = s2cIO.DefineVariable<redev::LO>(varName); |
|
if(!rank) |
|
s2cEngine.Put(var, commSize); |
|
} else { |
|
auto var = s2cIO.InquireVariable<redev::LO>(varName); |
|
if(var && !rank) { |
|
s2cEngine.Get(var, serverCommSz); |
|
s2cEngine.PerformGets(); //default read mode is deferred |
|
} |
|
} |
|
s2cEngine.EndStep(); |
|
if(processType == ProcessType::Client) |
|
redev::Broadcast(&serverCommSz,1,0,comm); |
|
return serverCommSz; |
|
} |
I'm not sure if the following behavior is intended or not. If
GetClientCommSizeis called on the client then it always returns a size of zero. Also, ifGetServerCommSizeis called on the server it always returns zero.It seems like these functions should return the correct size both on the client and server. Alternatively, this could be split into two functions e.g.,
SendClientCommSizewhich is only available on the RDV client andReceiveClientCommSizewhich is only available on the server.Another alternative might be to rename
GetServerCommSizetoSendReceiveServerCommSize? This seems more clear to me that this is about doing the communication of communicator size.redev/redev.cpp
Lines 358 to 409 in 9a4432b