Commit 7b418034 authored by Philipp Samfaß's avatar Philipp Samfaß
Browse files

fix blocking mode for offloading

parent 9d1f65dd
...@@ -86,7 +86,18 @@ int MPI_Comm_free(MPI_Comm *comm) { ...@@ -86,7 +86,18 @@ int MPI_Comm_free(MPI_Comm *comm) {
int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm) { int tag, MPI_Comm comm) {
//assert(comm == MPI_COMM_WORLD); //assert(comm == MPI_COMM_WORLD);
int err = PMPI_Send(buf, count, datatype, dest, tag, getTeamComm(comm)); int err;
#ifdef USE_MPI_OFFLOADING
if(_is_server) {
MPI_Comm mapped_comm = (comm==MPI_COMM_WORLD) ? _comm : comm;
err = PMPI_Send(buf, count, datatype, dest, tag, mapped_comm);
}
else {
err = PMPI_Send(buf, count, datatype, dest, tag, getTeamComm(comm));
}
#else
err = PMPI_Send(buf, count, datatype, dest, tag, getTeamComm(comm));
#endif
logInfo("Send to rank " << dest << "/" << mapTeamToWorldRank(dest) << " with tag " << tag); logInfo("Send to rank " << dest << "/" << mapTeamToWorldRank(dest) << " with tag " << tag);
return err; return err;
} }
...@@ -94,7 +105,18 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, ...@@ -94,7 +105,18 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest,
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
MPI_Comm comm, MPI_Status *status) { MPI_Comm comm, MPI_Status *status) {
//assert(comm == MPI_COMM_WORLD); //assert(comm == MPI_COMM_WORLD);
int err = PMPI_Recv(buf, count, datatype, source, tag, getTeamComm(comm), status); int err;
#ifdef USE_MPI_OFFLOADING
if(_is_server) {
MPI_Comm mapped_comm = (comm==MPI_COMM_WORLD) ? _comm : comm;
err = PMPI_Recv(buf, count, datatype, source, tag, mapped_comm, status);
}
else {
err = PMPI_Recv(buf, count, datatype, source, tag, getTeamComm(comm), status);
}
#else
err = PMPI_Recv(buf, count, datatype, source, tag, getTeamComm(comm), status);
#endif
logInfo("Receive from rank " << source << "/" << mapTeamToWorldRank(source) << " with tag " << tag); logInfo("Receive from rank " << source << "/" << mapTeamToWorldRank(source) << " with tag " << tag);
return err; return err;
} }
...@@ -164,7 +186,20 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) { ...@@ -164,7 +186,20 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) {
int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag,
MPI_Status *status) { MPI_Status *status) {
//assert(comm == MPI_COMM_WORLD); //assert(comm == MPI_COMM_WORLD);
int err = PMPI_Iprobe(source, tag, getTeamComm(comm), flag, status); int err;
#ifdef USE_MPI_OFFLOADING
if(_is_server) {
if(comm==MPI_COMM_WORLD)
err = PMPI_Iprobe(source, tag, _comm, flag, status);
else
err = PMPI_Iprobe(source, tag, comm, flag, status);
}
else {
err = PMPI_Iprobe(source, tag, getTeamComm(comm), flag, status);
}
#else
err = PMPI_Iprobe(source, tag, getTeamComm(comm), flag, status);
#endif
logInfo("Iprobe finished (FLAG=" << *flag << ",SOURCE=" << mapTeamToWorldRank(source) << ",TAG=" << tag << ",STATUS_SOURCE=" << status->MPI_SOURCE << ",STATUS_TAG=" << status->MPI_TAG << ")"); logInfo("Iprobe finished (FLAG=" << *flag << ",SOURCE=" << mapTeamToWorldRank(source) << ",TAG=" << tag << ",STATUS_SOURCE=" << status->MPI_SOURCE << ",STATUS_TAG=" << status->MPI_TAG << ")");
return err; return err;
} }
......
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