Re-enable GPU with walls and 1 energy group
authorBerk Hess <hess@kth.se>
Tue, 16 Jan 2018 14:13:08 +0000 (15:13 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 17 Jan 2018 09:14:06 +0000 (10:14 +0100)
With a single non-bonded energy groups and walls we can use a GPU
for non-bonded calculations.

Change-Id: I95e72d6acc8852091bb269b350cdbf67f56e19fc

src/gromacs/mdlib/forcerec.cpp
src/programs/mdrun/runner.cpp

index fee2ea43239718dd7df21173c1b795dba011c5fb..abd5eb7c3361321073e1e838ec5f3f91f3c56dc9 100644 (file)
@@ -2245,13 +2245,22 @@ static void init_nb_verlet(const gmx::MDLogger     &mdlog,
     }
 
     snew(nbv->nbat, 1);
+    int mimimumNumEnergyGroupNonbonded = ir->opts.ngener;
+    if (ir->opts.ngener - ir->nwall == 1)
+    {
+        /* We have only one non-wall energy group, we do not need energy group
+         * support in the non-bondeds kernels, since all non-bonded energy
+         * contributions go to the first element of the energy group matrix.
+         */
+        mimimumNumEnergyGroupNonbonded = 1;
+    }
     bool bSimpleList = nbnxn_kernel_pairlist_simple(nbv->grp[0].kernel_type);
     nbnxn_atomdata_init(mdlog,
                         nbv->nbat,
                         nbv->grp[0].kernel_type,
                         enbnxninitcombrule,
                         fr->ntype, fr->nbfp,
-                        ir->opts.ngener,
+                        mimimumNumEnergyGroupNonbonded,
                         bSimpleList ? gmx_omp_nthreads_get(emntNonbonded) : 1,
                         nb_alloc, nb_free);
 
index 5bf79c442d2f64ce284400083e9ee506de9e8018..a4d390e2039f1321e54c900f875480e5582cb587 100644 (file)
@@ -325,7 +325,7 @@ static bool gpuAccelerationOfNonbondedIsUseful(const MDLogger   &mdlog,
                                                const t_inputrec *ir,
                                                bool              issueWarning)
 {
-    if (ir->opts.ngener > 1)
+    if (ir->opts.ngener - ir->nwall > 1)
     {
         /* The GPU code does not support more than one energy group.
          * If the user requested GPUs explicitly, a fatal error is given later.