From a2d224f28cd76b29a22b0b291c7e07aac2e64ad7 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Sun, 10 Mar 2024 22:40:16 -0700 Subject: [PATCH] `omp_locks`: C Array Use a plain C array over a `std::array` for `omp_locks`. Primarily because this causes linker issues on MSVC, secondarily because `omp_locks` might violate on some implementations the type requirements of `std::array` (MoveConstructible and MoveAssignable type `T`). https://en.cppreference.com/w/cpp/container/array --- Src/Base/AMReX_OpenMP.H | 3 +-- Src/Base/AMReX_OpenMP.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Src/Base/AMReX_OpenMP.H b/Src/Base/AMReX_OpenMP.H index 2b53ea8c6ec..e31a9171455 100644 --- a/Src/Base/AMReX_OpenMP.H +++ b/Src/Base/AMReX_OpenMP.H @@ -5,7 +5,6 @@ #ifdef AMREX_USE_OMP #include #include -#include namespace amrex::OpenMP { @@ -19,7 +18,7 @@ namespace amrex::OpenMP { void Finalize (); static constexpr int nlocks = 128; - extern AMREX_EXPORT std::array omp_locks; + extern AMREX_EXPORT omp_lock_t omp_locks[nlocks]; } #else // AMREX_USE_OMP diff --git a/Src/Base/AMReX_OpenMP.cpp b/Src/Base/AMReX_OpenMP.cpp index 15bb1246071..8d7cb13824c 100644 --- a/Src/Base/AMReX_OpenMP.cpp +++ b/Src/Base/AMReX_OpenMP.cpp @@ -135,7 +135,7 @@ namespace amrex #ifdef AMREX_USE_OMP namespace amrex::OpenMP { - std::array omp_locks; + omp_lock_t omp_locks[nlocks]; namespace { unsigned int initialized = 0;