Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Prefer -DR123_USE_INTRIN_H=0 to -mno-abm.
Browse files Browse the repository at this point in the history
  • Loading branch information
olupton committed Jan 18, 2022
1 parent 8325ccf commit 5c39ad2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions CMake/MakefileBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,17 @@ 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} ${CORENRN_COMPILE_FLAGS_STRING}"
)
list(TRANSFORM CORENRN_COMPILE_DEFS PREPEND -D OUTPUT_VARIABLE CORENRN_COMPILE_DEF_FLAGS)
string(
JOIN
" "
CORENRN_CXX_FLAGS
${CMAKE_CXX_FLAGS}
${CMAKE_CXX_FLAGS_${_BUILD_TYPE}}
${CXX14_STD_FLAGS}
${NVHPC_ACC_COMP_FLAGS}
${NVHPC_CXX_INLINE_FLAGS}
${CORENRN_COMPILE_DEF_FLAGS})

# =============================================================================
# nmodl/mod2c related options : TODO
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,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)
list(APPEND CORENRN_COMPILE_DEFS EIGEN_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 and
# https://github.com/DEShawResearch/random123/issues/6. 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)
# problem. If GPU support is disabled, we define R123_USE_INTRIN_H=0 to avoid the problem.
list(APPEND CORENRN_COMPILE_DEFS R123_USE_INTRIN_H=0)
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# 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})
add_compile_definitions(${CORENRN_COMPILE_DEFS})

# put libraries (e.g. dll) in bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Expand Down

0 comments on commit 5c39ad2

Please sign in to comment.