Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill another useless synchronization source: no one will interupt you in simulation
[simgrid.git] / src / smpi / smpi_receiver.c
index 365dad5..be02907 100644 (file)
@@ -9,9 +9,7 @@ int smpi_receiver(int argc, char **argv)
   int index;
 
   xbt_fifo_t request_queue;
   int index;
 
   xbt_fifo_t request_queue;
-  smx_mutex_t request_queue_mutex;
   xbt_fifo_t message_queue;
   xbt_fifo_t message_queue;
-  smx_mutex_t message_queue_mutex;
 
   int running_hosts_count;
 
 
   int running_hosts_count;
 
@@ -23,43 +21,17 @@ int smpi_receiver(int argc, char **argv)
 
   self = SIMIX_process_self();
 
 
   self = SIMIX_process_self();
 
-  // make sure root is done before own initialization
-  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-  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);
-
   index = smpi_host_index();
 
   request_queue = smpi_global->pending_recv_request_queues[index];
   index = smpi_host_index();
 
   request_queue = smpi_global->pending_recv_request_queues[index];
-  request_queue_mutex =
-    smpi_global->pending_recv_request_queues_mutexes[index];
   message_queue = smpi_global->received_message_queues[index];
   message_queue = smpi_global->received_message_queues[index];
-  message_queue_mutex = smpi_global->received_message_queues_mutexes[index];
 
   smpi_global->receiver_processes[index] = self;
 
 
   smpi_global->receiver_processes[index] = self;
 
-  // 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_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 {
 
     // FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
 
   do {
 
     // FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
 
-    // FIXME: not the best way to request multiple locks...
-    SIMIX_mutex_lock(request_queue_mutex);
-    SIMIX_mutex_lock(message_queue_mutex);
     for (request_item = xbt_fifo_get_first_item(request_queue);
          NULL != request_item;
          request_item = xbt_fifo_get_next_item(request_item)) {
     for (request_item = xbt_fifo_get_first_item(request_queue);
          NULL != request_item;
          request_item = xbt_fifo_get_next_item(request_item)) {
@@ -84,9 +56,6 @@ int smpi_receiver(int argc, char **argv)
     message = NULL;
 
   stopsearch:
     message = NULL;
 
   stopsearch:
-    SIMIX_mutex_unlock(message_queue_mutex);
-    SIMIX_mutex_unlock(request_queue_mutex);
-
     if (NULL == request || NULL == message) {
       SIMIX_process_suspend(self);
     } else {
     if (NULL == request || NULL == message) {
       SIMIX_process_suspend(self);
     } else {
@@ -114,9 +83,7 @@ int smpi_receiver(int argc, char **argv)
 
     }
 
 
     }
 
-    SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
     running_hosts_count = smpi_global->running_hosts_count;
     running_hosts_count = smpi_global->running_hosts_count;
-    SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
 
   } while (0 < running_hosts_count);
 
 
   } while (0 < running_hosts_count);