forked from conda-forge/amrex-feedstock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Patch] OpenMP Linkage Windows (conda-forge#18)
automerged PR by conda-forge/automerge-action
- Loading branch information
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From a2d224f28cd76b29a22b0b291c7e07aac2e64ad7 Mon Sep 17 00:00:00 2001 | ||
From: Axel Huebl <axel.huebl@plasma.ninja> | ||
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 2b53ea8c6e..e31a917145 100644 | ||
--- a/Src/Base/AMReX_OpenMP.H | ||
+++ b/Src/Base/AMReX_OpenMP.H | ||
@@ -5,7 +5,6 @@ | ||
#ifdef AMREX_USE_OMP | ||
#include <AMReX_Extension.H> | ||
#include <omp.h> | ||
-#include <array> | ||
|
||
namespace amrex::OpenMP { | ||
|
||
@@ -19,7 +18,7 @@ namespace amrex::OpenMP { | ||
void Finalize (); | ||
|
||
static constexpr int nlocks = 128; | ||
- extern AMREX_EXPORT std::array<omp_lock_t,nlocks> 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 15bb124607..8d7cb13824 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_lock_t,nlocks> omp_locks; | ||
+ omp_lock_t omp_locks[nlocks]; | ||
|
||
namespace { | ||
unsigned int initialized = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters