Use OpenMP up to 16 threads with AMD Ryzen
authorErik Lindahl <erik.lindahl@gmail.com>
Sun, 19 Mar 2017 16:57:33 +0000 (17:57 +0100)
committerErik Lindahl <erik.lindahl@gmail.com>
Sun, 19 Mar 2017 16:57:33 +0000 (17:57 +0100)
AMD Ryzen appears to always perform slightly better with OpenMP
than MPI, up to using all 16 threads on the 8-core die.

Change-Id: Iaaf77c87b7f69cabfd3dd7f1b080f3ee45d4ce89

src/programs/mdrun/resource-division.cpp

index d5518a725ca44738460d745de6ec47b3bd8dcb66..295ad05cd3fff0f3daa37c96296f12048743ac0e 100644 (file)
@@ -99,6 +99,7 @@ static const int min_atoms_per_gpu        = 900;
 const int nthreads_omp_faster_default   =  8;
 const int nthreads_omp_faster_Nehalem   = 12;
 const int nthreads_omp_faster_Intel_AVX = 16;
+const int nthreads_omp_faster_AMD_Ryzen = 16;
 /* For CPU only runs the fastest options are usually MPI or OpenMP only.
  * With one GPU, using MPI only is almost never optimal, so we need to
  * compare running pure OpenMP with combined MPI+OpenMP. This means higher
@@ -140,6 +141,11 @@ static int nthreads_omp_faster(const gmx::CpuInfo &cpuInfo, gmx_bool bUseGPU)
         // Intel Nehalem
         nth = nthreads_omp_faster_Nehalem;
     }
+    else if (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Amd && cpuInfo.family() >= 23)
+    {
+        // AMD Ryzen
+        nth = nthreads_omp_faster_AMD_Ryzen;
+    }
     else
     {
         nth = nthreads_omp_faster_default;