Commit bd4b0f13 authored by Philipp Samfaß's avatar Philipp Samfaß
Browse files

some fixes for MPI offloading

parent 181d99f2
......@@ -192,7 +192,7 @@ int translateRank(MPI_Comm srcComm, int srcRank, MPI_Comm destComm) {
}
int mapToWorldRank(int rank, MPI_Comm comm) {
return translateRank(rank, comm, MPI_COMM_WORLD);
return translateRank(comm, rank, MPI_COMM_WORLD);
}
void remapStatus(MPI_Status *status) {
......
......@@ -13,6 +13,7 @@
#include "mpi_offloading_common.h"
#endif
int MPI_Init(int *argc, char*** argv) {
int err = PMPI_Init(argc, argv);
#ifdef USE_MPI_OFFLOADING
......@@ -152,8 +153,19 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request) {
//assert(comm == MPI_COMM_WORLD);
int err = PMPI_Isend(buf, count, datatype, dest, tag, getTeamComm(comm), request);
int err;
#ifdef USE_MPI_OFFLOADING
if(_is_server) {
MPI_Comm mapped_comm = (comm==MPI_COMM_WORLD) ? _comm : comm;
err = PMPI_Isend(buf, count, datatype, dest, tag, mapped_comm, request);
}
else {
err = PMPI_Isend(buf, count, datatype, dest, tag, getTeamComm(comm), request);
}
#else
err = PMPI_Isend(buf, count, datatype, dest, tag, getTeamComm(comm), request);
logInfo("Isend to rank " << dest << "/" << mapTeamToWorldRank(dest) << " with tag " << tag);
#endif
return err;
}
......@@ -231,17 +243,17 @@ int MPI_Iprobe_offload(int source, int tag, MPI_Comm comm, int *flag, MPI_Status
int MPI_Send_offload(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
#if COMMUNICATION_MODE==0
return ompi_send_offload_p2p(buf, count, datatype, mapToWorldRank(dest, comm), tag, comm);
return ompi_send_offload_p2p(buf, count, datatype, translateRank(comm, dest, _comm), tag, comm);
#elif COMMUNICATION_MODE==1
return ompi_send_offload_rma(buf, count, datatype, mapToWorldRank(dest, comm), tag, comm);
return ompi_send_offload_rma(buf, count, datatype, translateRank(comm, dest, _comm), tag, comm);
#endif
}
int MPI_Recv_offload(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status_Offload *stat) {
#if COMMUNICATION_MODE==0
return ompi_recv_offload_p2p(buf, count, datatype, mapToWorldRank(source, comm), tag, comm, stat);
return ompi_recv_offload_p2p(buf, count, datatype, translateRank(comm, source, _comm), tag, comm, stat);
#elif COMMUNICATION_MODE==1
return ompi_recv_offload_rma(buf, count, datatype, mapToWorldRank(source, comm), tag, comm, stat);
return ompi_recv_offload_rma(buf, count, datatype, translateRank(comm, source, _comm), tag, comm, stat);
#endif
}
......
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