Added AVX2 detection to cmake and created CPU acceleration macro
[alexxy/gromacs.git] / src / gromacs / gmxlib / gmx_cpuid.c
index 0b56208bbe34381b9b11b758dc3f5c17bcc361ee..0824591f1cbbf88dced57ca3991a6f75ee18b2bc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014, 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.
@@ -142,6 +142,7 @@ gmx_cpuid_acceleration_string[GMX_CPUID_NACCELERATIONS] =
     "SSE4.1",
     "AVX_128_FMA",
     "AVX_256",
+    "AVX2_256",
     "Sparc64 HPC-ACE",
     "IBM_QPX"
 };
@@ -1057,7 +1058,11 @@ gmx_cpuid_acceleration_suggest  (gmx_cpuid_t                 cpuid)
 
     if (gmx_cpuid_vendor(cpuid) == GMX_CPUID_VENDOR_INTEL)
     {
-        if (gmx_cpuid_feature(cpuid, GMX_CPUID_FEATURE_X86_AVX))
+        if (gmx_cpuid_feature(cpuid, GMX_CPUID_FEATURE_X86_AVX2))
+        {
+            tmpacc = GMX_CPUID_ACCELERATION_X86_AVX2_256;
+        }
+        else if (gmx_cpuid_feature(cpuid, GMX_CPUID_FEATURE_X86_AVX))
         {
             tmpacc = GMX_CPUID_ACCELERATION_X86_AVX_256;
         }