Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: kill some free() from the smpi_process_finalize of the last leaving process...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:54:45 +0000 (19:54 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Jun 2009 19:54:45 +0000 (19:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6343 48e7efb5-ca39-0410-a469-dd3cf9ba447f

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

index ff6bcb6..63be652 100644 (file)
@@ -95,8 +95,6 @@ typedef struct smpi_global_t {
 
   smx_process_t *main_processes;
 
-  int running_hosts_count; //FIXME: killme
-
   xbt_os_timer_t timer;
   smx_mutex_t timer_mutex;
   smx_cond_t timer_cond;
index eb9436f..10a02c1 100644 (file)
@@ -53,8 +53,6 @@ void smpi_process_init()
   int i;
   smpi_host_data_t hdata;
 
-  smpi_global->running_hosts_count++;
-
   // initialize some local variables
   host = SIMIX_host_self();
 
@@ -87,11 +85,8 @@ void smpi_process_init()
 
 void smpi_process_finalize()
 {
-  int i;
   smpi_host_data_t hdata =  SIMIX_host_get_data(SIMIX_host_self());
 
-  i = --smpi_global->running_hosts_count;
-
   hdata->finalize = 2; /* Tell sender and receiver to quit */
   SIMIX_process_resume(hdata->sender);
   SIMIX_process_resume(hdata->receiver);
@@ -102,35 +97,6 @@ void smpi_process_finalize()
   SIMIX_mutex_destroy(hdata->mutex);
   SIMIX_cond_destroy(hdata->cond);
   xbt_fifo_free(hdata->pending_recv_request_queue);
-
-
-  if (0 >= i) {
-
-    // wake up senders/receivers
-         /* MQ: (FIXME) Don't do so: it breaks since some hosts are already gone
-    for (i = 0; i < smpi_global->host_count; i++) {
-      smpi_host_data_t remote_hdata =  SIMIX_process_get_data(smpi_global->main_processes[i]);
-
-      if (SIMIX_process_is_suspended(remote_hdata->sender))
-        SIMIX_process_resume(remote_hdata->sender);
-
-      if (SIMIX_process_is_suspended(remote_hdata->receiver))
-        SIMIX_process_resume(remote_hdata->receiver);
-    }*/
-
-    SIMIX_mutex_destroy(smpi_mpi_global->mpi_comm_world->barrier_mutex);
-    SIMIX_cond_destroy(smpi_mpi_global->mpi_comm_world->barrier_cond);
-    xbt_free(smpi_mpi_global->mpi_comm_world);
-
-    xbt_free(smpi_mpi_global->mpi_byte);
-    xbt_free(smpi_mpi_global->mpi_int);
-    xbt_free(smpi_mpi_global->mpi_double);
-
-    xbt_free(smpi_mpi_global->mpi_land);
-    xbt_free(smpi_mpi_global->mpi_sum);
-
-    xbt_free(smpi_mpi_global);
-  }
 }
 
 int smpi_mpi_barrier(smpi_mpi_communicator_t comm)
index 8e1057b..6c83e20 100644 (file)
@@ -152,9 +152,6 @@ void smpi_global_init()
   smpi_global->hosts = NULL;
   smpi_global->host_count = 0;
 
-  // running hosts
-  smpi_global->running_hosts_count = 0;
-
   // mallocators
   smpi_global->request_mallocator =
     xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE, smpi_request_new,
@@ -256,8 +253,22 @@ void smpi_global_destroy()
   xbt_free(smpi_global->received_message_queues);
 
   xbt_free(smpi_global);
-
   smpi_global = NULL;
+
+  /* free smpi_mpi_global */
+  SIMIX_mutex_destroy(smpi_mpi_global->mpi_comm_world->barrier_mutex);
+  SIMIX_cond_destroy(smpi_mpi_global->mpi_comm_world->barrier_cond);
+  xbt_free(smpi_mpi_global->mpi_comm_world);
+
+  xbt_free(smpi_mpi_global->mpi_byte);
+  xbt_free(smpi_mpi_global->mpi_int);
+  xbt_free(smpi_mpi_global->mpi_double);
+
+  xbt_free(smpi_mpi_global->mpi_land);
+  xbt_free(smpi_mpi_global->mpi_sum);
+
+  xbt_free(smpi_mpi_global);
+
 }
 
 int smpi_host_index()