Skip to content

Commit

Permalink
Moved obara saika compile flags override
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanstocks00 committed Sep 26, 2024
1 parent 7c26939 commit 2bb4783
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 16 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,19 @@ install( FILES
# Install Custom Find Modules
include( ${linalg-cmake-modules_SOURCE_DIR}/LinAlgModulesMacros.cmake )
install_linalg_modules( INSTALL_CONFIGDIR )

# This allows specifying a lower compiler optimization level for NVHPC which fails to compile with the -O3 flag whilst leaving the remaining flags unchanged
if (DEFINED GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS)
get_target_property(default_compile_options gauxc COMPILE_OPTIONS)
get_target_property(gauxc_sources gauxc SOURCES)
set_target_properties(gauxc PROPERTIES COMPILE_OPTIONS "")
set_source_files_properties(${gauxc_sources} PROPERTIES COMPILE_OPTIONS "${default_compile_options}")

file(GLOB OB_HOST_SRC_FILES ${CMAKE_CURRENT_LIST_DIR}/xc_integrator/local_work_driver/host/obara_saika/src/*.cxx)
set(adjusted_compile_options ${default_compile_options})
foreach (flag "[\\/\\-]O3" "[\\/\\-]Ofast" "[\\/\\-]fast")
string(REGEX REPLACE ${flag} ${GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS} adjusted_compile_options "${adjusted_compile_options}")
endforeach()
message("-- Setting Obara-Saika COMPILE_OPTIONS to: ${adjusted_compile_options}")
set_source_files_properties(${OB_HOST_SRC_FILES} PROPERTIES COMPILE_OPTIONS "${adjusted_compile_options}")
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ set( GAUXC_OBARA_SAIKA_HOST_SRC
src/chebyshev_boys_computation.cxx
)

# This is required for compilation with NVHPC as it crashes with the O3 optimization flag
if (DEFINED GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS)
foreach (flag "[\\/\\-]O3" "[\\/\\-]Ofast" "[\\/\\-]fast")
string(REGEX REPLACE ${flag} ${GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS} CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endforeach()
message("Setting Obara-Saika CMAKE_CXX_FLAGS_RELEASE to: ${CMAKE_CXX_FLAGS_RELEASE}")
endif()


target_sources( gauxc PRIVATE ${GAUXC_OBARA_SAIKA_HOST_SRC} )
target_include_directories( gauxc PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
Expand Down

0 comments on commit 2bb4783

Please sign in to comment.