[Openmp-commits] [openmp] [OpenMP][test][AIX] Make 64 the max number of threads for capacity tests in AIX 32-bit (PR #88739)
Xing Xue via Openmp-commits
openmp-commits at lists.llvm.org
Mon Apr 15 07:25:04 PDT 2024
https://github.com/xingxue-ibm created https://github.com/llvm/llvm-project/pull/88739
This patch makes 64 the max number of threads for 2 capacity tests in AIX 32-bit mode rather than `XFAIL`ing them.
>From 80cc9c4b5d989b3f6cb53cfe2d85d78a6adcaf23 Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Mon, 15 Apr 2024 10:20:05 -0400
Subject: [PATCH] Make 64 the max number of threads for capacity tests in AIX
32-bit.
---
.../capacity_mix_threads.cpp | 20 +++++++++++++------
.../hidden_helper_task/capacity_nthreads.cpp | 20 +++++++++++++------
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/capacity_mix_threads.cpp b/openmp/runtime/test/tasking/hidden_helper_task/capacity_mix_threads.cpp
index 3f2ceef0c4add4..36825dbebafb51 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/capacity_mix_threads.cpp
+++ b/openmp/runtime/test/tasking/hidden_helper_task/capacity_mix_threads.cpp
@@ -1,7 +1,4 @@
// RUN: %libomp-cxx-compile-and-run
-//
-// AIX runs out of resource in 32-bit with 4*omp_get_max_threads() threads.
-// XFAIL: aix && ppc
#include <omp.h>
@@ -11,6 +8,12 @@
#include <thread>
#include <vector>
+// AIX runs out of resource in 32-bit if 4*omp_get_max_threads() is more
+// than 64 threads with the default stack size.
+#if defined(_AIX) && !__LP64__
+#define MAX_THREADS 64
+#endif
+
void dummy_root() {
// omp_get_max_threads() will do middle initialization
int nthreads = omp_get_max_threads();
@@ -18,9 +21,14 @@ void dummy_root() {
}
int main(int argc, char *argv[]) {
- const int N = std::min(std::max(std::max(32, 4 * omp_get_max_threads()),
- 4 * omp_get_num_procs()),
- std::numeric_limits<int>::max());
+ int N = std::min(std::max(std::max(32, 4 * omp_get_max_threads()),
+ 4 * omp_get_num_procs()),
+ std::numeric_limits<int>::max());
+
+#if defined(_AIX) && !__LP64__
+ if (N > MAX_THREADS)
+ N = MAX_THREADS;
+#endif
std::vector<int> data(N);
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/capacity_nthreads.cpp b/openmp/runtime/test/tasking/hidden_helper_task/capacity_nthreads.cpp
index f7405d00255cb9..1cceee95e704b8 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/capacity_nthreads.cpp
+++ b/openmp/runtime/test/tasking/hidden_helper_task/capacity_nthreads.cpp
@@ -1,7 +1,4 @@
// RUN: %libomp-cxx-compile-and-run
-//
-// AIX runs out of resource in 32-bit with 4*omp_get_max_threads() threads.
-// XFAIL: aix && ppc
#include <omp.h>
@@ -10,10 +7,21 @@
#include <limits>
#include <vector>
+// AIX runs out of resource in 32-bit if 4*omp_get_max_threads() is more
+// than 64 threads with the default stacksize.
+#if defined(_AIX) && !__LP64__
+#define MAX_THREADS 64
+#endif
+
int main(int argc, char *argv[]) {
- const int N = std::min(std::max(std::max(32, 4 * omp_get_max_threads()),
- 4 * omp_get_num_procs()),
- std::numeric_limits<int>::max());
+ int N = std::min(std::max(std::max(32, 4 * omp_get_max_threads()),
+ 4 * omp_get_num_procs()),
+ std::numeric_limits<int>::max());
+
+#if defined(_AIX) && !__LP64__
+ if (N > MAX_THREADS)
+ N = MAX_THREADS;
+#endif
std::vector<int> data(N);
More information about the Openmp-commits
mailing list