Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move pending_recv_request_queues into host_data (ie, wanna be process_data)
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:53:32 +0000 (19:53 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:53:32 +0000 (19:53 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6339 48e7efb5-ca39-0410-a469-dd3cf9ba447f

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

index f33b9ba..5f79622 100644 (file)
@@ -91,7 +91,6 @@ typedef struct smpi_global_t {
 
   // FIXME: request queues should be moved to host data...
   xbt_fifo_t *pending_send_request_queues;
 
   // FIXME: request queues should be moved to host data...
   xbt_fifo_t *pending_send_request_queues;
-  xbt_fifo_t *pending_recv_request_queues;
   xbt_fifo_t *received_message_queues;
 
   smx_process_t *sender_processes;
   xbt_fifo_t *received_message_queues;
 
   smx_process_t *sender_processes;
@@ -116,9 +115,12 @@ typedef struct smpi_host_data_t {
   int index;
   smx_mutex_t mutex;
   smx_cond_t cond;
   int index;
   smx_mutex_t mutex;
   smx_cond_t cond;
+
   smx_process_t main;
   smx_process_t sender;
   smx_process_t receiver;
   smx_process_t main;
   smx_process_t sender;
   smx_process_t receiver;
+
+  xbt_fifo_t pending_recv_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 15d36a8..6af070a 100644 (file)
@@ -66,6 +66,9 @@ void smpi_process_init()
   hdata->index = i;
   hdata->mutex = SIMIX_mutex_init();
   hdata->cond = SIMIX_cond_init();
   hdata->index = i;
   hdata->mutex = SIMIX_mutex_init();
   hdata->cond = SIMIX_cond_init();
+
+  hdata->pending_recv_request_queue = xbt_fifo_new();
+
   hdata->main = SIMIX_process_self();
   hdata->sender = SIMIX_process_create("smpi_sender",
           smpi_sender, hdata,
   hdata->main = SIMIX_process_self();
   hdata->sender = SIMIX_process_create("smpi_sender",
           smpi_sender, hdata,
@@ -81,11 +84,13 @@ void smpi_process_init()
 void smpi_process_finalize()
 {
   int i;
 void smpi_process_finalize()
 {
   int i;
+  smpi_host_data_t hdata =  SIMIX_host_get_data(SIMIX_host_self());
 
   i = --smpi_global->running_hosts_count;
 
   SIMIX_mutex_destroy(smpi_host_mutex());
   SIMIX_cond_destroy(smpi_host_cond());
 
   i = --smpi_global->running_hosts_count;
 
   SIMIX_mutex_destroy(smpi_host_mutex());
   SIMIX_cond_destroy(smpi_host_cond());
+  xbt_fifo_free(hdata->pending_recv_request_queue);
 
   if (0 >= i) {
 
 
   if (0 >= i) {
 
@@ -155,15 +160,15 @@ int smpi_mpi_isend(smpi_mpi_request_t request)
 int smpi_mpi_irecv(smpi_mpi_request_t request)
 {
   int retval = MPI_SUCCESS;
 int smpi_mpi_irecv(smpi_mpi_request_t request)
 {
   int retval = MPI_SUCCESS;
-  int index = smpi_host_index();
+  smpi_host_data_t hdata =  SIMIX_host_get_data(SIMIX_host_self());
 
   if (NULL == request) {
     retval = MPI_ERR_INTERN;
   } else {
 
   if (NULL == request) {
     retval = MPI_ERR_INTERN;
   } else {
-    xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
+    xbt_fifo_push(hdata->pending_recv_request_queue, request);
 
 
-    if (SIMIX_process_is_suspended(smpi_global->receiver_processes[index])) {
-      SIMIX_process_resume(smpi_global->receiver_processes[index]);
+    if (SIMIX_process_is_suspended(smpi_global->receiver_processes[hdata->index])) {
+      SIMIX_process_resume(smpi_global->receiver_processes[hdata->index]);
     }
   }
 
     }
   }
 
index 0aa6636..0648f05 100644 (file)
@@ -165,7 +165,6 @@ void smpi_global_init()
 
   // queues
   smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
 
   // queues
   smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
-  smpi_global->pending_recv_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
@@ -183,7 +182,6 @@ void smpi_global_init()
 
   for (i = 0; i < size; i++) {
     smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
 
   for (i = 0; i < size; i++) {
     smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
-    smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
     smpi_global->received_message_queues[i] = xbt_fifo_new();
   }
 
     smpi_global->received_message_queues[i] = xbt_fifo_new();
   }
 
@@ -253,12 +251,10 @@ void smpi_global_destroy()
 
   for (i = 0; i < size; i++) {
     xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
 
   for (i = 0; i < size; i++) {
     xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
-    xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
     xbt_fifo_free(smpi_global->received_message_queues[i]);
   }
 
   xbt_free(smpi_global->pending_send_request_queues);
     xbt_fifo_free(smpi_global->received_message_queues[i]);
   }
 
   xbt_free(smpi_global->pending_send_request_queues);
-  xbt_free(smpi_global->pending_recv_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 efb88dd..ff6d1d8 100644 (file)
@@ -22,7 +22,7 @@ int smpi_receiver(int argc, char*argv[])
 
   self = SIMIX_process_self();
 
 
   self = SIMIX_process_self();
 
-  request_queue = smpi_global->pending_recv_request_queues[index];
+  request_queue = mydata->pending_recv_request_queue;
   message_queue = smpi_global->received_message_queues[index];
 
   smpi_global->receiver_processes[index] = self;
   message_queue = smpi_global->received_message_queues[index];
 
   smpi_global->receiver_processes[index] = self;