From abfa9ed502c2fce9bca256f66f35a2bf4e446e68 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Tue, 26 Mar 2019 14:37:53 +0100 Subject: [PATCH] Move early return for nbnxm force reduction To reduce dependencies and code complexity, the early return for avoiding overhead of a force reduction reducing no forces at all has been moved from nonbonded_verlet_t to atomdata.cpp. The check has been changed from no non-local work to no non-local atoms, which should not affect performance much. Change-Id: I3315699e15918482b321b702f6ba24209aa3a6b2 --- src/gromacs/nbnxm/atomdata.cpp | 6 ++++++ src/gromacs/nbnxm/nbnxm.cpp | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gromacs/nbnxm/atomdata.cpp b/src/gromacs/nbnxm/atomdata.cpp index 38c09fcbdf..26a033c90a 100644 --- a/src/gromacs/nbnxm/atomdata.cpp +++ b/src/gromacs/nbnxm/atomdata.cpp @@ -1478,6 +1478,12 @@ void reduceForces(nbnxn_atomdata_t *nbat, break; } + if (na == 0) + { + /* The are no atoms for this reduction, avoid some overhead */ + return; + } + int nth = gmx_omp_nthreads_get(emntNonbonded); if (nbat->out.size() > 1) diff --git a/src/gromacs/nbnxm/nbnxm.cpp b/src/gromacs/nbnxm/nbnxm.cpp index eab38e59f3..6f2fa85102 100644 --- a/src/gromacs/nbnxm/nbnxm.cpp +++ b/src/gromacs/nbnxm/nbnxm.cpp @@ -49,7 +49,6 @@ #include "gromacs/nbnxm/atomdata.h" #include "gromacs/timing/wallcycle.h" -#include "pairlistset.h" #include "pairlistsets.h" #include "pairsearch.h" @@ -165,14 +164,6 @@ nonbonded_verlet_t::atomdata_add_nbat_f_to_f(const Nbnxm::AtomLocality locality rvec *f, gmx_wallcycle *wcycle) { - /* Skip the non-local reduction if there was no non-local work to do */ - if (!pairlistIsSimple() && - locality == Nbnxm::AtomLocality::NonLocal && - pairlistSets().pairlistSet(Nbnxm::InteractionLocality::NonLocal).gpuList()->sci.empty()) - { - return; - } - wallcycle_start(wcycle, ewcNB_XF_BUF_OPS); wallcycle_sub_start(wcycle, ewcsNB_F_BUF_OPS); -- 2.11.4.GIT