Fix bug in GPU list balancing
authorBerk Hess <hess@kth.se>
Sat, 4 Jul 2015 08:18:05 +0000 (10:18 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 6 Jul 2015 08:12:08 +0000 (10:12 +0200)
The function split_sci_entry could produce empty lists. This seems
not to have caused incorrect results, only slight extra processing
of empty workunits in the CUDA kernel. Incorrect Coulomb energies
could appear for empty lists with shift=CENTRAL, but that does not
seem to happen.

Refs #1767.

Change-Id: I0b0ff0a450734d4863f1e9636ff5741d4f1a68da

src/mdlib/nbnxn_search.c

index 9034e2e39fc162bdb3776eabeab57f4e11333259..1e11514713a230dbd0c25d91f22d74cd7a8729d0 100644 (file)
@@ -3545,7 +3545,8 @@ static void split_sci_entry(nbnxn_pairlist_t *nbl,
                 nsp_cj4 += (nbl->cj4[cj4].imei[0].imask >> p) & 1;
             }
 
-            if (nsp_cj4 > 0 && nsp + nsp_cj4 > nsp_max)
+            /* Check if we should split at this cj4 to get a list of size nsp */
+            if (nsp > 0 && nsp + nsp_cj4 > nsp_max)
             {
                 /* Split the list at cj4 */
                 nbl->sci[sci].cj4_ind_end = cj4;