Require cmake 3.9.6
authorRoland Schulz <roland.schulz@intel.com>
Sun, 13 May 2018 05:02:19 +0000 (22:02 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 15 Jan 2019 18:55:14 +0000 (19:55 +0100)
Allows to use modern OpenMP support. The change will permit further
simplifications and modernization, particularly for CUDA.

Also bump release matrices to conform to new requirements.

Fixes #2505

Change-Id: Ibe92639ac4a0bc9ac615826637aeb6e86af0c6d4

CMakeLists.txt
admin/builds/pre-submit-matrix.txt
admin/builds/release-matrix.txt
cmake/gmxManageOpenMP.cmake
src/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/programs/CMakeLists.txt

index 59dc5a7f42ca2389623b01de96af763450d21d1c..1b15aaf05a8cb3f800bfb8f081c806e47ae2e766 100644 (file)
@@ -32,7 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-cmake_minimum_required(VERSION 3.4.3)
+cmake_minimum_required(VERSION 3.9.6)
 
 # CMake modules/macros are in a subdirectory to keep this file cleaner
 # This needs to be set before project() in order to pick up toolchain files
@@ -814,17 +814,6 @@ else()
     message("CMAKE_SHARED_LINKER_FLAGS: ${FFT_LINKER_FLAGS} ${MPI_LINKER_FLAGS}")
 endif()
 
-if(NOT GMX_OPENMP)
-    #Unset all OpenMP flags in case OpenMP was disabled either by the user
-    #or because it was only partially detected (e.g. only for C but not C++ compiler)
-    unset(OpenMP_C_FLAGS CACHE)
-    unset(OpenMP_CXX_FLAGS CACHE)
-else()
-    set(GMX_EXE_LINKER_FLAGS ${GMX_EXE_LINKER_FLAGS} ${OpenMP_LINKER_FLAGS})
-    set(GMX_SHARED_LINKER_FLAGS ${GMX_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS})
-endif()
-
-
 ########################################################################
 # Specify install locations
 ########################################################################
index 41976a95ef0a8db66ebfad0e4fca4bf1a31a9919..d4fcfa523e16bbe0ecd722b28ed96aefa2e3111e 100644 (file)
 
 # Test older gcc
 # Test oldest supported CUDA
+# Test oldest supported cmake
 # Test oldest supported Ubuntu
 # Test MPI with CUDA
 # Test MPI with gcc
-# Test cmake version from before new FindCUDA support (in 3.8)
 # Test MPMD PME with library MPI
-# Test recent cmake (3.7+), to cover minor FindCUDA changes from 3.7.0
-gcc-4.8 gpuhw=nvidia cuda-7.0 cmake-3.8.1 mpi npme=1 nranks=2 openmp
+gcc-4.8 gpuhw=nvidia cuda-7.0 cmake-3.9.6 mpi npme=1 nranks=2 openmp
 
 # Test non-default use of mdrun -gpu_id
 # Test newest gcc supported by newest CUDA at time of release
 # Test thread-MPI with CUDA
-# Test older cmake version (< 3.7)
 # Test SIMD implementation of pair search for GPU code-path
-gcc-7 gpuhw=nvidia gpu_id=1 cuda-10.0 thread-mpi openmp cmake-3.6.1 release-with-assert simd=avx2_256
+gcc-7 gpuhw=nvidia gpu_id=1 cuda-10.0 thread-mpi openmp cmake-3.10.0 release-with-assert simd=avx2_256
 
 # Test with libcxx
 # Test with ThreadSanitizer + OpenMP + SIMD
@@ -44,21 +42,19 @@ clang-7 no-hwloc tsan libcxx-7 openmp cmake-3.12.1 simd=avx2_256
 # Test fftpack fallback
 gcc-8 double x11 no-tng fftpack simd=sse4.1
 
-# Test oldest supported cmake
 # Test older clang
 # Test clang in double precision
 # Test without OpenMP
 # Test thread-MPI
 # Test AVX_128_FMA SIMD + Double (Important for Simd4N=Simd4 and sizeof(SimdInt32)!=4*GMX_SIMD_REAL_WIDTH)
 # Test with TNG support
-clang-3.4 double simd=avx_128_fma thread-mpi no-openmp fftpack cmake-3.4.3 tng
+clang-3.4 double simd=avx_128_fma thread-mpi no-openmp fftpack cmake-3.11.4 tng
 
 # Test newest clang at time of release
 # Test with AddressSanitizer (without OpenMP, see below)
 clang-7 no-openmp asan cmake-3.11.4
 
-# Test newest cmake at time of release
-# Test with clang-tidy (without OpenMP, cmake>=3.6)
+# Test with clang-tidy (without OpenMP)
 clang-7 no-openmp cmake-3.12.1 tidy
 
 # Test oldest supported MSVC on Windows
@@ -86,6 +82,7 @@ gcc-6 openmp gpuhw=nvidia opencl-1.2 clFFT-2.14 mpi simd=avx2_256
 gcc-8 openmp simd=avx2_256 gpuhw=amd opencl-1.2 clFFT-2.14 buildfftw
 
 # TODO
+# Test newest cmake at time of release
 # Add OpenMP support to ASAN build (but libomp.so in clang-4 reports leaks, so might need a suitable build or suppression)
 # Test hwloc-2 support
 # Test newest supported LTS Ubuntu
index 6fb2c09115b8ec6b2d61a00de2afd24e0a9f37a9..15f7314c9a655cab3dd8041d11936dcf8d774743 100644 (file)
@@ -23,7 +23,7 @@
 # Test oldest supported gcc at time of release
 # Test mpi support
 # Test mdrun-only build
-gcc-4.8 mpi mdrun-only release cmake-3.8.1
+gcc-4.8 mpi mdrun-only release cmake-3.9.6
 
 # Test static linking with gcc
 # Test newest gcc at time of release
@@ -36,7 +36,7 @@ icc-19 double release
 # Test static linking with clang
 # Test double precision
 # Test newest supported clang version
-clang-5 static double release cmake-3.6.1
+clang-5 static double release cmake-3.10.0
 
 # Test with GPU support
 # Test with newest CUDA at time of release
index 301778256b0ab7d7288b26ac1cfd8c4211139736..3673f84d98927279d85c9cb3fc1319c2ceac4ea0 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.
@@ -40,28 +40,7 @@ if(GMX_OPENMP)
     # We should do OpenMP detection if we get here
     # OpenMP check must come before other CFLAGS!
     find_package(OpenMP)
-    if(OPENMP_FOUND)
-        # CMake on Windows doesn't support linker flags passed to target_link_libraries
-        # (i.e. it treats /openmp as \openmp library file). Also, no OpenMP linker flags are needed.
-        if(NOT (WIN32 AND NOT MINGW))
-            if(CMAKE_COMPILER_IS_GNUCC AND GMX_PREFER_STATIC_OPENMP AND NOT APPLE)
-                set(OpenMP_LINKER_FLAGS "-Wl,-static -lgomp -lrt -Wl,-Bdynamic -lpthread")
-                set(OpenMP_SHARED_LINKER_FLAGS "")
-            else()
-                # Only set a linker flag if the user didn't set them manually
-                if(NOT DEFINED OpenMP_LINKER_FLAGS)
-                    set(OpenMP_LINKER_FLAGS "${OpenMP_C_FLAGS}")
-                endif()
-                if(NOT DEFINED OpenMP_SHARED_LINKER_FLAGS)
-                    set(OpenMP_SHARED_LINKER_FLAGS "${OpenMP_C_FLAGS}")
-                endif()
-            endif()
-        endif()
-        if(MINGW)
-            #GCC Bug 48659
-            set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS} -mstackrealign")
-        endif()
-    else()
+    if(NOT OPENMP_FOUND)
         message(WARNING
                 "The compiler you are using does not support OpenMP parallelism. This might hurt your performance a lot, in particular with GPUs. Try using a more recent version, or a different compiler. For now, we are proceeding by turning off OpenMP.")
         set(GMX_OPENMP OFF CACHE STRING "Whether GROMACS will use OpenMP parallelism." FORCE)
index fe5f0c0f261ddf6ad1add541f2ef20a43b3c32a0..64fae1cc31a9c8a9ab2a497d38ee9cf40ac49c3d 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,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.
@@ -88,9 +88,6 @@ if (GMX_CLANG_TIDY)
    if(NOT CLANG_TIDY_EXE)
        message(FATAL_ERROR "clang-tidy not found.")
    endif()
-   if(CMAKE_VERSION VERSION_LESS "3.6")
-       message(FATAL_ERROR "clang-tidy support requires cmake 3.6.")
-   endif()
 endif()
 #####
 
index 42f54f1fb770ac25e9c4cc31880c836c8349ad59..f99a56900474a13f077a0c650a972835004d78d5 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,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.
@@ -301,11 +301,14 @@ target_link_libraries(libgromacs
                       PUBLIC
                       ${GMX_PUBLIC_LIBRARIES}
                       )
+if (GMX_OPENMP)
+    target_link_libraries(libgromacs PUBLIC OpenMP::OpenMP_CXX)
+endif()
 set_target_properties(libgromacs PROPERTIES
                       OUTPUT_NAME "gromacs${GMX_LIBS_SUFFIX}"
                       SOVERSION ${LIBRARY_SOVERSION_MAJOR}
                       VERSION ${LIBRARY_VERSION}
-                      COMPILE_FLAGS "${OpenMP_C_FLAGS}")
+                      )
 
 gmx_manage_lmfit()
 target_link_libraries(libgromacs PRIVATE lmfit)
index d56eb87a25503404f17f3cbe7b754fbbcf57290b..b1fe546037485bf70778ade3bcfe09bca4fddae1 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2018, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,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.
@@ -50,8 +50,7 @@ elseif(GMX_BUILD_MDRUN_ONLY)
         ${GMX_STDLIB_LIBRARIES})
     set(BINARY_NAME "mdrun${GMX_BINARY_SUFFIX}")
     set_target_properties(mdrun PROPERTIES
-        OUTPUT_NAME "${BINARY_NAME}"
-        COMPILE_FLAGS "${OpenMP_C_FLAGS}")
+        OUTPUT_NAME "${BINARY_NAME}")
     install(TARGETS mdrun DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT mdrun)
     file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash
          "complete -o nospace -F _gmx_mdrun_compl ${BINARY_NAME}")
@@ -78,8 +77,7 @@ else()
     endif()
     set(BINARY_NAME "gmx${GMX_BINARY_SUFFIX}")
     set_target_properties(gmx PROPERTIES
-        OUTPUT_NAME "${BINARY_NAME}"
-        COMPILE_FLAGS "${OpenMP_C_FLAGS}")
+        OUTPUT_NAME "${BINARY_NAME}")
     install(TARGETS gmx
             RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})