-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[OpenMP][test][VE] Limit the number of threads to create #65873
Conversation
@llvm/pr-subscribers-openmp ChangesLimit the number of threads to create in a test program because VE's pthread_create supports only 64 threads at a maximum.Full diff: https://github.com/llvm/llvm-project/pull/65873.diff 1 Files Affected:
diff --git a/openmp/runtime/test/atomic/omp-atomic-compare-signedness.c b/openmp/runtime/test/atomic/omp-atomic-compare-signedness.c index 41c0d5617a7704c..ca37d717a7f8918 100644 --- a/openmp/runtime/test/atomic/omp-atomic-compare-signedness.c +++ b/openmp/runtime/test/atomic/omp-atomic-compare-signedness.c @@ -11,7 +11,12 @@ // UNSUPPORTED: gcc // High parallelism increases our chances of detecting a lack of atomicity. +#ifdef __ve__ +// VE's pthread_create supports 64 threads at a maximum. +#define NUM_THREADS_TRY 64 +#else #define NUM_THREADS_TRY 256 +#endif #include #include |
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.
nice feature
@@ -11,7 +11,12 @@ | |||
// UNSUPPORTED: gcc | |||
|
|||
// High parallelism increases our chances of detecting a lack of atomicity. | |||
#ifdef __ve__ | |||
// VE's pthread_create supports 64 threads at a maximum. |
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.
If that's the case, then you want to set the limit (such as __kmp_sys_max_nth
) in kmp.h
as well.
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.
Thanks. Modifying initial value for __kmp_sys_max_nth
is not enough for our cases since __kmp_runtime_initialize
is implemented assuming NPTL which assumes infinity number of threads. I modify both KMP_MAX_NTH
and the mechanism in __kmp_runtime_initialize
.
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.
It would be better to split the patch into two: one is about test, as the previous version, and one for the changes in the header, etc.
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.
Will do. Thanks.
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 created #66729 . I'm not sure whether I create another patch for test or not. Test itself passes after applying #66729 with following warnings. I can say this is good regression tests for #66729 . I also can say it's good to change test too for let ppl know this limitation. Do you have any opinion?
OMP: Warning #96: Cannot form a team with 256 threads, using 64 instead.
OMP: Hint Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set).
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.
Good to hear the test can pass after #66729. I'm more inclined to leave the test alone since we don't know what users can really do and the number looks totally reasonable from OpenMP's perspective. It is just our implementation can't handle it correctly.
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.
That make sense too. I'll leave the test as is. Thank you for your advice.
VE supports up to 64 threads per a VE process. So, we limit the number of threads defined by KMP_MAX_NTH. We also modify the __kmp_sys_max_nth initialization to use KMP_MAX_NTH as a limit. We also modify test program itself.
Closing this ticket to modify the test. We change the openmp max num threads for VE in #66729 . |
VE supports up to 64 threads per a VE process. So, we limit the number of threads defined by KMP_MAX_NTH. We also modify the __kmp_sys_max_nth initialization to use KMP_MAX_NTH as a limit. We also modify a test program itself.