Merge remote-tracking branch 'origin/release-2019'
authorSzilárd Páll <pall.szilard@gmail.com>
Wed, 25 Sep 2019 14:05:49 +0000 (16:05 +0200)
committerSzilárd Páll <pall.szilard@gmail.com>
Wed, 25 Sep 2019 14:05:49 +0000 (16:05 +0200)
Change-Id: Ia822fecb18b63d8a4e4408e056850a42875d57e8

docs/release-notes/2019/2019.4.rst
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/hw_info.h
src/gromacs/nbnxm/nbnxm_setup.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 7b952c1697d5779ebef4a6739c60109335894e1c..41071a68725c9f169ac53c72d74ebe818544a6b5 100644 (file)
@@ -186,12 +186,15 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo               &cpuInfo,
                                      compat::not_null<gmx_hw_info_t *> hardwareInfo)
 {
     const int  ncore        = hardwareInfo->hardwareTopology->numberOfCores();
-    /* Zen has family=23, for now we treat future AMD CPUs like Zen
-     * and Hygon Dhyana like Zen */
-    const bool cpuIsAmdZen  = ((cpuInfo.vendor() == CpuInfo::Vendor::Amd &&
-                                cpuInfo.family() >= 23) ||
+    /* Zen1 is assumed for:
+     * - family=23 with the below listed models;
+     * - Hygon as vendor.
+     */
+    const bool cpuIsAmdZen1 = ((cpuInfo.vendor() == CpuInfo::Vendor::Amd &&
+                                cpuInfo.family() == 23 &&
+                                (cpuInfo.model() == 1 || cpuInfo.model() == 17 ||
+                                 cpuInfo.model() == 8 || cpuInfo.model() == 24)) ||
                                cpuInfo.vendor() == CpuInfo::Vendor::Hygon);
-
 #if GMX_LIB_MPI
     int       nhwthread, ngpu, i;
     int       gpu_hash;
@@ -252,7 +255,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 +274,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo               &cpuInfo,
     hardwareInfo->simd_suggest_min    = -maxMinReduced[8];
     hardwareInfo->simd_suggest_max    = maxMinReduced[3];
     hardwareInfo->bIdenticalGPUs      = (maxMinReduced[4] == -maxMinReduced[9]);
-    hardwareInfo->haveAmdZenCpu       = (maxMinReduced[10] > 0);
+    hardwareInfo->haveAmdZen1Cpu      = (maxMinReduced[10] > 0);
 #else
     /* All ranks use the same pointer, protected by a mutex in the caller */
     hardwareInfo->nphysicalnode       = 1;
@@ -287,7 +290,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo               &cpuInfo,
     hardwareInfo->simd_suggest_min    = static_cast<int>(simdSuggested(cpuInfo));
     hardwareInfo->simd_suggest_max    = static_cast<int>(simdSuggested(cpuInfo));
     hardwareInfo->bIdenticalGPUs      = TRUE;
-    hardwareInfo->haveAmdZenCpu       = cpuIsAmdZen;
+    hardwareInfo->haveAmdZen1Cpu      = cpuIsAmdZen1;
     GMX_UNUSED_VALUE(physicalNodeComm);
 #endif
 }
index 567ba3a70787328ae02db34f83f97d26580eae5f..15ebfa788e99d036148b5bcc0b85b965761b8f9d 100644 (file)
@@ -90,7 +90,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 arch */
+    bool                haveAmdZen1Cpu;      /* TRUE when at least one CPU in any of the nodes is AMD Zen of the first generation */
 };
 
 
index e87e6363c5a09f786daab12d104d321ce2cc8553..8c0b73608336637a0b20eb7ee7d3260c224e0ab2 100644 (file)
@@ -146,7 +146,7 @@ pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused    *ir,
             kernelSetup.kernelType = KernelType::Cpu4xN_Simd_2xNN;
         }
 
-        if (hardwareInfo.haveAmdZenCpu)
+        if (hardwareInfo.haveAmdZen1Cpu)
         {
             /* One 256-bit FMA per cycle makes 2xNN faster */
             kernelSetup.kernelType = KernelType::Cpu4xN_Simd_2xNN;
@@ -185,7 +185,7 @@ pick_nbnxn_kernel_cpu(const t_inputrec gmx_unused    *ir,
             (GMX_SIMD_REAL_WIDTH >= 8 ||
              (GMX_SIMD_REAL_WIDTH >= 4 && GMX_SIMD_HAVE_FMA && !GMX_DOUBLE)) &&
 #endif
-            !hardwareInfo.haveAmdZenCpu)
+            !hardwareInfo.haveAmdZen1Cpu)
         {
             kernelSetup.ewaldExclusionType = EwaldExclusionType::Analytical;
         }