X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3fa78c2064c144ac3b4035142261bda6cead8211..4243c7096494e3404386384ea729f48068036399:/src/smpi/smpi_base.cpp diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 9ad417780f..11512ab3fb 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -390,7 +390,7 @@ void smpi_mpi_start(MPI_Request request) //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0 double sleeptime = (request->detached != 0) ? smpi_or(request->size) : 0.0; - if(sleeptime >= 0.0){ + if(sleeptime > 0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size)); } @@ -415,12 +415,12 @@ void smpi_mpi_start(MPI_Request request) //if we are giving back the control to the user without waiting for completion, we have to inject timings double sleeptime = 0.0; - if(request->detached != 0 || (request->flags & (ISEND|SSEND))){// issend should be treated as isend + if(request->detached != 0 || ((request->flags & (ISEND|SSEND)) != 0)){// issend should be treated as isend //isend and send timings may be different sleeptime = ((request->flags & ISEND) != 0)? smpi_ois(request->size) : smpi_os(request->size); } - if(sleeptime != 0.0){ + if(sleeptime > 0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size)); } @@ -671,7 +671,7 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) MPI_Request req = *request; smpi_empty_status(status); - if(!((req->detached != 0) && req->flags & SEND) && ((req->flags & PREPARED) == 0)){ + if(!((req->detached != 0) && ((req->flags & SEND) != 0)) && ((req->flags & PREPARED) == 0)){ if(status != MPI_STATUS_IGNORE) { int src = req->src == MPI_ANY_SOURCE ? req->real_src : req->src; status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(req->comm), src); @@ -708,7 +708,7 @@ static void finish_wait(MPI_Request * request, MPI_Status * status) } } - if (TRACE_smpi_view_internals() && req->flags & RECV){ + if (TRACE_smpi_view_internals() && ((req->flags & RECV) != 0)){ int rank = smpi_process_index(); int src_traced = (req->src == MPI_ANY_SOURCE ? req->real_src : req->src); TRACE_smpi_recv(rank, src_traced, rank); @@ -835,7 +835,7 @@ void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status){ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status){ - MPI_Request request =build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : + MPI_Request request = build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag, comm, PERSISTENT | RECV); // to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls @@ -849,28 +849,29 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* print_request("New iprobe", request); // We have to test both mailboxes as we don't know if we will receive one one or another - if (xbt_cfg_get_int("smpi/async-small-thresh")>0){ + if (xbt_cfg_get_int("smpi/async-small-thresh") > 0){ mailbox = smpi_process_mailbox_small(); - XBT_DEBUG("trying to probe the perm recv mailbox"); + XBT_DEBUG("Trying to probe the perm recv mailbox"); request->action = simcall_comm_iprobe(mailbox, 0, request->src, request->tag, &match_recv, static_cast(request)); } - if (request->action==NULL){ - mailbox = smpi_process_mailbox(); - XBT_DEBUG("trying to probe the other mailbox"); - request->action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, static_cast(request)); + + if (request->action == NULL){ + mailbox = smpi_process_mailbox(); + XBT_DEBUG("trying to probe the other mailbox"); + request->action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, static_cast(request)); } if (request->action){ simgrid::simix::Comm *sync_comm = static_cast(request->action); - MPI_Request req = static_cast(sync_comm->src_data); + MPI_Request req = static_cast(sync_comm->src_data); *flag = 1; - if(status != MPI_STATUS_IGNORE && (req->flags & PREPARED)==0) { + if(status != MPI_STATUS_IGNORE && (req->flags & PREPARED) == 0) { status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(comm), req->src); status->MPI_TAG = req->tag; status->MPI_ERROR = MPI_SUCCESS; status->count = req->real_size; } - nsleeps=1;//reset the number of sleeps we will do next time + nsleeps = 1;//reset the number of sleeps we will do next time } else { *flag = 0;