Reduce the use of nbnxn_consts.h
authorBerk Hess <hess@kth.se>
Mon, 15 Jun 2015 15:33:54 +0000 (17:33 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 27 Jun 2015 20:38:38 +0000 (22:38 +0200)
Removed reference to "half-width SIMD" (got reworked a long time ago)

Change-Id: Ifcf4f8ae7d18ac14dae7c843ffe1b5787a3dbff3

src/gromacs/mdlib/calc_verletbuf.c
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/nbnxn_search.c
src/gromacs/mdlib/nbnxn_search.h
src/programs/mdrun/runner.cpp

index 774a0b138e7ee15a9dbca359123f6c0cb74e31fd..50415436f054f4510b6168ec1ac6d289c3b58199 100644 (file)
 #include "gromacs/math/calculate-ewald-splitting-coefficient.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
-#include "gromacs/mdlib/nbnxn_consts.h"
+#include "gromacs/mdlib/nb_verlet.h"
+#include "gromacs/mdlib/nbnxn_search.h"
 #include "gromacs/mdlib/nbnxn_simd.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
-#ifdef GMX_NBNXN_SIMD
-/* The include below sets the SIMD instruction type (precision+width)
- * for all nbnxn SIMD search and non-bonded kernel code.
- */
-#ifdef GMX_NBNXN_HALF_WIDTH_SIMD
-#define GMX_USE_HALF_WIDTH_SIMD_HERE
-#endif
-#include "gromacs/simd/simd.h"
-#endif
-
-
 /* The code in this file estimates a pairlist buffer length
  * given a target energy drift per atom per picosecond.
  * This is done by estimating the drift given a buffer length.
@@ -123,25 +113,40 @@ void verletbuf_get_list_setup(gmx_bool gmx_unused     bSIMD,
                               gmx_bool                bGPU,
                               verletbuf_list_setup_t *list_setup)
 {
+    /* When calling this function we often don't know which kernel type we
+     * are going to use. W choose the kernel type with the smallest possible
+     * i- and j-cluster sizes, so we potentially overestimate, but never
+     * underestimate, the buffer drift.
+     * Note that the current buffer estimation code only handles clusters
+     * of size 1, 2 or 4, so for 4x8 or 8x8 we use the estimate for 4x4.
+     */
+
     if (bGPU)
     {
-        list_setup->cluster_size_i     = NBNXN_GPU_CLUSTER_SIZE;
-        list_setup->cluster_size_j     = NBNXN_GPU_CLUSTER_SIZE;
+        /* The CUDA kernels split the j-clusters in two halves */
+        list_setup->cluster_size_i = nbnxn_kernel_to_ci_size(nbnxnk8x8x8_GPU);
+        list_setup->cluster_size_j = nbnxn_kernel_to_cj_size(nbnxnk8x8x8_GPU)/2;
     }
     else
     {
-        list_setup->cluster_size_i     = NBNXN_CPU_CLUSTER_I_SIZE;
-        list_setup->cluster_size_j     = NBNXN_CPU_CLUSTER_I_SIZE;
+        int kernel_type;
+
+        kernel_type = nbnxnk4x4_PlainC;
+
 #ifdef GMX_NBNXN_SIMD
         if (bSIMD)
         {
-            list_setup->cluster_size_j = GMX_SIMD_REAL_WIDTH;
 #ifdef GMX_NBNXN_SIMD_2XNN
-            /* We assume the smallest cluster size to be on the safe side */
-            list_setup->cluster_size_j /= 2;
+            /* We use the smallest cluster size to be on the safe side */
+            kernel_type = nbnxnk4xN_SIMD_2xNN;
+#else
+            kernel_type = nbnxnk4xN_SIMD_4xN;
 #endif
         }
 #endif
+
+        list_setup->cluster_size_i = nbnxn_kernel_to_ci_size(kernel_type);
+        list_setup->cluster_size_j = nbnxn_kernel_to_cj_size(kernel_type);
     }
 }
 
index 8edb8d5879197fdd79e96c17fbfb8efc787c6174..738fce07e49d01c2f3b6596726e8285dabc98d6b 100644 (file)
@@ -73,7 +73,6 @@
 #include "gromacs/mdlib/forcerec-threading.h"
 #include "gromacs/mdlib/nb_verlet.h"
 #include "gromacs/mdlib/nbnxn_atomdata.h"
-#include "gromacs/mdlib/nbnxn_consts.h"
 #include "gromacs/mdlib/nbnxn_gpu_data_mgmt.h"
 #include "gromacs/mdlib/nbnxn_search.h"
 #include "gromacs/mdlib/nbnxn_simd.h"
@@ -1742,7 +1741,7 @@ static void pick_nbnxn_kernel(FILE                *fp,
     {
         fprintf(fp, "\nUsing %s %dx%d non-bonded kernels\n\n",
                 lookup_nbnxn_kernel_name(*kernel_type),
-                nbnxn_kernel_pairlist_simple(*kernel_type) ? NBNXN_CPU_CLUSTER_I_SIZE : NBNXN_GPU_CLUSTER_SIZE,
+                nbnxn_kernel_to_ci_size(*kernel_type),
                 nbnxn_kernel_to_cj_size(*kernel_type));
 
         if (nbnxnk4x4_PlainC == *kernel_type ||
index 1d48c50c92e512489d7032c265e8b9a86cae24d6..e28c0c0e2d486d0a769e8ab469cc8fcda98e8b64 100644 (file)
@@ -230,7 +230,7 @@ static int get_2log(int n)
     return log2;
 }
 
-static int nbnxn_kernel_to_ci_size(int nb_kernel_type)
+int nbnxn_kernel_to_ci_size(int nb_kernel_type)
 {
     switch (nb_kernel_type)
     {
index 8e644bf21a7f95b1547f773f18646709211766a4..ef57e6416d59e9bbccc0cb834ef0880cac54ad7b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -43,6 +43,9 @@
 extern "C" {
 #endif
 
+/* Returns the i-cluster size for kernel of type nb_kernel_type */
+int nbnxn_kernel_to_ci_size(int nb_kernel_type);
+
 /* Returns the j-cluster size for kernel of type nb_kernel_type */
 int nbnxn_kernel_to_cj_size(int nb_kernel_type);
 
index 500a74d4d44e59737559384a2e5b25e300da714f..c5784a2449a0a9c9b01eb7ee3925e4613112a4e6 100644 (file)
@@ -76,7 +76,6 @@
 #include "gromacs/math/calculate-ewald-splitting-coefficient.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/mdlib/calc_verletbuf.h"
-#include "gromacs/mdlib/nbnxn_consts.h"
 #include "gromacs/mdlib/nbnxn_search.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/pulling/pull.h"