Skip to content

Commit

Permalink
remove CMake setup for kokkos extension
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelKoch committed May 6, 2024
1 parent beb1383 commit e344a65
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 64 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ option(GINKGO_FORCE_GPU_AWARE_MPI "Assert that the MPI library is GPU aware. Thi
catastrophically in case the MPI implementation is not GPU Aware, and GPU aware functionality has been forced" OFF)
set(GINKGO_CI_TEST_OMP_PARALLELISM "4" CACHE STRING
"The number of OpenMP threads to use for a test binary during CTest resource file-constrained test.")
option(GINKGO_EXTENSION_KOKKOS "Enables the Kokkos extension in Ginkgo. A Kokkos installation is required in the ON case." OFF)
option(GINKGO_EXTENSION_KOKKOS_CHECK_TYPE_ALIGNMENT "Enables mapping to Kokkos types to check the alignment of the source and target type." ON)
gko_rename_cache(GINKGO_COMPILER_FLAGS CMAKE_CXX_FLAGS BOOL "Flags used by the CXX compiler during all build types.")
gko_rename_cache(GINKGO_CUDA_COMPILER_FLAGS CMAKE_CUDA_FLAGS BOOL "Flags used by the CUDA compiler during all build types.")
Expand Down Expand Up @@ -282,6 +281,10 @@ else()
endif()
configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/config.hpp.in
${Ginkgo_BINARY_DIR}/include/ginkgo/config.hpp @ONLY)
configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/extensions/kokkos/config.hpp.in
${Ginkgo_BINARY_DIR}/include/ginkgo/extensions/kokkos/config.hpp
@ONLY
)

# Ginkgo core libraries
# Needs to be first in order for `CMAKE_CUDA_DEVICE_LINK_EXECUTABLE` to be
Expand Down
5 changes: 0 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ Ginkgo adds the following additional switches to control what is being built:
this option see the
[`ARCHITECTURES` specification list](https://github.com/ginkgo-project/CudaArchitectureSelector/blob/master/CudaArchitectureSelector.cmake#L58)
section in the documentation of the CudaArchitectureSelector CMake module.
* `-DGINKGO_EXTENSION_KOKKOS={ON, OFF}` enables an extension that can map simple Ginkgo
types (`gko::array`, `gko::matrix::Dense`) to equivalent native Kokkos types. `OFF` by
default. Requires Kokkos to be installed if set to `ON`. To use the mapping it is
required to additionally link against `Ginkgo::ext::kokkos` (or `Ginkgo::ext` for short).
More details on the usage of this extension can be found in the example `kokkos-assembly`.

Additionally, the following CMake options have effect on the build process:

Expand Down
7 changes: 0 additions & 7 deletions cmake/GinkgoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ set(GINKGO_HAVE_HWLOC @GINKGO_HAVE_HWLOC@)

set(GINKGO_HAVE_ROCTX @GINKGO_HAVE_ROCTX@)

# Ginkgo extensions
set(GINKGO_EXTENSION_KOKKOS @GINKGO_EXTENSION_KOKKOS@)

# Ginkgo compiler information
set(GINKGO_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
set(GINKGO_CXX_COMPILER_SHORT "@CMAKE_CXX_COMPILER_ID@:@CMAKE_CXX_COMPILER_VERSION@")
Expand Down Expand Up @@ -199,10 +196,6 @@ if((NOT GINKGO_BUILD_SHARED_LIBS) AND GINKGO_HAVE_TAU)
find_dependency(PerfStubs)
endif()

if(GINKGO_EXTENSION_KOKKOS)
find_dependency(Kokkos 4.1)
endif()

# Check that the same compilers as for Ginkgo are used
function(_ginkgo_check_compiler lang)
if(DEFINED CMAKE_${lang}_COMPILER AND (NOT "${CMAKE_${lang}_COMPILER}" STREQUAL "${GINKGO_${lang}_COMPILER}"))
Expand Down
7 changes: 0 additions & 7 deletions cmake/get_info.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,8 @@ if(TARGET hwloc)
endif()
ginkgo_print_module_footer(${detailed_log} "")

set(Kokkos_VERSION ${GINKGO_Kokkos_VERSION})
set(Kokkos_DEVICES ${GINKGO_Kokkos_DEVICES})
ginkgo_print_generic_header(${minimal_log} " Extensions:")
ginkgo_print_generic_header(${detailed_log} " Extensions:")
ginkgo_print_variable(${minimal_log} "GINKGO_EXTENSION_KOKKOS")
ginkgo_print_variable(${detailed_log} "GINKGO_EXTENSION_KOKKOS")
ginkgo_print_variable(${detailed_log} "GINKGO_EXTENSION_KOKKOS_CHECK_TYPE_ALIGNMENT")
ginkgo_print_variable(${detailed_log} "Kokkos_VERSION")
ginkgo_print_variable(${detailed_log} "Kokkos_DEVICES")

_minimal(
"
Expand Down
10 changes: 5 additions & 5 deletions cmake/install_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ function(ginkgo_install)
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT Ginkgo_Development
FILES_MATCHING PATTERN "*.hpp"
PATTERN "extensions" EXCLUDE
)
install(FILES "${Ginkgo_BINARY_DIR}/include/ginkgo/config.hpp"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ginkgo"
COMPONENT Ginkgo_Development
)
install(DIRECTORY "${Ginkgo_BINARY_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT Ginkgo_Development
FILES_MATCHING PATTERN "*.hpp"
)

if (GINKGO_HAVE_HWLOC AND NOT HWLOC_FOUND)
get_filename_component(HWLOC_LIB_PATH ${HWLOC_LIBRARIES} DIRECTORY)
Expand Down
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ if(GINKGO_BUILD_MPI)
list(APPEND EXAMPLES_LIST distributed-solver)
endif()

if(GINKGO_EXTENSION_KOKKOS)
find_package(Kokkos 4.1.00 QUIET)
if(Kokkos_FOUND)
list(APPEND EXAMPLES_LIST kokkos-assembly)
else()
message(STATUS "No Kokkos found, disabling examples with Kokkos assembly.")
Expand Down
6 changes: 2 additions & 4 deletions examples/kokkos-assembly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ project(kokkos-assembly CXX)
if(NOT GINKGO_BUILD_EXAMPLES)
find_package(Ginkgo 1.8.0 REQUIRED)
endif()
if(NOT GINKGO_EXTENSION_KOKKOS)
message(FATAL_ERROR "The Kokkos examples requires that GINKGO_EXTENSION_KOKKOS=ON is set.")
endif()
find_package(Kokkos 4.1.00 REQUIRED)

# Kokkos doesn't handle any compiler launcher well, so it's disable it
unset(CMAKE_CXX_COMPILER_LAUNCHER)

add_executable(kokkos-assembly kokkos-assembly.cpp)
target_link_libraries(kokkos-assembly Ginkgo::ginkgo Ginkgo::ext::kokkos)
target_link_libraries(kokkos-assembly Ginkgo::ginkgo Kokkos::kokkos)
31 changes: 0 additions & 31 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
if (GINKGO_EXTENSION_KOKKOS)
find_package(Kokkos 4.1 REQUIRED)

set(GINKGO_Kokkos_VERSION ${Kokkos_VERSION} PARENT_SCOPE)
set(GINKGO_Kokkos_DEVICES ${Kokkos_DEVICES} PARENT_SCOPE)

add_library(ginkgo_ext_kokkos INTERFACE)
add_library(Ginkgo::ext::kokkos ALIAS ginkgo_ext_kokkos)
set_property(TARGET ginkgo_ext_kokkos PROPERTY EXPORT_NAME ext::kokkos)

target_link_libraries(ginkgo_ext_kokkos INTERFACE Kokkos::kokkos)
target_compile_features(ginkgo_ext_kokkos INTERFACE cxx_std_17)

configure_file("${Ginkgo_SOURCE_DIR}/include/ginkgo/extensions/kokkos/config.hpp.in"
"${Ginkgo_BINARY_DIR}/include/ginkgo/extensions/kokkos/config.hpp"
@ONLY
)

ginkgo_install_library(ginkgo_ext_kokkos)
install(FILES "${Ginkgo_BINARY_DIR}/include/ginkgo/extensions/kokkos/config.hpp"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ginkgo/extensions/kokkos"
)
install(DIRECTORY "${Ginkgo_SOURCE_DIR}/include/ginkgo/extensions/kokkos"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ginkgo/extensions"
FILES_MATCHING PATTERN "*.hpp"
)
install(FILES "${Ginkgo_SOURCE_DIR}/include/ginkgo/extensions/kokkos.hpp"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ginkgo/extensions"
)
endif ()

if (GINKGO_BUILD_TESTS)
add_subdirectory(test)
endif ()
3 changes: 2 additions & 1 deletion extensions/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include(${PROJECT_SOURCE_DIR}/cmake/create_test.cmake)

if (GINKGO_EXTENSION_KOKKOS)
find_package(Kokkos 4.1.00 QUIET)
if (Kokkos_FOUND)
add_subdirectory(kokkos)
endif ()
4 changes: 2 additions & 2 deletions extensions/test/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ endif()

function(create_gtest_main_kokkos)
add_library(ginkgo_gtest_main_kokkos STATIC kokkos_main.cpp ${PROJECT_SOURCE_DIR}/core/test/gtest/resources.cpp)
target_link_libraries(ginkgo_gtest_main_kokkos PUBLIC Ginkgo::ginkgo GTest::GTest Ginkgo::ext::kokkos)
target_link_libraries(ginkgo_gtest_main_kokkos PUBLIC Ginkgo::ginkgo GTest::GTest Kokkos::kokkos)
target_compile_definitions(ginkgo_gtest_main_kokkos PRIVATE ${definitions})
ginkgo_compile_features(ginkgo_gtest_main_kokkos)
endfunction()
create_gtest_main_kokkos()

function(ginkgo_create_test_kokkos test_name)
ginkgo_create_test(${test_name} NO_GTEST_MAIN RESOURCE_TYPE ${resource_type} ADDITIONAL_LIBRARIES Ginkgo::ext::kokkos ginkgo_gtest_main_kokkos ${ARGN})
ginkgo_create_test(${test_name} NO_GTEST_MAIN RESOURCE_TYPE ${resource_type} ADDITIONAL_LIBRARIES Kokkos::kokkos ginkgo_gtest_main_kokkos ${ARGN})
endfunction()

ginkgo_create_test_kokkos(types)
Expand Down

0 comments on commit e344a65

Please sign in to comment.