From b348141e689e70e7f43b43445a9ac1b11fe2eec1 Mon Sep 17 00:00:00 2001 From: Philip Fackler Date: Fri, 27 Jan 2023 13:40:15 -0500 Subject: [PATCH 1/4] Check for OpenMP compiler support Added find_package call and meaningful error message. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8654f9884..fcb27e24e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,6 +357,17 @@ if(alignment_remainder) endif() message(STATUS "QMC_SIMD_ALIGNMENT is set to ${QMC_SIMD_ALIGNMENT}") +#--------------------------------------------------------- +# Check for OpenMP compiler support if requested +#--------------------------------------------------------- +if(QMC_OMP) + find_package(OpenMP) + if(NOT OpenMP_FOUND) + message(FATAL_ERROR "No compiler support for OpenMP..." + "need to use -DQMC_OMP=OFF") + endif() +endif(QMC_OMP) + #--------------------------------------------------------- # Determine if OpenMP taskloop works with the CXX compiler #--------------------------------------------------------- From 46ec1d4701f90be8f88ac8e4f5161bb9617c68a1 Mon Sep 17 00:00:00 2001 From: "Paul R. C. Kent" Date: Fri, 27 Jan 2023 14:11:15 -0500 Subject: [PATCH 2/4] More guidance --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcb27e24e0..004779675f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,8 +363,8 @@ message(STATUS "QMC_SIMD_ALIGNMENT is set to ${QMC_SIMD_ALIGNMENT}") if(QMC_OMP) find_package(OpenMP) if(NOT OpenMP_FOUND) - message(FATAL_ERROR "No compiler support for OpenMP..." - "need to use -DQMC_OMP=OFF") + message(FATAL_ERROR "No compiler support for OpenMP found. You will need to run CMake configure with -DQMC_OMP=OFF" + "Switching to a compiler with OpenMP support is recommended.") endif() endif(QMC_OMP) From c95b43cd434da32317628b781eb7639a50ceef17 Mon Sep 17 00:00:00 2001 From: "Paul R. C. Kent" Date: Sun, 29 Jan 2023 12:50:39 -0500 Subject: [PATCH 3/4] Expand guidance and description --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 004779675f..56e58b8fb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,14 +357,18 @@ if(alignment_remainder) endif() message(STATUS "QMC_SIMD_ALIGNMENT is set to ${QMC_SIMD_ALIGNMENT}") -#--------------------------------------------------------- -# Check for OpenMP compiler support if requested -#--------------------------------------------------------- +#------------------------------------------------------------------------------- +# Check for OpenMP compiler support +# +# The CMake OpenMP package is *only* used to to verify compiler support. +# No feature of the package is used and we customize OpenMP options directly +# on a per vendor/compiler basis. +#------------------------------------------------------------------------------- if(QMC_OMP) find_package(OpenMP) if(NOT OpenMP_FOUND) - message(FATAL_ERROR "No compiler support for OpenMP found. You will need to run CMake configure with -DQMC_OMP=OFF" - "Switching to a compiler with OpenMP support is recommended.") + message(FATAL_ERROR "No compiler support for OpenMP found. Switching to a compiler with OpenMP support is recommended." + "Alternatively, you will need to run CMake configure with -DQMC_OMP=OFF") endif() endif(QMC_OMP) From 9db115b2b02841e703ff3df36ddf04863083f056 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Sun, 29 Jan 2023 12:38:12 -0600 Subject: [PATCH 4/4] Move openmp compiler check as the first compiler check. --- CMakeLists.txt | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c15f4b2d8c..f5756024bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,8 +231,26 @@ if(INSTALL_NEXUS) endif() ###################################################################### -# Set the compiler specific options/flags +# Set compiler specific options/flags ###################################################################### +#------------------------------------------------------------------------------- +# Check for OpenMP compiler support +# +# The CMake OpenMP package is *only* used to to verify compiler support. +# No feature of the package is used and we customize OpenMP options directly +# on a per vendor/compiler basis. +#------------------------------------------------------------------------------- +if(QMC_OMP) + find_package(OpenMP) + if(NOT OpenMP_FOUND) + message(FATAL_ERROR "No compiler support for OpenMP found. Switching to a compiler with OpenMP support is recommended." + "Alternatively, you will need to run CMake configure with -DQMC_OMP=OFF") + endif() +endif(QMC_OMP) + +#------------------------------------------------------------------------------- +# Set vendor specific compiler options +#------------------------------------------------------------------------------- if(CMAKE_TOOLCHAIN_FILE) message(STATUS "Using ${CMAKE_TOOLCHAIN_FILE} toolchain ") else(CMAKE_TOOLCHAIN_FILE) @@ -357,21 +375,6 @@ if(alignment_remainder) endif() message(STATUS "QMC_SIMD_ALIGNMENT is set to ${QMC_SIMD_ALIGNMENT}") -#------------------------------------------------------------------------------- -# Check for OpenMP compiler support -# -# The CMake OpenMP package is *only* used to to verify compiler support. -# No feature of the package is used and we customize OpenMP options directly -# on a per vendor/compiler basis. -#------------------------------------------------------------------------------- -if(QMC_OMP) - find_package(OpenMP) - if(NOT OpenMP_FOUND) - message(FATAL_ERROR "No compiler support for OpenMP found. Switching to a compiler with OpenMP support is recommended." - "Alternatively, you will need to run CMake configure with -DQMC_OMP=OFF") - endif() -endif(QMC_OMP) - #--------------------------------------------------------- # Determine if OpenMP taskloop works with the CXX compiler #---------------------------------------------------------