X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0afab0e550e09d35a4aaaae802c7f2ea17d2b860..fc6d940029b26eab087466134f755f2880e8c8d5:/src/smpi/smpi_base.c diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 1387109e0e..d29b237c67 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -42,7 +42,7 @@ static MPI_Request build_request(void *buf, int count, { MPI_Request request; - void *old_buf; + void *old_buf = NULL; request = xbt_new(s_smpi_mpi_request_t, 1); @@ -159,14 +159,18 @@ void smpi_mpi_start(MPI_Request request) // FIXME: SIMIX does not yet support non-contiguous datatypes request->action = simcall_comm_irecv(mailbox, request->buf, &request->size, &match_recv, request); } else { + + int receiver = smpi_group_index(smpi_comm_group(request->comm), request->dst); + if(receiver == MPI_UNDEFINED) { + XBT_WARN("Trying to send a message to a wrong rank"); + return; + } print_request("New send", request); if (request->size < xbt_cfg_get_int(_surf_cfg_set, "smpi/async_small_thres")) { // eager mode - mailbox = smpi_process_remote_mailbox_small( - smpi_group_index(smpi_comm_group(request->comm), request->dst)); + mailbox = smpi_process_remote_mailbox_small(receiver); }else{ XBT_DEBUG("Send request %p is not in the permanent receive mailbox (buf: %p)",request,request->buf); - mailbox = smpi_process_remote_mailbox( - smpi_group_index(smpi_comm_group(request->comm), request->dst)); + mailbox = smpi_process_remote_mailbox(receiver); } if (request->size < 64*1024 ) { //(FIXME: this limit should be configurable) void *oldbuf = request->buf; @@ -580,6 +584,7 @@ int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices, MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat; count = 0; + count_dead = 0; for(i = 0; i < incount; i++) { if((requests[i] != MPI_REQUEST_NULL)) { if(smpi_mpi_test(&requests[i], pstat)) {