From 8cbcd8756ae9134b66658b4ccb9cee91352da649 Mon Sep 17 00:00:00 2001 From: suter Date: Tue, 7 Dec 2010 11:34:20 +0000 Subject: [PATCH] Simix seems to destroy the comm by itself, comment the calls to 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 | 14 ++++++++------ examples/msg/actions/actions_allReduce.txt | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index 9188bb6f55..f5be73322f 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -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_destroy(comms[i-1]); MSG_task_destroy(tasks[i-1]); - MSG_comm_destroy(comms[i-1]); } free(tasks); @@ -487,8 +487,8 @@ static void action_allReduce(xbt_dynar_t action) { 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", @@ -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 - 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 */ diff --git a/examples/msg/actions/actions_allReduce.txt b/examples/msg/actions/actions_allReduce.txt index b583982d5b..7dbc0b77d1 100644 --- a/examples/msg/actions/actions_allReduce.txt +++ b/examples/msg/actions/actions_allReduce.txt @@ -1,3 +1,7 @@ +p0 init +p1 init +p2 init + 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 +p0 finalize +p1 finalize +p2 finalize -- 2.20.1