X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2a4e09ea802d88e54d4c8b29d9bd57f72d5b2760..be2f3c5737ba2f409e6621cd30295fa59fce0b85:/src/smpi/bindings/smpi_pmpi_coll.cpp diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index c191471c6c..29c9db411b 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -27,7 +27,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c } else if (not datatype->is_valid()) { retval = MPI_ERR_ARG; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -39,7 +39,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c if (known == 0) dt_size_send = datatype->size(); extra->send_size = count * dt_size_send; - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); if (comm->size() > 1) simgrid::smpi::Colls::bcast(buf, count, datatype, root, comm); retval = MPI_SUCCESS; @@ -59,10 +59,10 @@ int PMPI_Barrier(MPI_Comm comm) if (comm == MPI_COMM_NULL) { retval = MPI_ERR_COMM; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_BARRIER; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::barrier(comm); @@ -101,7 +101,7 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbu sendtmpcount=0; sendtmptype=recvtype; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_GATHER; @@ -118,7 +118,7 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbu dt_size_recv = recvtype->size(); extra->recv_size = recvcount * dt_size_recv; - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::gather(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, root, comm); @@ -155,7 +155,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv sendtmptype=recvtype; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -177,7 +177,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv for (int i = 0; i < size; i++) // copy data to avoid bad free extra->recvcounts[i] = recvcounts[i] * dt_size_recv; } - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, displs, recvtype, root, comm); TRACE_smpi_collective_out(rank, __FUNCTION__); @@ -208,7 +208,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, sendcount=recvcount; sendtype=recvtype; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_ALLGATHER; int known = 0; @@ -223,7 +223,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, dt_size_recv = recvtype->size(); extra->recv_size = recvcount * dt_size_recv; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm); retval = MPI_SUCCESS; @@ -255,7 +255,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, sendcount=recvcounts[comm->rank()]; sendtype=recvtype; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int i = 0; int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -275,7 +275,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, for (i = 0; i < size; i++) // copy data to avoid bad free extra->recvcounts[i] = recvcounts[i] * dt_size_recv; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm); retval = MPI_SUCCESS; @@ -307,7 +307,7 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, recvtype = sendtype; recvcount = sendcount; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_SCATTER; @@ -323,7 +323,7 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, if (known == 0) dt_size_recv = recvtype->size(); extra->recv_size = recvcount * dt_size_recv; - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm); retval = MPI_SUCCESS; @@ -353,7 +353,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, recvtype = sendtype; recvcount = sendcounts[comm->rank()]; } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -375,7 +375,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, if (known == 0) dt_size_recv = recvtype->size(); extra->recv_size = recvcount * dt_size_recv; - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm); @@ -397,7 +397,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, } else if (not datatype->is_valid() || op == MPI_OP_NULL) { retval = MPI_ERR_ARG; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int root_traced = comm->group()->index(root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_REDUCE; @@ -409,7 +409,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, extra->send_size = count * dt_size_send; extra->root = root_traced; - TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::reduce(sendbuf, recvbuf, count, datatype, op, root, comm); @@ -454,7 +454,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp sendtmpbuf = static_cast(xbt_malloc(count*datatype->get_extent())); simgrid::smpi::Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype); } - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_ALLREDUCE; int known = 0; @@ -464,7 +464,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp dt_size_send = datatype->size(); extra->send_size = count * dt_size_send; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::allreduce(sendtmpbuf, recvbuf, count, datatype, op, comm); @@ -492,7 +492,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP } else if (op == MPI_OP_NULL) { retval = MPI_ERR_OP; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_SCAN; int known = 0; @@ -502,7 +502,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP dt_size_send = datatype->size(); extra->send_size = count * dt_size_send; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::scan(sendbuf, recvbuf, count, datatype, op, comm); @@ -525,7 +525,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, } else if (op == MPI_OP_NULL) { retval = MPI_ERR_OP; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_EXSCAN; int known = 0; @@ -539,7 +539,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, sendtmpbuf = static_cast(xbt_malloc(count * datatype->size())); memcpy(sendtmpbuf, recvbuf, count * datatype->size()); } - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::exscan(sendtmpbuf, recvbuf, count, datatype, op, comm); @@ -566,7 +566,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat } else if (recvcounts == nullptr) { retval = MPI_ERR_ARG; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int i = 0; int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -590,7 +590,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat memcpy(sendtmpbuf, recvbuf, totalcount * datatype->size()); } - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); simgrid::smpi::Colls::reduce_scatter(sendtmpbuf, recvbuf, recvcounts, datatype, op, comm); retval = MPI_SUCCESS; @@ -621,7 +621,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount, } else { int count = comm->size(); - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_REDUCE_SCATTER; extra->num_processes = count; @@ -640,7 +640,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount, memcpy(sendtmpbuf, recvbuf, recvcount * count * datatype->size()); } - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); int* recvcounts = static_cast(xbt_malloc(count * sizeof(int))); for (int i = 0; i < count; i++) @@ -670,7 +670,7 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec } else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) { retval = MPI_ERR_TYPE; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_ALLTOALL; @@ -696,7 +696,7 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec else extra->recv_size = recvcount; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::alltoall(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, comm); @@ -725,7 +725,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype recvdisps == nullptr) { retval = MPI_ERR_ARG; } else { - int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; + int rank = smpi_process()->index(); int i = 0; int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); @@ -768,7 +768,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype extra->sendcounts[i] = sendtmpcounts[i] * dt_size_send; } extra->num_processes = size; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_in(rank, __FUNCTION__, extra); retval = simgrid::smpi::Colls::alltoallv(sendtmpbuf, sendtmpcounts, sendtmpdisps, sendtmptype, recvbuf, recvcounts, recvdisps, recvtype, comm); TRACE_smpi_collective_out(rank, __FUNCTION__);