Commit a3e83057 authored by James Dinan's avatar James Dinan Committed by Kenneth Raffenetti
Browse files

Update comm_create to use sparse ctx id allocation



Update MPI_Comm_create to use sparse, rather than dense, context_id
allocation. This fixes incorrect context ID exhaustion errors caused by
including processes that are not in the group of the new communicator in
the allocation operation. This bug is exercised by
test/mpi/cerrors/comm/too_many_comms3.c.
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent 86adc1b1
...@@ -233,8 +233,8 @@ int MPIR_Comm_create_intra(MPID_Comm *comm_ptr, MPID_Group *group_ptr, ...@@ -233,8 +233,8 @@ int MPIR_Comm_create_intra(MPID_Comm *comm_ptr, MPID_Group *group_ptr,
member of the group */ member of the group */
/* In the multi-threaded case, MPIR_Get_contextid assumes that the /* In the multi-threaded case, MPIR_Get_contextid assumes that the
calling routine already holds the single criticial section */ calling routine already holds the single criticial section */
/* TODO should be converted to use MPIR_Get_contextid_sparse instead */ mpi_errno = MPIR_Get_contextid_sparse( comm_ptr, &new_context_id,
mpi_errno = MPIR_Get_contextid( comm_ptr, &new_context_id ); group_ptr->rank == MPI_UNDEFINED );
if (mpi_errno) MPIU_ERR_POP(mpi_errno); if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_Assert(new_context_id != 0); MPIU_Assert(new_context_id != 0);
...@@ -278,7 +278,6 @@ int MPIR_Comm_create_intra(MPID_Comm *comm_ptr, MPID_Group *group_ptr, ...@@ -278,7 +278,6 @@ int MPIR_Comm_create_intra(MPID_Comm *comm_ptr, MPID_Group *group_ptr,
} }
else { else {
/* This process is not in the group */ /* This process is not in the group */
MPIR_Free_contextid( new_context_id );
new_context_id = 0; new_context_id = 0;
} }
...@@ -294,8 +293,9 @@ fn_fail: ...@@ -294,8 +293,9 @@ fn_fail:
MPIR_Comm_release(*newcomm_ptr, 0/*isDisconnect*/); MPIR_Comm_release(*newcomm_ptr, 0/*isDisconnect*/);
new_context_id = 0; /* MPIR_Comm_release frees the new ctx id */ new_context_id = 0; /* MPIR_Comm_release frees the new ctx id */
} }
if (new_context_id != 0) if (new_context_id != 0 && group_ptr->rank != MPI_UNDEFINED) {
MPIR_Free_contextid(new_context_id); MPIR_Free_contextid(new_context_id);
}
/* --END ERROR HANDLING-- */ /* --END ERROR HANDLING-- */
goto fn_exit; goto fn_exit;
} }
......
Markdown is supported
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