diff --git a/CMakeLists.txt b/CMakeLists.txt index 8474af5d..59e5344d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -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) diff --git a/cmake/Modules/FindKokkos.cmake b/cmake/Modules/FindKokkos.cmake index becfb0f0..a679d347 100644 --- a/cmake/Modules/FindKokkos.cmake +++ b/cmake/Modules/FindKokkos.cmake @@ -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) diff --git a/src/apex/CMakeLists_standalone.cmake b/src/apex/CMakeLists_standalone.cmake index affc0fde..7999b446 100644 --- a/src/apex/CMakeLists_standalone.cmake +++ b/src/apex/CMakeLists_standalone.cmake @@ -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 diff --git a/src/unit_tests/Kokkos/CMakeLists.txt b/src/unit_tests/Kokkos/CMakeLists.txt index 38d10724..530b460d 100644 --- a/src/unit_tests/Kokkos/CMakeLists.txt +++ b/src/unit_tests/Kokkos/CMakeLists.txt @@ -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")