[Openmp-commits] [openmp] [OpenMP][AIX] lower max threads to reduce collapse testing time (PR #88319)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Apr 11 01:26:46 PDT 2024


jprotze wrote:

The test should not use more than 128 threads on your system (default value returned by `omp_get_max_threads` is number of available cores). Since we usually run multiple test in parallel, I think it makes sense to modify the test to never use more than half of the available cores:

```diff
-  unsigned num_threads = omp_get_max_threads();
+  unsigned num_threads = omp_get_max_threads()/2;
  if (num_threads > MAX_THREADS)
    num_threads = MAX_THREADS;
  omp_set_num_threads(num_threads);
```

Furthermore, I suggest to move the `omp_get_thread_num` call out of the loop:

```diff
#pragma omp parallel num_threads(num_threads)
  {
+    unsigned gtid = omp_get_thread_num();
#pragma omp for collapse(3) private(i, j, k)
    LOOP {
      unsigned count;
-      unsigned gtid = omp_get_thread_num();
```

https://github.com/llvm/llvm-project/pull/88319


More information about the Openmp-commits mailing list