-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpi/finalized: don't hang if called during MPI_FINALIZE #5092
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* All rights reserved. | ||
* Copyright (c) 2015 Research Organization for Information Science | ||
* and Technology (RIST). All rights reserved. | ||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. | ||
* Copyright (c) 2015-2018 Cisco Systems, Inc. All rights reserved | ||
* Copyright (c) 2015 Intel, Inc. All rights reserved | ||
* $COPYRIGHT$ | ||
* | ||
|
@@ -44,13 +44,7 @@ int MPI_Initialized(int *flag) | |
|
||
ompi_hook_base_mpi_initialized_top(flag); | ||
|
||
/* We must obtain the lock to guarnatee consistent values of | ||
ompi_mpi_initialized and ompi_mpi_finalized. Note, too, that | ||
this lock is held for the bulk of the duration of | ||
ompi_mpi_init() and ompi_mpi_finalize(), so when we get the | ||
lock, we are guaranteed that some other thread is not part way | ||
through initialization or finalization. */ | ||
opal_mutex_lock(&ompi_mpi_bootstrap_mutex); | ||
int32_t state = ompi_mpi_state; | ||
|
||
if (MPI_PARAM_CHECK) { | ||
if (NULL == flag) { | ||
|
@@ -59,12 +53,11 @@ int MPI_Initialized(int *flag) | |
whether we're currently (after MPI_Init and before | ||
MPI_Finalize) or not */ | ||
|
||
if (ompi_mpi_initialized && !ompi_mpi_finalized) { | ||
opal_mutex_unlock(&ompi_mpi_bootstrap_mutex); | ||
if (state >= OMPI_MPI_STATE_INIT_COMPLETED && | ||
state < OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT) { | ||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, | ||
FUNC_NAME); | ||
} else { | ||
opal_mutex_unlock(&ompi_mpi_bootstrap_mutex); | ||
/* We have no MPI object here so call ompi_errhandle_invoke | ||
* directly */ | ||
return ompi_errhandler_invoke(NULL, NULL, -1, | ||
|
@@ -74,8 +67,7 @@ int MPI_Initialized(int *flag) | |
} | ||
} | ||
|
||
*flag = ompi_mpi_initialized; | ||
opal_mutex_unlock(&ompi_mpi_bootstrap_mutex); | ||
*flag = (state >= OMPI_MPI_STATE_INIT_COMPLETED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming the param check is off, Is this really enough or should we check that the state is smaller than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The param check is only checking if they passed NULL for This function is supposed to return if MPI_INIT has completed or not. It says nothing about MPI_FINALIZE. ...am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, my bad. |
||
|
||
ompi_hook_base_mpi_initialized_bottom(flag); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not related to your patch, it is more general about the real meaning of the get_library_version function. In OMPI in particular why are we protecting this function ? All the information used here is statically known, we don't have to be between MPI_Init and MPI_Finalize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not - see the comment above this that explains (short version: we're protecting the invocation of error handling if
version
orresultlen
is NULL -- we have to handle the error differently if we're before INIT, afterINITbeforeFINALIZE, or after FINALIZE).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that. thanks.