Skip to content

Commit

Permalink
Fixing builds with and without kokkos. If APEX is configured without …
Browse files Browse the repository at this point in the history
…Kokkos it should build now. And APEX will build examples correctly with kokkos, and will build Kokkos only if the Kokkos examples/tests are requested. Otherwise it just uses the headers.
  • Loading branch information
khuck committed Mar 20, 2024
1 parent fbcc72e commit e3bcade
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,11 @@ if(APEX_WITH_KOKKOS)
include_directories(${PROJECT_SOURCE_DIR}/kokkos/core/src/impl)
include_directories(${Kokkos_INCLUDE_DIRS_RET})
#include_directories(${Kokkos_INCLUDE_DIRS_RET}/impl)
add_subdirectory(kokkos)
if(APEX_BUILD_TESTS)
# Just for testing
SET(Kokkos_LIBRARY kokkoscore)
add_subdirectory(kokkos)
endif(APEX_BUILD_TESTS)
endif()
add_definitions(-DAPEX_WITH_KOKKOS)
endif()
Expand Down Expand Up @@ -1179,9 +1183,9 @@ if(APEX_BUILD_TESTS)
if (APEX_HIP_TESTS)
add_subdirectory (src/unit_tests/HIP)
endif (APEX_HIP_TESTS)
if (APEX_WITH_KOKKOS AND NOT Kokkos_FOUND)
if (APEX_WITH_KOKKOS)
add_subdirectory (src/unit_tests/Kokkos)
endif (APEX_WITH_KOKKOS AND NOT Kokkos_FOUND)
endif (APEX_WITH_KOKKOS)
else()
#add_subdirectory (src/unit_tests/C EXCLUDE_FROM_ALL)
#add_subdirectory (src/unit_tests/C++ EXCLUDE_FROM_ALL)
Expand Down
4 changes: 3 additions & 1 deletion cmake/Modules/FindKokkos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ message("Kokkos_ROOT is defined as ${Kokkos_ROOT}")

find_path(Kokkos_INCLUDE_DIR NAMES Kokkos_Core.hpp
HINTS ${Kokkos_ROOT}/include $ENV{Kokkos_ROOT}/include)
find_library(Kokkos_LIBRARY NAMES kokkoscore
HINTS ${Kokkos_ROOT}/* $ENV{Kokkos_ROOT}/*)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set Kokkos_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Kokkos DEFAULT_MSG
Kokkos_INCLUDE_DIR)
Kokkos_LIBRARY Kokkos_INCLUDE_DIR)

mark_as_advanced(Kokkos_INCLUDE_DIR Kokkos_LIBRARY)

Expand Down
8 changes: 6 additions & 2 deletions src/apex/CMakeLists_standalone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ if(APEX_WITH_TCMALLOC)
set(TCMALLOC_SOURCE tcmalloc_hooks.cpp)
endif(APEX_WITH_TCMALLOC)

if(APEX_WITH_KOKKOS)
message(INFO " Adding Kokkos support source files")
SET(APEX_KOKKOS_SOURCE apex_kokkos.cpp apex_kokkos_tuning.cpp)
endif(APEX_WITH_KOKKOS)

# Try to keep this in alphabetical order
SET(all_SOURCE
apex_preload.cpp
apex_dynamic.cpp
apex.cpp
apex_error_handling.cpp
apex_kokkos.cpp
apex_kokkos_tuning.cpp
${APEX_KOKKOS_SOURCE}
apex_options.cpp
event_filter.cpp
apex_policies.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/unit_tests/Kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ foreach(example_program ${example_programs})
add_dependencies (tests "${example_program}_kokkos")
add_test ("test_${example_program}_kokkos" "${example_program}_kokkos")
set_tests_properties("test_${example_program}_kokkos" PROPERTIES TIMEOUT 30)
set_property(TEST "test_${example_program}_kokkos" APPEND PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=${PROJECT_BINARY_DIR}/src/apex/libapex.so")
set_property(TEST "test_${example_program}_kokkos" APPEND PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=${PROJECT_BINARY_DIR}/src/apex/libapex${CMAKE_SHARED_LIBRARY_SUFFIX}")
set_property(TEST "test_${example_program}_kokkos" APPEND PROPERTY ENVIRONMENT "APEX_SCREEN_OUTPUT=1")
set_property(TEST "test_${example_program}_kokkos" APPEND PROPERTY ENVIRONMENT "OMP_PROC_BIND=spread")
set_property(TEST "test_${example_program}_kokkos" APPEND PROPERTY ENVIRONMENT "OMP_PLACES=threads")
Expand Down

0 comments on commit e3bcade

Please sign in to comment.