[Openmp-commits] [openmp] [OpenMP] Use half of available logical processors for collapse tests (PR #88319)
via Openmp-commits
openmp-commits at lists.llvm.org
Thu Apr 11 12:43:21 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);
----------------
jprotze wrote:
If you malloc, you should also free. I don't see anything wrong with the previous stack allocation approach.
To reduce the impact of cache line sharing, it would help to use long instead of int.
https://github.com/llvm/llvm-project/pull/88319
More information about the Openmp-commits
mailing list