Fix nbnxm OpenCL with cluster size 4
authorBerk Hess <hess@kth.se>
Wed, 27 Mar 2019 10:17:26 +0000 (11:17 +0100)
committerSzilárd Páll <pall.szilard@gmail.com>
Wed, 27 Mar 2019 18:30:42 +0000 (19:30 +0100)
Fixed the nbnxm OpenCL setup with cluster size 4 (for Intel IGPUs)
by using the appropriate constexpr to set the clustersize.
Also renamed PairlistType::Hierarchical8x8 to HierarchicalNxN.

Fixes #2906

Change-Id: Ifc373d04481eb7f56211d192014dfef218e56c03

src/gromacs/nbnxm/grid.cpp
src/gromacs/nbnxm/pairlist.h
src/gromacs/nbnxm/pairlist_tuning.cpp
src/gromacs/nbnxm/pairlistset.cpp

index 38818258d50734e0285707059a565a3cc657f915..132ae556e1454a1ecfa50210cb02e7cfae4eaa95 100644 (file)
@@ -65,7 +65,7 @@ namespace Nbnxm
 {
 
 Grid::Geometry::Geometry(const PairlistType pairlistType) :
-    isSimple(pairlistType != PairlistType::Hierarchical8x8),
+    isSimple(pairlistType != PairlistType::HierarchicalNxN),
     numAtomsICluster(IClusterSizePerListType[pairlistType]),
     numAtomsJCluster(JClusterSizePerListType[pairlistType]),
     numAtomsPerCell((isSimple ? 1 : c_gpuNumClusterPerCell)*numAtomsICluster),
index 62f928e67f68ddd07610889bc7c78648e2989dcf..60e71bcf48648f961900c7bd629bd04eac83ee81 100644 (file)
@@ -75,18 +75,6 @@ using AlignedVector = std::vector < T, gmx::AlignedAllocator < T>>;
 template<typename T>
 using FastVector = std::vector < T, gmx::DefaultInitializationAllocator < T>>;
 
-enum class PairlistType : int
-{
-    Simple4x2,
-    Simple4x4,
-    Simple4x8,
-    Hierarchical8x8,
-    Count
-};
-
-static constexpr gmx::EnumerationArray<PairlistType, int> IClusterSizePerListType = { { 4, 4, 4, 8 } };
-static constexpr gmx::EnumerationArray<PairlistType, int> JClusterSizePerListType = { { 2, 4, 8, 8 } };
-
 /* With CPU kernels the i-cluster size is always 4 atoms. */
 static constexpr int c_nbnxnCpuIClusterSize = 4;
 
@@ -112,6 +100,33 @@ static constexpr int c_nbnxnGpuClusterpairSplit = 2;
 /* The fixed size of the exclusion mask array for a half cluster pair */
 static constexpr int c_nbnxnGpuExclSize = c_nbnxnGpuClusterSize*c_nbnxnGpuClusterSize/c_nbnxnGpuClusterpairSplit;
 
+//! The available pair list types
+enum class PairlistType : int
+{
+    Simple4x2,
+    Simple4x4,
+    Simple4x8,
+    HierarchicalNxN,
+    Count
+};
+
+//! Gives the i-cluster size for each pairlist type
+static constexpr gmx::EnumerationArray<PairlistType, int> IClusterSizePerListType =
+{ {
+      c_nbnxnCpuIClusterSize,
+      c_nbnxnCpuIClusterSize,
+      c_nbnxnCpuIClusterSize,
+      c_nbnxnGpuClusterSize
+  } };
+//! Gives the j-cluster size for each pairlist type
+static constexpr gmx::EnumerationArray<PairlistType, int> JClusterSizePerListType =
+{ {
+      2,
+      4,
+      8,
+      c_nbnxnGpuClusterSize
+  } };
+
 /* A buffer data structure of 64 bytes
  * to be placed at the beginning and end of structs
  * to avoid cache invalidation of the real contents
index 97646f6faafd716556adab499f6ded89ca99aa02..0aa8048e83ab8f80a06ad508cb297f9c96b84125 100644 (file)
@@ -501,7 +501,7 @@ void setupDynamicPairlistPruning(const gmx::MDLogger       &mdlog,
     };
 
     /* Currently emulation mode does not support dual pair-lists */
-    const bool useGpuList         = (listParams->pairlistType == PairlistType::Hierarchical8x8);
+    const bool useGpuList         = (listParams->pairlistType == PairlistType::HierarchicalNxN);
 
     if (supportsDynamicPairlistGenerationInterval(*ir) &&
         getenv("GMX_DISABLE_DYNAMICPRUNING") == nullptr)
index 57f90d380f280309fb1506bfaf3d027b143faed4..5607a88f07465b216086c4456d9234e3cbe21435 100644 (file)
@@ -69,7 +69,7 @@ NbnxnListParameters::NbnxnListParameters(const Nbnxm::KernelType kernelType,
 {
     if (!Nbnxm::kernelTypeUsesSimplePairlist(kernelType))
     {
-        pairlistType = PairlistType::Hierarchical8x8;
+        pairlistType = PairlistType::HierarchicalNxN;
     }
     else
     {