From 9f34e4c6b167e7c684ba096920e4702a8d584e3c Mon Sep 17 00:00:00 2001 From: mquinson Date: Tue, 23 Jun 2009 15:06:38 +0000 Subject: [PATCH 1/1] SMPI: Remove the initialization barrier now that it's useless git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6332 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/smpi/private.h | 4 ---- src/smpi/smpi_base.c | 38 -------------------------------------- src/smpi/smpi_global.c | 11 ----------- src/smpi/smpi_receiver.c | 20 -------------------- src/smpi/smpi_sender.c | 20 -------------------- 5 files changed, 93 deletions(-) diff --git a/src/smpi/private.h b/src/smpi/private.h index 3c57388dcb..6c38d98b37 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -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; diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 11439cce88..dcbef986c6 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -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()); diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 4dac16053e..f0ad13e1eb 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -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); diff --git a/src/smpi/smpi_receiver.c b/src/smpi/smpi_receiver.c index 365dad5edf..0f56f84b9e 100644 --- a/src/smpi/smpi_receiver.c +++ b/src/smpi/smpi_receiver.c @@ -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? diff --git a/src/smpi/smpi_sender.c b/src/smpi/smpi_sender.c index 76b43e8bdc..71e9fa991d 100644 --- a/src/smpi/smpi_sender.c +++ b/src/smpi/smpi_sender.c @@ -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); -- 2.20.1