Prohibit AVX_256 with buggy gcc 4.6.1
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 13 May 2014 14:16:44 +0000 (16:16 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 13 May 2014 14:16:44 +0000 (16:16 +0200)
Fixes #1259

Change-Id: I7c523a90ccd0dd8fd3df6cb1914429e22a27ab5d

CMakeLists.txt

index 269f7633217d4ac82e446d32a9d5641169a4afd6..e69ee1ef7252419f847b6de7b8eb5724caaca814 100644 (file)
@@ -312,6 +312,18 @@ if (${CMAKE_C_COMPILER_ID} MATCHES "Clang" AND C_COMPILER_VERSION VERSION_LESS "
     set(GMX_USE_CLANG_FMA_BUG_WORKAROUND TRUE)
 endif()
 
+# GMX_CPU_ACCELERATION will not be set automatically until the second
+# pass (which is not strictly guaranteed to occur), so putting this
+# check here among logically-related tests is inefficient, but the
+# potential loss is likely zero.
+if(GMX_CPU_ACCELERATION STREQUAL "AVX_256"
+        AND CMAKE_COMPILER_IS_GNUCC
+        AND (C_COMPILER_VERSION VERSION_EQUAL "4.6.1"
+            OR CXX_COMPILER_VERSION VERSION_EQUAL "4.6.1"))
+    message(FATAL_ERROR "gcc 4.6.1 has buggy support for AVX, and GROMACS mdrun will not work. If you want simulation performance, use a more recent compiler. Otherwise, use GMX_CPU_ACCELERATION=SSE4.1")
+    # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49002
+endif()
+
 if (CMAKE_C_COMPILER_ID STREQUAL "PGI")
     message(WARNING "All tested PGI compiler versions (up to 12.9.0) generate binaries which produce incorrect results, or even fail to compile Gromacs. Highly recommended to use a different compiler. If you choose to use PGI, make sure to run the regressiontests.")
 endif()