From 9b7cdac44505759cfd4d28050eac9f6948a34f44 Mon Sep 17 00:00:00 2001 From: Olli Lupton Date: Mon, 17 Jan 2022 10:17:06 +0100 Subject: [PATCH] Workaround %nvhpc@21.11:~gpu Random123+ABM issue. --- CMake/MakefileBuildOptions.cmake | 5 +++-- CMakeLists.txt | 10 +++++++++- coreneuron/CMakeLists.txt | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMake/MakefileBuildOptions.cmake b/CMake/MakefileBuildOptions.cmake index fc0b0b551..78f83d867 100644 --- a/CMake/MakefileBuildOptions.cmake +++ b/CMake/MakefileBuildOptions.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (C) 2016-2021 Blue Brain Project +# Copyright (C) 2016-2022 Blue Brain Project # # See top-level LICENSE file for details. # ============================================================================= @@ -72,8 +72,9 @@ endforeach() # PGI compiler adds --c++14;-A option for C++14, remove ";" string(REPLACE ";" " " CXX14_STD_FLAGS "${CMAKE_CXX14_STANDARD_COMPILE_OPTION}") string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE) +string(JOIN " " CORENRN_COMPILE_FLAGS_STRING ${CORENRN_COMPILE_FLAGS}) set(CORENRN_CXX_FLAGS - "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE}} ${CXX14_STD_FLAGS} ${NVHPC_ACC_COMP_FLAGS} ${NVHPC_CXX_INLINE_FLAGS}" + "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_BUILD_TYPE}} ${CXX14_STD_FLAGS} ${NVHPC_ACC_COMP_FLAGS} ${NVHPC_CXX_INLINE_FLAGS} ${CORENRN_COMPILE_FLAGS_STRING}" ) # ============================================================================= diff --git a/CMakeLists.txt b/CMakeLists.txt index 42ca925ad..db79748c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL +# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL # # See top-level LICENSE file for details. # ============================================================================= @@ -239,6 +239,14 @@ endif() if(CORENRN_HAVE_NVHPC_COMPILER) # PGI with llvm code generation doesn't have necessary assembly intrinsic headers add_definitions(-DEIGEN_DONT_VECTORIZE=1) + if(NOT CORENRN_ENABLE_GPU AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 21.11) + # Random123 does not play nicely with NVHPC 21.11+'s detection of ABM features if it detects the + # compiler to be PGI or NVHPC, see: https://github.com/BlueBrain/CoreNeuron/issues/724. In fact + # in GPU builds Random123 (mis)detects nvc++ as nvcc because we pass the -cuda option and we + # therefore avoid the problem. If GPU support is disabled, we pass -mno-abm to avoid the + # problem. + list(APPEND CORENRN_COMPILE_FLAGS -mno-abm) + endif() endif() # ~~~ diff --git a/coreneuron/CMakeLists.txt b/coreneuron/CMakeLists.txt index f0b1232b7..7e9254bcc 100644 --- a/coreneuron/CMakeLists.txt +++ b/coreneuron/CMakeLists.txt @@ -1,9 +1,13 @@ # ============================================================================= -# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL +# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL # # See top-level LICENSE file for details. # ============================================================================= +# Add compiler flags that should apply to all CoreNEURON targets, but which should not leak into +# other included projects. +add_compile_options(${CORENRN_COMPILE_FLAGS}) + # put libraries (e.g. dll) in bin directory set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)