Skip to content

Commit

Permalink
Add auto patching of Eigen when using NVHPC compiler to work around b…
Browse files Browse the repository at this point in the history
…ug in Eigen 3.4
  • Loading branch information
maddyscientist committed Aug 18, 2024
1 parent 17c76a7 commit 2bef92c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,15 @@ if(QUDA_DOWNLOAD_EIGEN)
SYSTEM YES)
target_include_directories(Eigen SYSTEM INTERFACE ${Eigen_SOURCE_DIR})
install(DIRECTORY ${Eigen_SOURCE_DIR}/Eigen TYPE INCLUDE)

# Eigen 3.4 needs to be patched on Neon with nvc++
if (${CMAKE_CXX_COMPILER_ID} MATCHES "NVHPC")
set(CMAKE_PATCH_EIGEN OFF CACHE BOOL "Internal use only; do not modify")
if (NOT CMAKE_PATCH_EIGEN)
execute_process(COMMAND patch -N "${Eigen_SOURCE_DIR}/Eigen/src/Core/arch/NEON/Complex.h" "${CMAKE_SOURCE_DIR}/cmake/eigen34_neon.diff")
set(CMAKE_PATCH_EIGEN ON CACHE BOOL "Internal use only; do not modify" FORCE)
endif()
endif()
else()
# fall back to using find_package
find_package(Eigen QUIET)
Expand Down
8 changes: 8 additions & 0 deletions cmake/eigen34_neon.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
21c21
< #if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML
---
> #if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML || __NVCOMPILER_LLVM__
393c393
< #if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML
---
> #if EIGEN_COMP_CLANG || EIGEN_COMP_CASTXML || __NVCOMPILER_LLVM__

0 comments on commit 2bef92c

Please sign in to comment.