diff --git a/frame/thread/bli_thread.c b/frame/thread/bli_thread.c index 03bc1b0a0..d7d327678 100644 --- a/frame/thread/bli_thread.c +++ b/frame/thread/bli_thread.c @@ -35,6 +35,22 @@ #include "blis.h" +// OpenMP 2.0 compatibility: Provide fallbacks for OpenMP 3.0 functions +// Some compilers (e.g., MSVC, older GCC) only support OpenMP 2.0 which lacks: +// - omp_get_active_level() (OpenMP 3.0) +// - omp_get_max_active_levels() (OpenMP 3.0) +// The _OPENMP macro is set to version-specific values by OpenMP-compliant compilers: +// 200203 = OpenMP 2.0, 200811 = OpenMP 3.0, 201107 = OpenMP 3.1, etc. +// Note: omp.h is already included by blis.h when BLIS_ENABLE_OPENMP is defined +#if defined(BLIS_ENABLE_OPENMP) && defined(_OPENMP) && _OPENMP < 200811 +static inline int omp_get_active_level(void) { + return 0; // Always assume top-level (no nested parallelism support) +} +static inline int omp_get_max_active_levels(void) { + return 1; // OpenMP 2.0 doesn't support nested parallelism +} +#endif + thrinfo_t BLIS_PACKM_SINGLE_THREADED = {}; thrinfo_t BLIS_GEMM_SINGLE_THREADED = {}; thrcomm_t BLIS_SINGLE_COMM = {};