Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: move pending_send_request_queue from global to host data
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:55:02 +0000 (19:55 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:55:02 +0000 (19:55 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6344 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/private.h
src/smpi/smpi_base.c
src/smpi/smpi_global.c
src/smpi/smpi_sender.c

index 63be652..d90f632 100644 (file)
@@ -90,7 +90,6 @@ typedef struct smpi_global_t {
   xbt_mallocator_t message_mallocator;
 
   // FIXME: request queues should be moved to host data...
   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;
   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;
   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;
 
 } s_smpi_host_data_t;
 typedef struct smpi_host_data_t *smpi_host_data_t;
 
index 10a02c1..fb80869 100644 (file)
@@ -68,6 +68,7 @@ void smpi_process_init()
   hdata->finalize = 0;
 
   hdata->pending_recv_request_queue = xbt_fifo_new();
   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",
 
   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);
   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)
 }
 
 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 {
   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;
   }
 
   return retval;
index 6c83e20..0d1b432 100644 (file)
@@ -161,7 +161,6 @@ void smpi_global_init()
                        smpi_message_free, smpi_message_reset);
 
   // queues
                        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
   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->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();
   }
 
     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++) {
   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_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);
   xbt_free(smpi_global->received_message_queues);
 
   xbt_free(smpi_global);
index 9098aa2..ae5a74e 100644 (file)
@@ -29,7 +29,7 @@ int smpi_sender(int argc,char*argv[]) {
 
   index = mydata->index;
 
 
   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);
 
   while (1) {
     request = xbt_fifo_shift(request_queue);