Created
March 12, 2012 16:26
-
-
Save goodell/2023161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 4eb0e178cc83589389f2faaa3a2526d222c155f0 | |
| Author: Dave Goodell <[email protected]> | |
| Date: Mon Mar 12 11:24:35 2012 -0500 | |
| fix mpich1 'errhand' test broken by r9588 | |
| I oversimplified the error handling code for MPI_Comm_create and | |
| MPIX_Comm_create_group that went into that "merge" commit. | |
| Reviewed by dinan@. | |
| --- | |
| src/mpi/comm/comm_create.c | 41 ++++++++++++++++++++-------------- | |
| src/mpi/comm/comm_create_group.c | 45 +++++++++++++++++++++++--------------- | |
| 2 files changed, 52 insertions(+), 34 deletions(-) | |
| diff --git a/src/mpi/comm/comm_create.c b/src/mpi/comm/comm_create.c | |
| index bb44ea7..6e21fee 100644 | |
| --- a/src/mpi/comm/comm_create.c | |
| +++ b/src/mpi/comm/comm_create.c | |
| @@ -527,36 +527,45 @@ int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) | |
| MPIU_THREAD_CS_ENTER(ALLFUNC,); | |
| MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE); | |
| - /* Validate parameters, especially handles needing to be converted */ | |
| + /* Validate parameters, and convert MPI object handles to object pointers */ | |
| # ifdef HAVE_ERROR_CHECKING | |
| { | |
| - MPID_BEGIN_ERROR_CHECKS | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| { | |
| MPIR_ERRTEST_COMM(comm, mpi_errno); | |
| - MPIR_ERRTEST_GROUP(group, mpi_errno); | |
| if (mpi_errno) goto fn_fail; | |
| } | |
| - MPID_END_ERROR_CHECKS | |
| - } | |
| -# endif | |
| + MPID_END_ERROR_CHECKS; | |
| - /* Get handles to MPI objects. */ | |
| - MPID_Comm_get_ptr(comm, comm_ptr); | |
| - MPID_Group_get_ptr(group, group_ptr); | |
| + MPID_Comm_get_ptr( comm, comm_ptr ); | |
| - /* Validate parameters and objects (post conversion) */ | |
| -# ifdef HAVE_ERROR_CHECKING | |
| - { | |
| - MPID_BEGIN_ERROR_CHECKS | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| { | |
| + /* Validate comm_ptr */ | |
| + MPID_Comm_valid_ptr( comm_ptr, mpi_errno ); | |
| /* If comm_ptr is not valid, it will be reset to null */ | |
| - MPID_Comm_valid_ptr(comm_ptr, mpi_errno); | |
| + | |
| + /* only test for MPI_GROUP_NULL after attempting to convert the comm | |
| + * so that any errhandlers on comm will (correctly) be invoked */ | |
| + MPIR_ERRTEST_GROUP(group, mpi_errno); | |
| if (mpi_errno) goto fn_fail; | |
| + } | |
| + MPID_END_ERROR_CHECKS; | |
| + | |
| + MPID_Group_get_ptr( group, group_ptr ); | |
| - MPID_Group_valid_ptr(group_ptr, mpi_errno); | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| + { | |
| + /* Check the group ptr */ | |
| + MPID_Group_valid_ptr( group_ptr, mpi_errno ); | |
| if (mpi_errno) goto fn_fail; | |
| } | |
| - MPID_END_ERROR_CHECKS | |
| + MPID_END_ERROR_CHECKS; | |
| + } | |
| +# else | |
| + { | |
| + MPID_Comm_get_ptr( comm, comm_ptr ); | |
| + MPID_Group_get_ptr( group, group_ptr ); | |
| } | |
| # endif | |
| diff --git a/src/mpi/comm/comm_create_group.c b/src/mpi/comm/comm_create_group.c | |
| index b4a2fd4..83a76f7 100644 | |
| --- a/src/mpi/comm/comm_create_group.c | |
| +++ b/src/mpi/comm/comm_create_group.c | |
| @@ -162,39 +162,48 @@ int MPIX_Comm_create_group(MPI_Comm comm, MPI_Group group, int tag, MPI_Comm * n | |
| MPIU_THREAD_CS_ENTER(ALLFUNC,); | |
| MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_CREATE_GROUP); | |
| - /* Validate parameters, especially handles needing to be converted */ | |
| + /* Validate parameters, and convert MPI object handles to object pointers */ | |
| # ifdef HAVE_ERROR_CHECKING | |
| { | |
| - MPID_BEGIN_ERROR_CHECKS | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| { | |
| - MPIR_ERRTEST_COMM_TAG(tag, mpi_errno); | |
| MPIR_ERRTEST_COMM(comm, mpi_errno); | |
| - MPIR_ERRTEST_GROUP(group, mpi_errno); | |
| if (mpi_errno) goto fn_fail; | |
| } | |
| - MPID_END_ERROR_CHECKS | |
| - } | |
| -# endif | |
| + MPID_END_ERROR_CHECKS; | |
| - /* Get handles to MPI objects. */ | |
| - MPID_Comm_get_ptr(comm, comm_ptr); | |
| - MPID_Group_get_ptr(group, group_ptr); | |
| + MPID_Comm_get_ptr( comm, comm_ptr ); | |
| - /* Validate parameters and objects (post conversion) */ | |
| -# ifdef HAVE_ERROR_CHECKING | |
| - { | |
| - MPID_BEGIN_ERROR_CHECKS | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| { | |
| + /* Validate comm_ptr */ | |
| + MPID_Comm_valid_ptr( comm_ptr, mpi_errno ); | |
| /* If comm_ptr is not valid, it will be reset to null */ | |
| - MPID_Comm_valid_ptr(comm_ptr, mpi_errno); | |
| - if (mpi_errno) goto fn_fail; | |
| MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno); | |
| if (mpi_errno) goto fn_fail; | |
| - MPID_Group_valid_ptr(group_ptr, mpi_errno); | |
| + /* only test for MPI_GROUP_NULL after attempting to convert the comm | |
| + * so that any errhandlers on comm will (correctly) be invoked */ | |
| + MPIR_ERRTEST_GROUP(group, mpi_errno); | |
| + MPIR_ERRTEST_COMM_TAG(tag, mpi_errno); | |
| + if (mpi_errno) goto fn_fail; | |
| + } | |
| + MPID_END_ERROR_CHECKS; | |
| + | |
| + MPID_Group_get_ptr( group, group_ptr ); | |
| + | |
| + MPID_BEGIN_ERROR_CHECKS; | |
| + { | |
| + /* Check the group ptr */ | |
| + MPID_Group_valid_ptr( group_ptr, mpi_errno ); | |
| if (mpi_errno) goto fn_fail; | |
| } | |
| - MPID_END_ERROR_CHECKS | |
| + MPID_END_ERROR_CHECKS; | |
| + } | |
| +# else | |
| + { | |
| + MPID_Comm_get_ptr( comm, comm_ptr ); | |
| + MPID_Group_get_ptr( group, group_ptr ); | |
| } | |
| # endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment