[Openmp-commits] [openmp] [OpenMP] Use half of available logical processors for collapse tests (PR #88319)

Xing Xue via Openmp-commits openmp-commits at lists.llvm.org
Wed Apr 17 08:59:27 PDT 2024


================
@@ -106,12 +106,14 @@ int test() {
   unsigned scalarCount = 0;
   unsigned uselessThreadsOpenMP = 0;
   unsigned usefulThreadsOpenMP = 0;
-  unsigned chunkSizesOpenmp[MAX_THREADS] = {0};
 
-  unsigned num_threads = omp_get_max_threads();
+  // Use half of the available threads/logical processor.
+  unsigned num_threads = omp_get_max_threads() / 2;
   if (num_threads > MAX_THREADS)
     num_threads = MAX_THREADS;
-  omp_set_num_threads(num_threads);
+
+  unsigned *chunkSizesOpenmp = malloc(sizeof(unsigned) * num_threads);
----------------
xingxue-ibm wrote:

>>  To reduce the impact of cache line sharing, it would help to use long instead of int.
>
> Did you mean to change unsigned *chunkSizesOpenmp to unsigned long *chunkSizeOpenmp?

Hi @jprotze, I've addressed comments except the one quoted above. It would be appreciated if you can clarify at your convenience.

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


More information about the Openmp-commits mailing list