From ee375d6d208c052c9d9ebefec88c5fbfa32cc43a Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 24 Jun 2009 19:55:02 +0000 Subject: [PATCH] SMPI: move pending_send_request_queue from global to host data git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6344 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/smpi/private.h | 2 +- src/smpi/smpi_base.c | 9 ++++----- src/smpi/smpi_global.c | 4 ---- src/smpi/smpi_sender.c | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/smpi/private.h b/src/smpi/private.h index 63be652dcb..d90f632bee 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -90,7 +90,6 @@ typedef struct smpi_global_t { xbt_mallocator_t message_mallocator; // FIXME: request queues should be moved to host data... - xbt_fifo_t *pending_send_request_queues; xbt_fifo_t *received_message_queues; smx_process_t *main_processes; @@ -120,6 +119,7 @@ typedef struct smpi_host_data_t { int finalize; /* for main stopping sender&receiver */ xbt_fifo_t pending_recv_request_queue; + xbt_fifo_t pending_send_request_queue; } s_smpi_host_data_t; typedef struct smpi_host_data_t *smpi_host_data_t; diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 10a02c1b9f..fb80869be6 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -68,6 +68,7 @@ void smpi_process_init() hdata->finalize = 0; hdata->pending_recv_request_queue = xbt_fifo_new(); + hdata->pending_send_request_queue = xbt_fifo_new(); hdata->main = SIMIX_process_self(); hdata->sender = SIMIX_process_create("smpi_sender", @@ -97,6 +98,7 @@ void smpi_process_finalize() SIMIX_mutex_destroy(hdata->mutex); SIMIX_cond_destroy(hdata->cond); xbt_fifo_free(hdata->pending_recv_request_queue); + xbt_fifo_free(hdata->pending_send_request_queue); } int smpi_mpi_barrier(smpi_mpi_communicator_t comm) @@ -125,11 +127,8 @@ int smpi_mpi_isend(smpi_mpi_request_t request) if (NULL == request) { retval = MPI_ERR_INTERN; } else { - xbt_fifo_push(smpi_global->pending_send_request_queues[hdata->index], request); - - if (SIMIX_process_is_suspended(hdata->sender)) { - SIMIX_process_resume(hdata->sender); - } + xbt_fifo_push(hdata->pending_send_request_queue, request); + SIMIX_process_resume(hdata->sender); } return retval; diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 6c83e20bf8..0d1b432425 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -161,7 +161,6 @@ void smpi_global_init() smpi_message_free, smpi_message_reset); // queues - smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size); smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size); // sender/receiver processes @@ -177,7 +176,6 @@ void smpi_global_init() smpi_global->do_once_mutex = SIMIX_mutex_init(); for (i = 0; i < size; i++) { - smpi_global->pending_send_request_queues[i] = xbt_fifo_new(); smpi_global->received_message_queues[i] = xbt_fifo_new(); } @@ -245,11 +243,9 @@ void smpi_global_destroy() SIMIX_mutex_destroy(smpi_global->do_once_mutex); for (i = 0; i < size; i++) { - xbt_fifo_free(smpi_global->pending_send_request_queues[i]); xbt_fifo_free(smpi_global->received_message_queues[i]); } - xbt_free(smpi_global->pending_send_request_queues); xbt_free(smpi_global->received_message_queues); xbt_free(smpi_global); diff --git a/src/smpi/smpi_sender.c b/src/smpi/smpi_sender.c index 9098aa2c94..ae5a74ec34 100644 --- a/src/smpi/smpi_sender.c +++ b/src/smpi/smpi_sender.c @@ -29,7 +29,7 @@ int smpi_sender(int argc,char*argv[]) { index = mydata->index; - request_queue = smpi_global->pending_send_request_queues[index]; + request_queue = mydata->pending_send_request_queue; while (1) { request = xbt_fifo_shift(request_queue); -- 2.20.1