Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simix seems to destroy the comm by itself, comment the calls to
authorsuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 7 Dec 2010 11:34:20 +0000 (11:34 +0000)
committersuter <suter@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 7 Dec 2010 11:34:20 +0000 (11:34 +0000)
MSG_comm_destroy
Correct a leak in finalize action
modify the basic example to have init and finalize actions for each
process.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9052 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/actions/actions.c
examples/msg/actions/actions_allReduce.txt

index 9188bb6f557e95a22b342deb8a8da07f79bd2714..f5be73322fdc73a3cf3eafe7a1e103a0749dcf68 100644 (file)
@@ -469,8 +469,8 @@ static void action_allReduce(xbt_dynar_t action) {
     }
     MSG_comm_waitall(comms,communicator_size-1,-1);
     for (i = 1; i < communicator_size; i++) {
     }
     MSG_comm_waitall(comms,communicator_size-1,-1);
     for (i = 1; i < communicator_size; i++) {
+      // MSG_comm_destroy(comms[i-1]);
       MSG_task_destroy(tasks[i-1]);
       MSG_task_destroy(tasks[i-1]);
-      MSG_comm_destroy(comms[i-1]);
     }
     free(tasks);
 
     }
     free(tasks);
 
@@ -487,8 +487,8 @@ static void action_allReduce(xbt_dynar_t action) {
               mailbox);
     }
     MSG_comm_waitall(comms,communicator_size-1,-1);
               mailbox);
     }
     MSG_comm_waitall(comms,communicator_size-1,-1);
-    for (i = 1; i < communicator_size; i++)
-      MSG_comm_destroy(comms[i-1]);
+    /* for (i = 1; i < communicator_size; i++) */
+    /*   MSG_comm_destroy(comms[i-1]); */
     free(comms);
 
     DEBUG2("%s: all messages sent by %s have been received",
     free(comms);
 
     DEBUG2("%s: all messages sent by %s have been received",
@@ -559,9 +559,11 @@ static void action_finalize(xbt_dynar_t action)
 #ifdef HAVE_TRACING
   TRACE_smpi_finalize(get_rank(MSG_process_get_name(MSG_process_self())));
 #endif
 #ifdef HAVE_TRACING
   TRACE_smpi_finalize(get_rank(MSG_process_get_name(MSG_process_self())));
 #endif
-  process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self());
-  if (counters)
-         free(counters);
+  process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
+  if (globals){
+    xbt_dynar_free_container(&(globals->isends));
+    free(globals);
+  }
 }
 
 /** Main function */
 }
 
 /** Main function */
index b583982d5b61f5980dccf6b9b04369b8b1458bfe..7dbc0b77d105e40629b24a7f74f6b361fcaadb84 100644 (file)
@@ -1,3 +1,7 @@
+p0 init
+p1 init
+p2 init
+
 p0 comm_size 3
 p0 allReduce 5e8 5e8
 p1 allReduce 5e8 5e8
 p0 comm_size 3
 p0 allReduce 5e8 5e8
 p1 allReduce 5e8 5e8
@@ -7,3 +11,6 @@ p0 compute 5e8
 p1 compute 5e8
 p2 compute 5e8
 
 p1 compute 5e8
 p2 compute 5e8
 
+p0 finalize
+p1 finalize
+p2 finalize