Limit Zen nbnxm kernel choice to Zen 1
authorBerk Hess <hess@kth.se>
Mon, 23 Sep 2019 11:33:21 +0000 (13:33 +0200)
committerBerk Hess <hess@kth.se>
Mon, 23 Sep 2019 19:04:07 +0000 (21:04 +0200)
Changed the Zen flag in gmx_hw_info_t to a Zen1 flag, so Zen 2,
and newer, is treated as a generic x86 AVX2 architecture.

Change-Id: I5a0fd73973416bbd8cd46422a6f22f1ad95d9924

docs/release-notes/2019/2019.4.rst
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/hw_info.h
src/gromacs/mdlib/forcerec.cpp

index 3ab895e69843d42bbd52698b0426f560917f9027..1c388402369c92a0ce91bef89d4f3b382189e477 100644 (file)
@@ -114,3 +114,10 @@ The OpenCL PME support is therefore disabled on Apple platforms.
 Miscellaneous
 ^^^^^^^^^^^^^
 
+Added AMD Zen 2 detection
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The AMD Zen 2 architecture is now detected as different from Zen 1
+and uses 256-bit wide AVX2 SIMD instructions (GMX_SIMD=AVX2_256) by default. 
+Also the non-bonded kernel parameters have been tuned for Zen 2.
+This has a significant impact on performance.
index aea9a1a3e6fef03dc48374eac44285121de5b85a..4953b17fde647441879b1384c1be39cf59ed13e0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018,2019, 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.
@@ -189,8 +189,10 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo             &cpuInfo,
 {
     const int  ncore        = hwinfo_g->hardwareTopology->numberOfCores();
     /* Zen has family=23, for now we treat future AMD CPUs like Zen */
-    const bool cpuIsAmdZen  = (cpuInfo.vendor() == CpuInfo::Vendor::Amd &&
-                               cpuInfo.family() >= 23);
+    const bool cpuIsAmdZen1 = (cpuInfo.vendor() == CpuInfo::Vendor::Amd &&
+                               cpuInfo.family() == 23 &&
+                               (cpuInfo.model() == 1 || cpuInfo.model() == 17 ||
+                                cpuInfo.model() == 8 || cpuInfo.model() == 24));
 
 #if GMX_LIB_MPI
     int       nhwthread, ngpu, i;
@@ -252,7 +254,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo             &cpuInfo,
         maxMinLocal[7]  = -maxMinLocal[2];
         maxMinLocal[8]  = -maxMinLocal[3];
         maxMinLocal[9]  = -maxMinLocal[4];
-        maxMinLocal[10] = (cpuIsAmdZen ? 1 : 0);
+        maxMinLocal[10] = (cpuIsAmdZen1 ? 1 : 0);
 
         MPI_Allreduce(maxMinLocal.data(), maxMinReduced.data(), maxMinLocal.size(),
                       MPI_INT, MPI_MAX, MPI_COMM_WORLD);
@@ -271,7 +273,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo             &cpuInfo,
     hwinfo_g->simd_suggest_min    = -maxMinReduced[8];
     hwinfo_g->simd_suggest_max    = maxMinReduced[3];
     hwinfo_g->bIdenticalGPUs      = (maxMinReduced[4] == -maxMinReduced[9]);
-    hwinfo_g->haveAmdZenCpu       = (maxMinReduced[10] > 0);
+    hwinfo_g->haveAmdZen1Cpu      = (maxMinReduced[10] > 0);
 #else
     /* All ranks use the same pointer, protected by a mutex in the caller */
     hwinfo_g->nphysicalnode       = 1;
@@ -287,7 +289,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo             &cpuInfo,
     hwinfo_g->simd_suggest_min    = static_cast<int>(simdSuggested(cpuInfo));
     hwinfo_g->simd_suggest_max    = static_cast<int>(simdSuggested(cpuInfo));
     hwinfo_g->bIdenticalGPUs      = TRUE;
-    hwinfo_g->haveAmdZenCpu       = cpuIsAmdZen;
+    hwinfo_g->haveAmdZen1Cpu      = cpuIsAmdZen1;
     GMX_UNUSED_VALUE(physicalNodeComm);
 #endif
 }
index 320fbf3433d7435ad8d0fc9743f783624031b83a..190cccc306b39917947107c37ada320e44b29ff4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2019, 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.
@@ -79,7 +79,7 @@ struct gmx_hw_info_t
     int                 simd_suggest_max;    /* Highest SIMD instruction set supported by at least one rank */
 
     gmx_bool            bIdenticalGPUs;      /* TRUE if all ranks have the same type(s) and order of GPUs */
-    bool                haveAmdZenCpu;       /* TRUE when at least one CPU in any of the nodes is AMD Zen */
+    bool                haveAmdZen1Cpu;      /* TRUE when at least one CPU in any of the nodes is AMD Zen of the first generation */
 };
 
 
index 6475581325ad4de78ec3e9c3d06f211b16b4e038..9920198b773ee5180616eeb49016fe60e2920561 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
@@ -1617,7 +1617,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused    *ir,
             *kernel_type = nbnxnk4xN_SIMD_2xNN;
         }
 #endif
-        if (hardwareInfo.haveAmdZenCpu)
+        if (hardwareInfo.haveAmdZen1Cpu)
         {
             /* One 256-bit FMA per cycle makes 2xNN faster */
             *kernel_type = nbnxnk4xN_SIMD_2xNN;
@@ -1654,7 +1654,7 @@ static void pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused    *ir,
         /* On AMD Zen, tabulated Ewald kernels are faster on all 4 combinations
          * of single or double precision and 128 or 256-bit AVX2.
          */
-        if (!hardwareInfo.haveAmdZenCpu)
+        if (!hardwareInfo.haveAmdZen1Cpu)
         {
             *ewald_excl = ewaldexclAnalytical;
         }