Skip to content

Commit

Permalink
[Patch] OpenMP Linkage Windows (conda-forge#18)
Browse files Browse the repository at this point in the history
automerged PR by conda-forge/automerge-action
  • Loading branch information
github-actions[bot] authored Mar 11, 2024
2 parents a5e043f + bc41029 commit 9395ea6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
50 changes: 50 additions & 0 deletions recipe/3796.patch
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;
6 changes: 5 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set name = "amrex" %}
{% set version = "24.03" %}
{% set build = 0 %}
{% set build = 1 %}

# ensure mpi is defined (needed for conda-smithy recipe-lint)
{% set mpi = mpi or 'nompi' %}
Expand All @@ -17,6 +17,10 @@ package:
source:
url: https://github.com/AMReX-Codes/amrex/archive/refs/tags/{{ version }}.tar.gz
sha256: 7e87197e8700d52d1ce009faa8df7e1a00027df799a1223c77a84bb5f96830e0
patches:
# Linker Error for Windows OpenMP build
# https://github.com/AMReX-Codes/amrex/pull/3796
- 3796.patch

build:
number: {{ build }}
Expand Down

0 comments on commit 9395ea6

Please sign in to comment.