Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: Remove the initialization barrier now that it's useless
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Jun 2009 15:06:38 +0000 (15:06 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Jun 2009 15:06:38 +0000 (15:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6332 48e7efb5-ca39-0410-a469-dd3cf9ba447f

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

index 3c57388..6c38d98 100644 (file)
@@ -83,10 +83,6 @@ typedef struct smpi_global_t {
   double reference_speed;
 
   // state vars
-  int root_ready:1;
-  int ready_process_count;
-  smx_mutex_t start_stop_mutex;
-  smx_cond_t start_stop_cond;
 
   smx_host_t *hosts;
   int host_count;
index 11439cc..dcbef98 100644 (file)
@@ -69,40 +69,6 @@ void smpi_init_process()
 
   SIMIX_host_set_data(host, hdata);
 
-  // node 0 sets the globals
-  if (0 == i) {
-
-
-    // signal all nodes to perform initialization
-    SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-    smpi_global->root_ready = 1;
-    SIMIX_cond_broadcast(smpi_global->start_stop_cond);
-    SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-  } else {
-
-    // 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);
-
-  }
-
-  // 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);
-
   return;
 }
 
@@ -114,10 +80,6 @@ void smpi_mpi_finalize()
   i = --smpi_global->running_hosts_count;
   SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
 
-  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-  smpi_global->ready_process_count--;
-  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
   SIMIX_mutex_destroy(smpi_host_mutex());
   SIMIX_cond_destroy(smpi_host_cond());
 
index 4dac160..f0ad13e 100644 (file)
@@ -147,13 +147,6 @@ void smpi_global_init()
   // config variable
   smpi_global->reference_speed = SMPI_DEFAULT_SPEED;
 
-  smpi_global->root_ready = 0;
-  smpi_global->ready_process_count = 0;
-
-  // start/stop
-  smpi_global->start_stop_mutex = SIMIX_mutex_init();
-  smpi_global->start_stop_cond = SIMIX_cond_init();
-
   // host info blank until sim starts
   // FIXME: is this okay?
   smpi_global->hosts = NULL;
@@ -247,10 +240,6 @@ void smpi_global_destroy()
 
   smpi_do_once_duration_node_t curr, next;
 
-  // start/stop
-  SIMIX_mutex_destroy(smpi_global->start_stop_mutex);
-  SIMIX_cond_destroy(smpi_global->start_stop_cond);
-
   // processes
   xbt_free(smpi_global->sender_processes);
   xbt_free(smpi_global->receiver_processes);
index 365dad5..0f56f84 100644 (file)
@@ -23,14 +23,6 @@ int smpi_receiver(int argc, char **argv)
 
   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];
@@ -41,18 +33,6 @@ int smpi_receiver(int argc, char **argv)
 
   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?
index 76b43e8..71e9fa9 100644 (file)
@@ -32,14 +32,6 @@ int smpi_sender(int argc, char **argv)
   self = SIMIX_process_self();
   shost = SIMIX_host_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_send_request_queues[index];
@@ -48,18 +40,6 @@ int smpi_sender(int argc, char **argv)
 
   smpi_global->sender_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 {
 
     SIMIX_mutex_lock(request_queue_mutex);