Skip to content

Commit

Permalink
use kokkos from trilinos
Browse files Browse the repository at this point in the history
we will also use kokkoskernels - it has no standalone cmake support kokkos/kokkos-kernels#120
  • Loading branch information
cwsmith authored and Lucas Davis committed Jun 14, 2018
1 parent 57d3ce5 commit a2dfe1c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "kokkos"]
path = kokkos
url = git@github.com:kokkos/kokkos.git
[submodule "kokkos-kernels"]
path = kokkos-kernels
url = git@github.com:kokkos/kokkos-kernels.git
31 changes: 26 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ set(VALGRIND "" CACHE string
set(VALGRIND_ARGS "" CACHE string
"the command line arguments to VALGRIND")

if (ENABLE_KOKKOS)
message("looking for kokkos")
find_package(KokkosCore REQUIRED)
message("found kokkos")
#find_package(KokkosKernels REQUIRED)
add_definitions(-DKOKKOS_ENABLED)
set(KOKKOS_ENABLED true)
include_directories(${KokkosCore_INCLUDE_DIRS})

message(STATUS "Kokkos enabled - Overriding compiler selection for consistency with Kokkos install")
set(CMAKE_CXX_COMPILER ${KokkosCore_CXX_COMPILER})
set(CMAKE_C_COMPILER ${KokkosCore_C_COMPILER})
set(CMAKE_FORTRAN_COMPILER ${KokkosCore_FORTRAN_COMPILER})
message(STATUS "Kokkos CMAKE_CXX_COMPILER ${KokkosCore_CXX_COMPILER}")
message(STATUS "Kokkos CMAKE_C_COMPILER ${KokkosCore_C_COMPILER}")
message(STATUS "Kokkos CMAKE_FORTRAN_COMPILER ${KokkosCore_FORTRAN_COMPILER}")

message(STATUS "Kokkos enabled - Overriding compiler flags for consistency with Kokkos install")
set(CMAKE_CXX_FLAGS ${KokkosCore_CXX_FLAGS})
set(CMAKE_C_FLAGS ${KokkosCore_C_FLAGS})
set(CMAKE_FORTRAN_FLAGS ${KokkosCore_FORTRAN_FLAGS})
message(STATUS "Kokkos CMAKE_CXX_FLAGS ${KokkosCore_CXX_FLAGS}")
message(STATUS "Kokkos CMAKE_C_FLAGS ${KokkosCore_C_FLAGS}")
message(STATUS "Kokkos CMAKE_FORTRAN_FLAGS ${KokkosCore_FORTRAN_FLAGS}")
endif()

set(SCOREC_PREFIX "" CACHE STRING "Directory where SCOREC is installed")

option(ENABLE_PUMI "Build with PUMI interface" OFF)
Expand Down Expand Up @@ -88,11 +114,6 @@ endif()

include_directories(${SCOREC_PREFIX}/include)

if (ENABLE_KOKKOS)
add_subdirectory(kokkos)
add_definitions(-DKOKKOS_ENABLED)
include_directories(${CMAKE_BINARY_DIR}/kokkos ${KOKKOS_INCLUDE_DIRS_RET})
endif()

macro(engpar_export_lib target headers)
install(TARGETS ${target}
Expand Down
4 changes: 2 additions & 2 deletions agi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ target_include_directories(agi PUBLIC
$<INSTALL_INTERFACE:include>
)

if (ENABLE_KOKKOS)
target_link_libraries(agi PUBLIC kokkos)
if (KOKKOS_ENABLED)
target_link_libraries(agi PUBLIC kokkoscore)
endif()
target_link_libraries(agi PUBLIC engpar_support)

Expand Down
1 change: 0 additions & 1 deletion kokkos
Submodule kokkos deleted from d3a941
11 changes: 5 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ include_directories(
${PARMETIS_INCLUDE_DIRS}
)

if (ENABLE_KOKKOS)
include_directories(${KOKKOS_INCLUDE_DIRS_RET})
if (KOKKOS_ENABLED)
include_directories(${KokkosCore_INCLUDE_DIRS})
endif()

if(ENGPAR_FORTRAN_INTERFACE)
Expand All @@ -36,11 +36,10 @@ endif()
set(ALL_LIBS ${ALL_LIBS}
${ZOLTAN_LIBRARIES}
${PARMETIS_LIBRARIES}
${KOKKOS_LIBRARIES}
)

if (ENABLE_KOKKOS)
set(ALL_LIBS ${ALL_LIBS} kokkos)
if (KOKKOS_ENABLED)
set(ALL_LIBS ${ALL_LIBS} ${KokkosCore_LIBRARIES})
endif()

set(TESTING_SOURCES
Expand Down Expand Up @@ -77,7 +76,7 @@ if (ZOLTAN_FOUND)
endif()


if (ENABLE_KOKKOS)
if (KOKKOS_ENABLED)
make_utility(kokkosHelloWorld kokkosHelloWorld.cpp)
make_utility(kokkosFor kokkosFor.cpp)
make_utility(bfsSearch bfsSearch.cpp)
Expand Down

0 comments on commit a2dfe1c

Please sign in to comment.