X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fa222c38f9b796be07ab4351ffc810a61a8fd705..e6f32ee88c53d311ae1aaf409b886c60307a0af4:/src/smpi/smpi_pmpi.c diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 9ab2b6dfcb..0583cfb8c1 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -25,16 +25,21 @@ void TRACE_smpi_set_category(const char *category) int PMPI_Init(int *argc, char ***argv) { - smpi_process_init(argc, argv); - smpi_process_mark_as_initialized(); - int rank = smpi_process_index(); - TRACE_smpi_init(rank); - TRACE_smpi_computing_init(rank); - instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); - extra->type = TRACING_INIT; - TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); - TRACE_smpi_collective_out(rank, -1, __FUNCTION__); - smpi_bench_begin(); + // PMPI_Init is call only one time by only by SMPI process + int already_init; + MPI_Initialized(&already_init); + if(!(already_init)){ + smpi_process_init(argc, argv); + smpi_process_mark_as_initialized(); + int rank = smpi_process_index(); + TRACE_smpi_init(rank); + TRACE_smpi_computing_init(rank); + instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); + extra->type = TRACING_INIT; + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); + smpi_bench_begin(); + } return MPI_SUCCESS; } @@ -1171,7 +1176,9 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE) if(status!=MPI_STATUS_IGNORE){ src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE); - TRACE_smpi_recv(rank, src_traced, rank); + if (!TRACE_smpi_view_internals()) { + TRACE_smpi_recv(rank, src_traced, rank); + } } TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__); } @@ -1216,7 +1223,9 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, dt_size_send = smpi_datatype_size(datatype); extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); - TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); + if (!TRACE_smpi_view_internals()) { + TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); + } smpi_mpi_send(buf, count, datatype, dst, tag, comm); retval = MPI_SUCCESS; @@ -1816,10 +1825,11 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dt_size_recv = 1; if(!known) dt_size_recv = smpi_datatype_size(recvtype); + if((smpi_comm_rank(comm)==root)){ extra->recvcounts= xbt_malloc(size*sizeof(int)); 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, root_traced, __FUNCTION__,extra); smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, @@ -2019,9 +2029,11 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, int dt_size_send = 1; if(!known) dt_size_send = smpi_datatype_size(sendtype); + if((smpi_comm_rank(comm)==root)){ extra->sendcounts= xbt_malloc(size*sizeof(int)); for(i=0; i< size; i++)//copy data to avoid bad free extra->sendcounts[i] = sendcounts[i]*dt_size_send; + } extra->datatype2 = encode_datatype(recvtype, &known); int dt_size_recv = 1; if(!known)