diff --git a/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23-GCC-12.3.0.eb b/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23-GCC-12.3.0.eb index 2368237262bc..b88b96d7cdb2 100644 --- a/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23-GCC-12.3.0.eb +++ b/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23-GCC-12.3.0.eb @@ -19,6 +19,7 @@ patches = [ 'OpenBLAS-0.3.21_fix-order-vectorization.patch', 'OpenBLAS-0.3.23_fix-parallel-build.patch', 'OpenBLAS-0.3.23_fix-lapack-test.patch', + 'OpenBLAS-0.3.23_fix-tests-hang.patch', ] checksums = [ {'v0.3.23.tar.gz': '5d9491d07168a5d00116cdc068a40022c3455bf9293c7cb86a65b1054d7e5114'}, @@ -30,6 +31,7 @@ checksums = [ '08af834e5d60441fd35c128758ed9c092ba6887c829e0471ecd489079539047d'}, {'OpenBLAS-0.3.23_fix-parallel-build.patch': 'abe10ba3b0ca54772dbf235596e35325a5159018f6a60cfc88824c2c220d99d9'}, {'OpenBLAS-0.3.23_fix-lapack-test.patch': 'f6b3d81061f136e34aaf5359bb80fb9d2bba28825cc1dd26179b8dd01a9a0054'}, + {'OpenBLAS-0.3.23_fix-tests-hang.patch': '9de1fdee6edf3b2bb55e4639fdd92d2877b5f0ac880f7df2cfea47ecebf16609'}, ] builddependencies = [ diff --git a/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23_fix-tests-hang.patch b/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23_fix-tests-hang.patch new file mode 100644 index 000000000000..68d7ac5f81a7 --- /dev/null +++ b/easybuild/easyconfigs/o/OpenBLAS/OpenBLAS-0.3.23_fix-tests-hang.patch @@ -0,0 +1,165 @@ +From ea669c8ae938450e101140d634cca291bffd3898 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 26 Jul 2023 00:27:14 +0200 +Subject: [PATCH 1/4] simplify openmp thread limit handling + +--- + common_thread.h | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/common_thread.h b/common_thread.h +index 05e1d5489d..0a4c703b7c 100644 +--- a/common_thread.h ++++ b/common_thread.h +@@ -136,15 +136,13 @@ typedef struct blas_queue { + #ifdef SMP_SERVER + + extern int blas_server_avail; ++extern int blas_omp_number_max; + + static __inline int num_cpu_avail(int level) { + + #ifdef USE_OPENMP + int openmp_nthreads; +- if (blas_num_threads_set == 0) + openmp_nthreads=omp_get_max_threads(); +- else +- openmp_nthreads=blas_cpu_number; + #endif + + #ifndef USE_OPENMP +@@ -156,7 +154,13 @@ int openmp_nthreads; + ) return 1; + + #ifdef USE_OPENMP +- if (blas_cpu_number != openmp_nthreads) { ++ if (openmp_nthreads > blas_omp_number_max){ ++#ifdef DEBUG ++ fprintf(stderr,"WARNING - more OpenMP threads requested (%d) than available (%d)\n",openmp_nthreads,blas_omp_number_max); ++#endif ++ openmp_nthreads = blas_omp_number_max; ++ } ++ if (blas_cpu_number != openmp_nthreads) { + goto_set_num_threads(openmp_nthreads); + } + #endif + +From 3326b924b324d49960e0f657f049e5658e7e6c69 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 26 Jul 2023 00:31:24 +0200 +Subject: [PATCH 2/4] remove status variable blas_num_threads_set; initialize + openmp thread maximum on startup + +--- + driver/others/blas_server_omp.c | 4 +++- + driver/others/memory.c | 4 ---- + driver/others/memory_qalloc.c | 1 - + 3 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/driver/others/blas_server_omp.c b/driver/others/blas_server_omp.c +index 2e0c0f38c1..43764df00c 100644 +--- a/driver/others/blas_server_omp.c ++++ b/driver/others/blas_server_omp.c +@@ -68,6 +68,7 @@ + #endif + + int blas_server_avail = 0; ++int blas_omp_number_max = 0; + + extern int openblas_omp_adaptive_env(); + +@@ -100,7 +101,6 @@ static void adjust_thread_buffers() { + + void goto_set_num_threads(int num_threads) { + +- blas_num_threads_set = 1; + if (num_threads < 0) blas_num_threads_set = 0; + if (num_threads < 1) num_threads = blas_num_threads; + +@@ -125,6 +125,8 @@ void openblas_set_num_threads(int num_threads) { + } + + int blas_thread_init(void){ ++if(blas_omp_number_max <= 0) ++ blas_omp_number_max = omp_get_max_threads(); + + blas_get_cpu_number(); + +diff --git a/driver/others/memory.c b/driver/others/memory.c +index 3cbd17bc2f..4fceae7545 100644 +--- a/driver/others/memory.c ++++ b/driver/others/memory.c +@@ -422,8 +422,6 @@ This value is equal or large than blas_cpu_number. This means some threads are s + */ + int blas_num_threads = 0; + +-int blas_num_threads_set = 0; +- + int goto_get_num_procs (void) { + return blas_cpu_number; + } +@@ -1996,8 +1994,6 @@ This value is equal or large than blas_cpu_number. This means some threads are s + */ + int blas_num_threads = 0; + +-int blas_num_threads_set = 0; +- + int goto_get_num_procs (void) { + return blas_cpu_number; + } +diff --git a/driver/others/memory_qalloc.c b/driver/others/memory_qalloc.c +index 0b38d1887c..6174d9b75e 100644 +--- a/driver/others/memory_qalloc.c ++++ b/driver/others/memory_qalloc.c +@@ -283,7 +283,6 @@ The numbers of threads in the thread pool. + This value is equal or large than blas_cpu_number. This means some threads are sleep. + */ + int blas_num_threads = 0; +-int blas_num_threads_set = 0; + + int goto_get_num_procs (void) { + return blas_cpu_number; + +From 94adf98bb80b36c9faa2fa90fe7f33b36d30748c Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 26 Jul 2023 08:31:37 +0200 +Subject: [PATCH 3/4] remove unused status variable + +--- + common_thread.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/common_thread.h b/common_thread.h +index 0a4c703b7c..06a7a1a38c 100644 +--- a/common_thread.h ++++ b/common_thread.h +@@ -53,7 +53,6 @@ extern void goto_set_num_threads(int nthreads); + /* Global Parameter */ + extern int blas_cpu_number; + extern int blas_num_threads; +-extern int blas_num_threads_set; + extern int blas_omp_linked; + + #define BLAS_LEGACY 0x8000U + +From 9ff84dc3f2536ce94e0a300a098485c7ff3d771d Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 26 Jul 2023 10:02:44 +0200 +Subject: [PATCH 4/4] remove unused status variable + +--- + driver/others/blas_server_omp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/driver/others/blas_server_omp.c b/driver/others/blas_server_omp.c +index 43764df00c..fe6b4a7c06 100644 +--- a/driver/others/blas_server_omp.c ++++ b/driver/others/blas_server_omp.c +@@ -101,7 +101,6 @@ static void adjust_thread_buffers() { + + void goto_set_num_threads(int num_threads) { + +- if (num_threads < 0) blas_num_threads_set = 0; + if (num_threads < 1) num_threads = blas_num_threads; + + if (num_threads > MAX_CPU_NUMBER) num_threads = MAX_CPU_NUMBER;