From 16ba48a9ae1c28817481007ba93cc20aedba9cf2 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 21 Jan 2021 11:33:38 -0800 Subject: 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 --- Source/Particles/PhysicalParticleContainer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 9b8184823..4f484d064 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -586,7 +586,7 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) if (do_tiling && Gpu::notInLaunchRegion()) { info.EnableTiling(tile_size); } -#ifdef _OPENMP +#ifdef AMREX_USE_OMP info.SetDynamic(true); #pragma omp parallel if (not WarpX::serialize_ics) #endif @@ -683,7 +683,7 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) // Update NextID to include particles created in this function Long pid; -#ifdef _OPENMP +#ifdef AMREX_USE_OMP #pragma omp critical (add_plasma_nextid) #endif { @@ -961,11 +961,11 @@ PhysicalParticleContainer::Evolve (int lev, } } -#ifdef _OPENMP +#ifdef AMREX_USE_OMP #pragma omp parallel #endif { -#ifdef _OPENMP +#ifdef AMREX_USE_OMP int thread_num = omp_get_thread_num(); #else int thread_num = 0; @@ -1419,7 +1419,7 @@ PhysicalParticleContainer::PushP (int lev, Real dt, const std::array& dx = WarpX::CellSize(std::max(lev,0)); -#ifdef _OPENMP +#ifdef AMREX_USE_OMP #pragma omp parallel #endif { @@ -1587,7 +1587,7 @@ PhysicalParticleContainer::GetParticleSlice ( diagnostic_particles[lev][index]; } -#ifdef _OPENMP +#ifdef AMREX_USE_OMP #pragma omp parallel #endif { -- cgit v1.2.3