@@ -7,11 +7,25 @@ function (prc var)
77 message ("${var} : ${${var} }" )
88endfunction ()
99
10+ function (list2str list str)
11+ string (REPLACE ";" " " tmp "${list} " )
12+ set (${str} ${tmp} PARENT_SCOPE)
13+ endfunction ()
14+
1015set (COMPOSE_DEBUG_MPI FALSE CACHE LOGICAL "If true, insert debugging code into MPI wrappers." )
16+ set (COMPOSE_MIMIC_GPU FALSE CACHE LOGICAL "If true, use non-optimal OpenMP threading to debug GPU-like parallelism." )
17+ set (COMPOSE_QLT_TIME FALSE CACHE LOGICAL "If true, time QLT operations and display timers at the end." )
1118
1219if (Kokkos_DIR)
1320 include (${Kokkos_DIR} /kokkos_generated_settings.cmake)
1421 set (Kokkos_INCLUDE ${Kokkos_DIR} /include )
22+ list2str ("${KOKKOS_CXXFLAGS} " Kokkos_CXX_FLAGS)
23+ list2str ("${KOKKOS_LD_FLAGS} " Kokkos_LD_FLAGS)
24+ string (FIND "${KOKKOS_GMAKE_DEVICES} " "Cuda" cuda_str_pos)
25+ set (CUDA_BUILD FALSE )
26+ if (${cuda_str_pos} GREATER -1)
27+ set (CUDA_BUILD TRUE )
28+ endif ()
1529else ()
1630 message (FATAL_ERROR "COMPOSE requires Kokkos_DIR" )
1731endif ()
@@ -65,12 +79,16 @@ if ("${cmake_build_type_str}" STREQUAL "debug")
6579endif ()
6680
6781if (DEBUG_BUILD)
68- message ("Enable COMPOSE_DEBUG_MPI because build type is DEBUG." )
82+ message ("Enable COMPOSE_DEBUG_MPI and COMPOSE_MIMIC_GPU because build type is DEBUG." )
6983 set (COMPOSE_DEBUG_MPI TRUE )
84+ set (COMPOSE_MIMIC_GPU TRUE )
7085endif ()
7186
72- set (COMPOSE_COMPILE_FLAGS "-g ${KOKKOS_LINK_FLAGS} ${CMAKE_CXX_FLAGS} " )
73- set (COMPOSE_LINK_FLAGS "-L${Kokkos_DIR} /lib ${KOKKOS_LINK_FLAGS} " )
87+ set (COMPOSE_COMPILE_FLAGS "-g ${Kokkos_CXX_FLAGS} ${CMAKE_CXX_FLAGS} " )
88+ if (CUDA_BUILD)
89+ set (COMPOSE_COMPILE_FLAGS "${COMPOSE_COMPILE_FLAGS} --expt-relaxed-constexpr" )
90+ endif ()
91+ set (COMPOSE_LINK_FLAGS "-L${Kokkos_DIR} /lib ${Kokkos_LD_FLAGS} " )
7492set (COMPOSE_INCLUDES ${Kokkos_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR} /share ${CMAKE_BINARY_DIR} /config)
7593set (COMPOSE_LIBRARIES ${KOKKOS_LIBS_LIST} )
7694
@@ -85,8 +103,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/compose_config.h.in ${CMAKE_BINARY_D
85103
86104add_library (${PROJECT_NAME} ${SOURCES} )
87105set_target_properties (${PROJECT_NAME} PROPERTIES
88- COMPILE_FLAGS ${COMPOSE_COMPILE_FLAGS}
89- LINK_FLAGS ${COMPOSE_LINK_FLAGS} )
106+ COMPILE_FLAGS " ${COMPOSE_COMPILE_FLAGS} "
107+ LINK_FLAGS " ${COMPOSE_LINK_FLAGS} " )
90108target_include_directories (${PROJECT_NAME} PUBLIC cedr siqk)
91109target_include_directories (${PROJECT_NAME} PRIVATE siqk cedr)
92110target_include_directories (${PROJECT_NAME} PUBLIC ${COMPOSE_INCLUDES} )
0 commit comments