Skip to content
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

init: Add thread initialization and finalization #3569

Merged
merged 3 commits into from
Apr 10, 2019

Conversation

shintaro-iwasaki
Copy link
Contributor

Previously, if Argobots is enabled, ABT_init must be called before MPI_Init, which is very cumbersome
Now Argobots has an initialization counter inside and therefore can be initialized multiple times.
This PR adds ABT_init and corresponding ABT_finalize in MPI initialization and finalization.

The current implementation imposes a restriction derived from Argobots; when the Argobots option is enabled, the same thread needs to initialize and finalize the MPI runtime. See pmodels/argobots#86 for details.

@raffenet
Copy link
Contributor

@shintaro-iwasaki we avoid making thread library calls directly in MPICH. Instead, we should define MPL_thread_init/MPL_thread_finalize functions that are no-ops in cases other than Argobots.

@shintaro-iwasaki shintaro-iwasaki force-pushed the fixABTInit branch 2 times, most recently from 0f73a88 to c7dd13b Compare February 13, 2019 16:33
@shintaro-iwasaki shintaro-iwasaki changed the title init: Add Argobots initialization and finalization init: Add thread initialization and finalization Feb 13, 2019
@shintaro-iwasaki
Copy link
Contributor Author

Change the flag type from int to bool.

@raffenet
Copy link
Contributor

Sanity checking the default tests. Need to add Argobots review job next.
test:jenkins/ch3/tcp

@raffenet
Copy link
Contributor

This was successful in manual tests. There are still further changes needed in the test suite, which we can address separately. @shintaro-iwasaki one more request. I prefer if changes to MPL are isolated into their own commit. Can you split the first commit into:

  1. add new MPL interfaces for thread init/finalize
  2. use thread init/finalize interfaces in MPICH

@shintaro-iwasaki
Copy link
Contributor Author

I split the first commit into two as you suggested.

@raffenet
Copy link
Contributor

Looks great. Testing one more time.
test:jenkins/ch3/tcp

Some threading libraries (e.g., Argobots) require explicit
initialization and finalization.  This patch adds new functions that
that initialize and finalize an underlying threading library.

Signed-off-by: Ken Raffenetti <[email protected]>
MPI_Init and MPI_Finalize call thread initialization and
finalization functions, which some threading libraries require.

Accordingly, this patch removes Argobots-specific code in MPI_Init.

Signed-off-by: Ken Raffenetti <[email protected]>
When initialization of the threading library fails, it jumps to
fn_fail and runs MPIR_Thread_CS_Finalize before thread_cs_init is
called.  This commit adds a flag to fix this issue.

Signed-off-by: Ken Raffenetti <[email protected]>
@raffenet raffenet merged commit 6eebaf3 into pmodels:master Apr 10, 2019
@shintaro-iwasaki shintaro-iwasaki deleted the fixABTInit branch October 30, 2020 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants