From c95da1913552336123aeeedfe305126793abd655 Mon Sep 17 00:00:00 2001 From: Artem Zhmurov Date: Fri, 24 Sep 2021 12:22:09 +0300 Subject: [PATCH] Fix clang-tidy warnings in pme and sim_utils 1. The global non-const variable was temporary introduced to able to test the PME SYCL spread kernel independently of the rest of the PME (f190fa59b4a72390b2aea2e74b4960941098ce4d). NOLINT should be temporary fix as this variable will go away once the rest of PME is implemented in SYCL. 2. The conditionals in sim_utils wrap the same copy operation after 4d38a0d65839f951bf275e465f8fb65a35b60b8d. So these conditional can now be combined. --- src/gromacs/ewald/pme.cpp | 1 + src/gromacs/ewald/pme.h | 1 + src/gromacs/mdrun/md.cpp | 15 ++++++--------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gromacs/ewald/pme.cpp b/src/gromacs/ewald/pme.cpp index fe65e9d6e3..4260cac22c 100644 --- a/src/gromacs/ewald/pme.cpp +++ b/src/gromacs/ewald/pme.cpp @@ -127,6 +127,7 @@ #include "pme_spline_work.h" #include "pme_spread.h" +//NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) bool g_allowPmeWithSyclForTesting = false; bool pme_gpu_supports_build(std::string* error) diff --git a/src/gromacs/ewald/pme.h b/src/gromacs/ewald/pme.h index 0576e51b19..93145d4e1e 100644 --- a/src/gromacs/ewald/pme.h +++ b/src/gromacs/ewald/pme.h @@ -85,6 +85,7 @@ class GpuEventSynchronizer; * * \todo Remove after #3927 is done and PME is fully enabled in SYCL builds. */ +//NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) extern bool g_allowPmeWithSyclForTesting; namespace gmx diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index 57fb86149a..1e7479b304 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -1506,16 +1506,13 @@ void gmx::LegacySimulator::do_md() } } - if (simulationWork.useGpuPme && simulationWork.useCpuPmePpCommunication) + if ((simulationWork.useGpuPme && simulationWork.useCpuPmePpCommunication) + || (!runScheduleWork->stepWork.useGpuFBufferOps)) { - // The PME forces were recieved to the host, and reduced on the CPU with the rest of the - // forces computed on the GPU, so the final forces have to be copied back to the GPU - stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local); - } - else if (!runScheduleWork->stepWork.useGpuFBufferOps) - { - // The buffer ops were not offloaded this step, so the forces are on the - // host and have to be copied + // The PME forces were recieved to the host, and reduced on the CPU with the + // rest of the forces computed on the GPU, so the final forces have to be copied + // back to the GPU. Or the buffer ops were not offloaded this step, so the + // forces are on the host and have to be copied stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local); } const bool doTemperatureScaling = -- 2.22.0