X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b8539f6b0e7671fedf4fc6b7e98a573f51e63de2..8ea8e92da6faea52fba38ef490b29904341f1b03:/src/smpi/bindings/smpi_pmpi_request.cpp diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index fd9d4a61df..84a929d8ed 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -161,7 +161,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("Irecv", comm->group()->index(src), - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); *request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm); @@ -202,7 +202,7 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP int trace_dst = comm->group()->index(dst); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("Isend", trace_dst, - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); TRACE_smpi_send(rank, rank, trace_dst, tag, count * datatype->size()); @@ -244,7 +244,7 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M int trace_dst = comm->group()->index(dst); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("ISsend", trace_dst, - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); TRACE_smpi_send(rank, rank, trace_dst, tag, count * datatype->size()); @@ -284,7 +284,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI int src_traced = comm->group()->index(src); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("recv", src_traced, - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status); @@ -327,7 +327,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI int dst_traced = comm->group()->index(dst); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("send", dst_traced, - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); if (not TRACE_smpi_view_internals()) { TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size()); @@ -365,7 +365,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP int dst_traced = comm->group()->index(dst); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData("Ssend", dst_traced, - datatype->is_basic() ? count : count * datatype->size(), + datatype->is_replayable() ? count : count * datatype->size(), encode_datatype(datatype))); TRACE_smpi_send(rank, rank, dst_traced, tag, count * datatype->size()); @@ -414,8 +414,8 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, src_hack->push_back(src_traced); TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData( - "sendRecv", -1, sendtype->is_basic() ? sendcount : sendcount * sendtype->size(), dst_hack, - recvtype->is_basic() ? recvcount : recvcount * recvtype->size(), src_hack, + "sendRecv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(), dst_hack, + recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), src_hack, encode_datatype(sendtype), encode_datatype(recvtype))); TRACE_smpi_send(rank, rank, dst_traced, sendtag, sendcount * sendtype->size()); @@ -595,41 +595,27 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta return MPI_SUCCESS; smpi_bench_end(); - //save requests information for tracing - struct savedvalstype { - int src; - int dst; - int recv; - int tag; - MPI_Comm comm; - }; - savedvalstype* savedvals = xbt_new0(savedvalstype, count); - for (int i = 0; i < count; i++) { - MPI_Request req = requests[i]; //already received requests are no longer valid - if (req) { - savedvals[i]=(savedvalstype){req->src(), req->dst(), (req->flags() & RECV), req->tag(), req->comm()}; - } - } int rank_traced = smpi_process()->index(); TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::CpuTIData("waitAny", static_cast(count))); *index = simgrid::smpi::Request::waitany(count, requests, status); if(*index!=MPI_UNDEFINED){ - int src_traced = savedvals[*index].src; - //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE) - int dst_traced = savedvals[*index].dst; - int is_wait_for_receive = savedvals[*index].recv; - if (is_wait_for_receive) { - if(savedvals[*index].src==MPI_ANY_SOURCE) - src_traced = (status != MPI_STATUSES_IGNORE) ? savedvals[*index].comm->group()->rank(status->MPI_SOURCE) - : savedvals[*index].src; - TRACE_smpi_recv(src_traced, dst_traced, savedvals[*index].tag); + MPI_Request req = requests[*index]; + if (req != nullptr) { // Requests that were already received will be a nullptr + int src_traced = req->src(); + // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE) + int dst_traced = req->dst(); + int is_wait_for_receive = req->flags() & RECV; + if (is_wait_for_receive) { + if (req->src() == MPI_ANY_SOURCE) + src_traced = (status != MPI_STATUSES_IGNORE) ? req->comm()->group()->rank(status->MPI_SOURCE) : req->src(); + TRACE_smpi_recv(src_traced, dst_traced, req->tag()); + } } TRACE_smpi_comm_out(rank_traced); } - xbt_free(savedvals); smpi_bench_begin(); return MPI_SUCCESS;