aboutsummaryrefslogtreecommitdiff
path: root/Source/Python/WarpXWrappers.cpp
diff options
context:
space:
mode:
authorGravatar Axel Huebl <axel.huebl@plasma.ninja> 2021-01-21 11:33:38 -0800
committerGravatar GitHub <noreply@github.com> 2021-01-21 11:33:38 -0800
commit16ba48a9ae1c28817481007ba93cc20aedba9cf2 (patch)
treeb39c60ca874eedff8006386ad4593ae94855509d /Source/Python/WarpXWrappers.cpp
parenteef853b9ab231537e2511efa56a415119e791b26 (diff)
downloadWarpX-16ba48a9ae1c28817481007ba93cc20aedba9cf2.tar.gz
WarpX-16ba48a9ae1c28817481007ba93cc20aedba9cf2.tar.zst
WarpX-16ba48a9ae1c28817481007ba93cc20aedba9cf2.zip
Define: _OPENMP -> AMREX_USE_OMP (#1520)
* Define: _OPENMP -> AMREX_USE_OMP Replace the define check of `_OPENMP` with the explicit backend control of `AMREX_USE_OMP` for parallel constructs. Doing so avoids that we accidentially turn on OpenMP, e.g. if a dependency pulls it in for linear algebra, I/O, etc. This can led to confusion if the user explicitly requested a serial build. Also, we might want to use OpenMP functionality here and there for auxiliary functions w/o having to use the AMReX OpenMP backend, i.e. because we compile for GPUs. * Add missing amrex::Gpu::notInLaunchRegion
Diffstat (limited to 'Source/Python/WarpXWrappers.cpp')
-rw-r--r--Source/Python/WarpXWrappers.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index cc42f8cd7..be06c259e 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -33,8 +33,8 @@ namespace
auto data =
static_cast<amrex::Real**>(malloc((*num_boxes) * sizeof(amrex::Real*)));
-#ifdef _OPENMP
-#pragma omp parallel
+#ifdef AMREX_USE_OMP
+#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
for ( amrex::MFIter mfi(mf, false); mfi.isValid(); ++mfi ) {
int i = mfi.LocalIndex();
@@ -480,4 +480,3 @@ extern "C"
}
}
-