[Openmp-commits] [openmp] 368b884 - [openmp] Fix bug63197.c test with 3 cores (#183269)
via Openmp-commits
openmp-commits at lists.llvm.org
Wed Feb 25 06:58:29 PST 2026
Author: Nikita Popov
Date: 2026-02-25T15:58:23+01:00
New Revision: 368b884869651b69b14b836b25206aa62b501496
URL: https://github.com/llvm/llvm-project/commit/368b884869651b69b14b836b25206aa62b501496
DIFF: https://github.com/llvm/llvm-project/commit/368b884869651b69b14b836b25206aa62b501496.diff
LOG: [openmp] Fix bug63197.c test with 3 cores (#183269)
This test assumes that the number of available threads is not 3,
otherwise `#pragma omp parallel` and `#pragma omp parallel
num_thread(3)` are naturally going to do the same thing.
Instead use `omp_get_max_threads() - 1` as the number of threads in the
initial `omp parallel num_thread(N)` and then check that the number of
threads does not match the value in the later `omp parallel`.
Added:
Modified:
openmp/runtime/test/parallel/bug63197.c
Removed:
################################################################################
diff --git a/openmp/runtime/test/parallel/bug63197.c b/openmp/runtime/test/parallel/bug63197.c
index c60f400b19a8f..734f5c89c0a2d 100644
--- a/openmp/runtime/test/parallel/bug63197.c
+++ b/openmp/runtime/test/parallel/bug63197.c
@@ -4,14 +4,15 @@
#include <stdio.h>
int main(int argc, char *argv[]) {
-#pragma omp parallel num_threads(3) if (0)
+ unsigned N = omp_get_max_threads() - 1;
+#pragma omp parallel num_threads(N) if (0)
#pragma omp single
{ printf("BBB %2d\n", omp_get_num_threads()); }
#pragma omp parallel
#pragma omp single
{
- if (omp_get_num_threads() != 3)
+ if (omp_get_num_threads() != N)
printf("PASS\n");
}
return 0;
More information about the Openmp-commits
mailing list