Skip to content

Commit 2bb4783

Browse files
committed
Moved obara saika compile flags override
1 parent 7c26939 commit 2bb4783

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,19 @@ install( FILES
224224
# Install Custom Find Modules
225225
include( ${linalg-cmake-modules_SOURCE_DIR}/LinAlgModulesMacros.cmake )
226226
install_linalg_modules( INSTALL_CONFIGDIR )
227+
228+
# This allows specifying a lower compiler optimization level for NVHPC which fails to compile with the -O3 flag whilst leaving the remaining flags unchanged
229+
if (DEFINED GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS)
230+
get_target_property(default_compile_options gauxc COMPILE_OPTIONS)
231+
get_target_property(gauxc_sources gauxc SOURCES)
232+
set_target_properties(gauxc PROPERTIES COMPILE_OPTIONS "")
233+
set_source_files_properties(${gauxc_sources} PROPERTIES COMPILE_OPTIONS "${default_compile_options}")
234+
235+
file(GLOB OB_HOST_SRC_FILES ${CMAKE_CURRENT_LIST_DIR}/xc_integrator/local_work_driver/host/obara_saika/src/*.cxx)
236+
set(adjusted_compile_options ${default_compile_options})
237+
foreach (flag "[\\/\\-]O3" "[\\/\\-]Ofast" "[\\/\\-]fast")
238+
string(REGEX REPLACE ${flag} ${GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS} adjusted_compile_options "${adjusted_compile_options}")
239+
endforeach()
240+
message("-- Setting Obara-Saika COMPILE_OPTIONS to: ${adjusted_compile_options}")
241+
set_source_files_properties(${OB_HOST_SRC_FILES} PROPERTIES COMPILE_OPTIONS "${adjusted_compile_options}")
242+
endif()

src/xc_integrator/local_work_driver/host/obara_saika/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ set( GAUXC_OBARA_SAIKA_HOST_SRC
3030
src/chebyshev_boys_computation.cxx
3131
)
3232

33-
# This is required for compilation with NVHPC as it crashes with the O3 optimization flag
34-
if (DEFINED GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS)
35-
foreach (flag "[\\/\\-]O3" "[\\/\\-]Ofast" "[\\/\\-]fast")
36-
string(REGEX REPLACE ${flag} ${GAUXC_OBARA_SAIKA_COMPILE_OPTIMIZATION_OPTIONS} CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
37-
endforeach()
38-
message("Setting Obara-Saika CMAKE_CXX_FLAGS_RELEASE to: ${CMAKE_CXX_FLAGS_RELEASE}")
39-
endif()
40-
41-
4233
target_sources( gauxc PRIVATE ${GAUXC_OBARA_SAIKA_HOST_SRC} )
4334
target_include_directories( gauxc PUBLIC
4435
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>

0 commit comments

Comments
 (0)