Commit e60d6802 authored by iker_martin's avatar iker_martin
Browse files

Bugfix around communicators. Most of them must be disconnected to ensure zombies can terminate.

parent fbe98dff
...@@ -84,8 +84,8 @@ void MAM_print_comms_state() { ...@@ -84,8 +84,8 @@ void MAM_print_comms_state() {
* Función para modificar los comunicadores principales de MaM * Función para modificar los comunicadores principales de MaM
*/ */
void MAM_comms_update(MPI_Comm comm) { void MAM_comms_update(MPI_Comm comm) {
if(mall->thread_comm != MPI_COMM_WORLD) MPI_Comm_free(&(mall->thread_comm)); if(mall->thread_comm != MPI_COMM_WORLD) MPI_Comm_disconnect(&(mall->thread_comm));
if(mall->comm != MPI_COMM_WORLD) MPI_Comm_free(&(mall->comm)); if(mall->comm != MPI_COMM_WORLD) MPI_Comm_disconnect(&(mall->comm));
MPI_Comm_dup(comm, &(mall->thread_comm)); MPI_Comm_dup(comm, &(mall->thread_comm));
MPI_Comm_dup(comm, &(mall->comm)); MPI_Comm_dup(comm, &(mall->comm));
......
...@@ -18,6 +18,7 @@ typedef struct { ...@@ -18,6 +18,7 @@ typedef struct {
double spawn_start, spawn_time; double spawn_start, spawn_time;
double sync_start, sync_end; double sync_start, sync_end;
double async_start, async_end; double async_start, async_end;
double user_start, user_end;
double malleability_start, malleability_end; double malleability_start, malleability_end;
MPI_Datatype times_type; MPI_Datatype times_type;
......
...@@ -116,7 +116,7 @@ void multiple_strat_parents(Spawn_data spawn_data, MPI_Comm comm, MPI_Comm *inte ...@@ -116,7 +116,7 @@ void multiple_strat_parents(Spawn_data spawn_data, MPI_Comm comm, MPI_Comm *inte
MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, comm, child); MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, comm, child);
for(i=0; i<spawn_data.total_spawns; i++) { for(i=0; i<spawn_data.total_spawns; i++) {
MPI_Comm_free(&intercomms[i]); MPI_Comm_disconnect(&intercomms[i]);
} }
free(port_name); free(port_name);
} }
...@@ -153,7 +153,7 @@ void multiple_strat_children(MPI_Comm *parents) { ...@@ -153,7 +153,7 @@ void multiple_strat_children(MPI_Comm *parents) {
MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, mall->comm, &intercomm); MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, mall->comm, &intercomm);
MPI_Bcast(&total_spawns, 1, MPI_INT, mall->root, intercomm); // FIXME Seems inneficient - Should be performed by parent root? MPI_Bcast(&total_spawns, 1, MPI_INT, mall->root, intercomm); // FIXME Seems inneficient - Should be performed by parent root?
MPI_Intercomm_merge(intercomm, 1, &newintracomm); // Get last ranks MPI_Intercomm_merge(intercomm, 1, &newintracomm); // Get last ranks
MPI_Comm_free(&intercomm); MPI_Comm_disconnect(&intercomm);
} else { } else {
start = 1; start = 1;
MPI_Comm_dup(mall->comm, &newintracomm); MPI_Comm_dup(mall->comm, &newintracomm);
...@@ -163,9 +163,9 @@ void multiple_strat_children(MPI_Comm *parents) { ...@@ -163,9 +163,9 @@ void multiple_strat_children(MPI_Comm *parents) {
for(i=start; i<total_spawns; i++) { for(i=start; i<total_spawns; i++) {
MPI_Comm_accept(port_name, MPI_INFO_NULL, mall->root, newintracomm, &intercomm); MPI_Comm_accept(port_name, MPI_INFO_NULL, mall->root, newintracomm, &intercomm);
MPI_Bcast(&total_spawns, 1, MPI_INT, rootBcast, intercomm); // FIXME Seems inneficient - Should be performed by parent root? MPI_Bcast(&total_spawns, 1, MPI_INT, rootBcast, intercomm); // FIXME Seems inneficient - Should be performed by parent root?
if(newintracomm != MPI_COMM_WORLD) MPI_Comm_free(&newintracomm); if(newintracomm != MPI_COMM_WORLD) MPI_Comm_disconnect(&newintracomm);
MPI_Intercomm_merge(intercomm, 0, &newintracomm); // Get first ranks MPI_Intercomm_merge(intercomm, 0, &newintracomm); // Get first ranks
MPI_Comm_free(&intercomm); MPI_Comm_disconnect(&intercomm);
if(new_root) { if(new_root) {
MPI_Send(&aux, 1, MPI_CHAR, stat.MPI_SOURCE, stat.MPI_TAG, parents_comm); // Ensures order in the created intracommunicator MPI_Send(&aux, 1, MPI_CHAR, stat.MPI_SOURCE, stat.MPI_TAG, parents_comm); // Ensures order in the created intracommunicator
...@@ -181,8 +181,8 @@ void multiple_strat_children(MPI_Comm *parents) { ...@@ -181,8 +181,8 @@ void multiple_strat_children(MPI_Comm *parents) {
if(new_root) MPI_Close_port(port_name); if(new_root) MPI_Close_port(port_name);
free(port_name); free(port_name);
MPI_Comm_free(&newintracomm); MPI_Comm_disconnect(&newintracomm);
MPI_Comm_free(parents); MPI_Comm_disconnect(parents);
*parents = intercomm; *parents = intercomm;
} }
...@@ -207,7 +207,7 @@ void single_strat_parents(Spawn_data spawn_data, MPI_Comm *child) { ...@@ -207,7 +207,7 @@ void single_strat_parents(Spawn_data spawn_data, MPI_Comm *child) {
MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, spawn_data.comm, &newintercomm); MPI_Comm_connect(port_name, MPI_INFO_NULL, mall->root, spawn_data.comm, &newintercomm);
if(mall->myId == mall->root) if(mall->myId == mall->root)
MPI_Comm_free(child); MPI_Comm_disconnect(child);
free(port_name); free(port_name);
*child = newintercomm; *child = newintercomm;
} }
...@@ -237,6 +237,6 @@ void single_strat_children(MPI_Comm *parents) { ...@@ -237,6 +237,6 @@ void single_strat_children(MPI_Comm *parents) {
MPI_Close_port(port_name); MPI_Close_port(port_name);
} }
free(port_name); free(port_name);
MPI_Comm_free(parents); MPI_Comm_disconnect(parents);
*parents = newintercomm; *parents = newintercomm;
} }
...@@ -57,7 +57,7 @@ void merge_adapt_expand(MPI_Comm *child, int is_children_group) { ...@@ -57,7 +57,7 @@ void merge_adapt_expand(MPI_Comm *child, int is_children_group) {
MPI_Intercomm_merge(*child, is_children_group, &new_comm); //El que pone 0 va primero MPI_Intercomm_merge(*child, is_children_group, &new_comm); //El que pone 0 va primero
MPI_Comm_free(child); MPI_Comm_disconnect(child);
*child = new_comm; *child = new_comm;
} }
...@@ -72,6 +72,7 @@ void merge_adapt_expand(MPI_Comm *child, int is_children_group) { ...@@ -72,6 +72,7 @@ void merge_adapt_expand(MPI_Comm *child, int is_children_group) {
void merge_adapt_shrink(int numC, MPI_Comm *child, MPI_Comm comm, int myId) { void merge_adapt_shrink(int numC, MPI_Comm *child, MPI_Comm comm, int myId) {
int color = MPI_UNDEFINED; int color = MPI_UNDEFINED;
if(*child != MPI_COMM_NULL && *child != MPI_COMM_WORLD) MPI_Comm_disconnect(child);
if(myId < numC) { if(myId < numC) {
color = 1; color = 1;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment