-
Notifications
You must be signed in to change notification settings - Fork 286
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
Fix Argobots support #4421
Fix Argobots support #4421
Changes from all commits
70b96b5
a0bde25
bd260db
db30d4f
f220643
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 |
---|---|---|
|
@@ -41,6 +41,7 @@ MTEST_THREAD_RETURN_TYPE test_comm_dup(void *arg) | |
wait = 0; | ||
for (i = 0; i < NUM_THREADS; i++) | ||
wait += start_idup[i]; | ||
MTest_thread_yield(); | ||
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. @shintaro-iwasaki 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. Oops I missed it. #4503 should fix it. Thanks! |
||
} while (wait > NUM_THREADS / 2); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,10 @@ int main(int argc, char *argv[]) | |
#endif /* USE_THREADS */ | ||
|
||
#ifdef USE_THREADS | ||
/* Initialize the thread package. It should not be initialized via | ||
* MTest_Init_thread since MTest_Finalize cannot be called. */ | ||
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. It is because both 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. You are right. I will change the comment. Thanks a lot for reviewing this PR! 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. @hzhou I fixed the comment. |
||
MTest_init_thread_pkg(); | ||
|
||
/* We need different communicators per thread */ | ||
for (i = 0; i < DEFAULT_TASK_WINDOW; i++) | ||
CHECK_SUCCESS(MPI_Comm_dup(MPI_COMM_WORLD, &th_comms[i])); | ||
|
@@ -117,6 +121,9 @@ int main(int argc, char *argv[]) | |
|
||
for (i = 0; i < DEFAULT_TASK_WINDOW; i++) | ||
CHECK_SUCCESS(MPI_Comm_free(&th_comms[i])); | ||
|
||
/* Release the thread package. */ | ||
MTest_finalize_thread_pkg(); | ||
#else | ||
/* Directly spawn a child process to perform each task */ | ||
for (i = 0; i < tasks;) { | ||
|
@@ -141,6 +148,8 @@ int main(int argc, char *argv[]) | |
} | ||
|
||
fn_exit: | ||
/* Do not call MTest_Finalize (and thus MTest_Init) to avoid printing extra | ||
* "No Errors" as many as spawned MPI processes. */ | ||
MPI_Finalize(); | ||
|
||
return 0; | ||
|
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.
Can argobot init be called multiple times?
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.
Yes. It is okay to call it multiple times (internally there's a refcount).
If it wouldn't be the case,
MPL_thread_init()
will take care of it.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 concern is mentioned in
src/mpl/include/mpl_thread_argobots.h
.