X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5f7e3ee3f051a31e1568c69456e83f20ff69e69f..2cad53ea106892eb80ebd9a11d3498d1cc5d4c2e:/src/smpi/smpi_receiver.c diff --git a/src/smpi/smpi_receiver.c b/src/smpi/smpi_receiver.c index eb5c887cbf..43990a5f6b 100644 --- a/src/smpi/smpi_receiver.c +++ b/src/smpi/smpi_receiver.c @@ -1,5 +1,7 @@ #include "private.h" +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_receiver, smpi, "Logging specific to SMPI (receiver)"); + int smpi_receiver(int argc, char **argv) { smx_process_t self; @@ -22,7 +24,7 @@ int smpi_receiver(int argc, char **argv) // make sure root is done before own initialization SIMIX_mutex_lock(smpi_global->start_stop_mutex); - if (!smpi_global->root_ready) { + while (!smpi_global->root_ready) { SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex); } SIMIX_mutex_unlock(smpi_global->start_stop_mutex); @@ -39,11 +41,12 @@ int smpi_receiver(int argc, char **argv) // wait for all nodes to signal initializatin complete SIMIX_mutex_lock(smpi_global->start_stop_mutex); smpi_global->ready_process_count++; - if (smpi_global->ready_process_count < 3 * smpi_global->host_count) { - SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex); - } else { + if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) { SIMIX_cond_broadcast(smpi_global->start_stop_cond); } + while (smpi_global->ready_process_count < 3 * smpi_global->host_count) { + SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex); + } SIMIX_mutex_unlock(smpi_global->start_stop_mutex); do { @@ -63,9 +66,10 @@ int smpi_receiver(int argc, char **argv) NULL != message_item; message_item = xbt_fifo_get_next_item(message_item)) { message = xbt_fifo_get_item_content(message_item); - if (request->comm == message->comm && - (MPI_ANY_SOURCE == request->src || request->src == message->src) && - (MPI_ANY_TAG == request->tag || request->tag == message->tag)) { + if ( + request->comm == message->comm && + (MPI_ANY_SOURCE == request->src || request->src == message->src) && + (MPI_ANY_TAG == request->tag || request->tag == message->tag)) { xbt_fifo_remove_item(request_queue, request_item); xbt_fifo_remove_item(message_queue, message_item); goto stopsearch; @@ -90,7 +94,7 @@ stopsearch: request->completed = 1; SIMIX_cond_broadcast(request->cond); } else { - request->src = smpi_mpi_comm_rank(request->comm); + request->src = request->comm->index_to_rank_map[index]; request->dst = (request->src + 1) % request->comm->size; smpi_mpi_isend(request); }