Skip to content

[OpenMP][test][AIX] Make 64 the max number of threads for capacity tests in AIX 32-bit #88739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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>

Expand All @@ -11,16 +8,27 @@
#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();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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>

Expand All @@ -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);

Expand Down