Skip to content

Commit

Permalink
Fix up CMakelists for Trilinos
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Aug 3, 2017
1 parent eb2267d commit 77a2fde
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 194 deletions.
96 changes: 81 additions & 15 deletions CMakeLists.txt
Expand Up @@ -52,19 +52,19 @@ IF(${Kokkos_ENABLE_Cuda})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_CUDA
KOKKOSKERNELS_INST_EXECSPACE_CUDA
"Whether to pre instantiate kernels for the execution space Kokkos::Cuda. This option is Kokkos_INST_EXECSPACE_CUDA=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
"Whether to pre instantiate kernels for the execution space Kokkos::Cuda. This option is KokkosKernels_INST_EXECSPACE_CUDA=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_CUDAUVMSPACE
KOKKOSKERNELS_INST_MEMSPACE_CUDAUVMSPACE
"Whether to pre instantiate kernels for the memory space Kokkos::CudaUVMSpace. This option is Kokkos_INST_EXECSPACE_CUDAUVMSPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
"Whether to pre instantiate kernels for the memory space Kokkos::CudaUVMSpace. This option is KokkosKernels_INST_EXECSPACE_CUDAUVMSPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_CUDASPACE
KOKKOSKERNELS_INST_MEMSPACE_CUDASPACE
"Whether to pre instantiate kernels for the memory space Kokkos::CudaSpace. This option is Kokkos_INST_EXECSPACE_CUDASPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
"Whether to pre instantiate kernels for the memory space Kokkos::CudaSpace. This option is KokkosKernels_INST_EXECSPACE_CUDASPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)

Expand All @@ -81,7 +81,7 @@ IF(${Kokkos_ENABLE_Serial} OR ${Kokkos_ENABLE_Pthread} OR ${Kokkos_ENABLE_OpenMP
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE
KOKKOSKERNELS_INST_MEMSPACE_HOSTSPACE
"Whether to pre instantiate kernels for the memory space Kokkos::HostSpace. This option is Kokkos_INST_EXECSPACE_HOSTSPACE=(${Kokkos_ENABLE_OpenMP} OR ${Kokkos_ENABLE_Pthread} OR ${Kokkos_ENABLE_Serial}) by default. Disabling this when one of the Host execution spaces is enabled may increase build times."
"Whether to pre instantiate kernels for the memory space Kokkos::HostSpace. This option is KokkosKernels_INST_EXECSPACE_HOSTSPACE=(${Kokkos_ENABLE_OpenMP} OR ${Kokkos_ENABLE_Pthread} OR ${Kokkos_ENABLE_Serial}) by default. Disabling this when one of the Host execution spaces is enabled may increase build times."
ON
)
ENDIF()
Expand All @@ -90,7 +90,7 @@ IF(${Kokkos_ENABLE_OpenMP})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_OPENMP
KOKKOSKERNELS_INST_EXECSPACE_OPENMP
"Whether to pre instantiate kernels for the execution space Kokkos::OpenMP. This option is Kokkos_INST_EXECSPACE_OPENMP=${Kokkos_ENABLE_OpenMP} by default. Disabling this when Kokkos_ENABLE_OpenMP is enabled may increase build times."
"Whether to pre instantiate kernels for the execution space Kokkos::OpenMP. This option is KokkosKernels_INST_EXECSPACE_OPENMP=${Kokkos_ENABLE_OpenMP} by default. Disabling this when Kokkos_ENABLE_OpenMP is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_OPENMP_DEFAULT}
)
IF(${${PACKAGE_NAME}_INST_EXECSPACE_OPENMP} AND ${${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE})
Expand Down Expand Up @@ -145,7 +145,7 @@ TRIBITS_ADD_OPTION_AND_DEFINE(
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_DOUBLE
KOKKOSKERNELS_INST_DOUBLE
"Whether to pre instantiate kernels for the scalar type double. This option is Kokkos_INST_DOUBLE=ON by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the scalar type double. This option is KokkosKernels_INST_DOUBLE=ON by default. Disabling this may increase build times."
ON
)

Expand All @@ -158,7 +158,7 @@ ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_FLOAT
KOKKOSKERNELS_INST_FLOAT
"Whether to pre instantiate kernels for the scalar type double. This option is Kokkos_INST_DOUBLE=ON by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the scalar type float. This option is KokkosKernels_INST_FLOAT=Trilinos_ENABLE_FLOAT by default. Disabling this may increase build times."
${KokkosKernels_INST_FLOAT_DEFAULT}
)

Expand All @@ -176,14 +176,14 @@ ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_COMPLEX_DOUBLE
KOKKOSKERNELS_INST_COMPLEX_DOUBLE
"Whether to pre instantiate kernels for the scalar type complex<double>. This option is Kokkos_INST_COMPLEX_DOUBLE=${Trilinos_ENABLE_COMPLEX_DOUBLE} by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the scalar type complex<double>. This option is KokkosKernels_INST_COMPLEX_DOUBLE=${Trilinos_ENABLE_COMPLEX_DOUBLE} by default. Disabling this may increase build times."
${KokkosKernels_INST_COMPLEX_DOUBLE_DEFAULT}
)

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_COMPLEX_FLOAT
KOKKOSKERNELS_INST_COMPLEX_FLOAT
"Whether to pre instantiate kernels for the scalar type complex<float>. This option is Kokkos_INST_COMPLEX_FLOAT=${Trilinos_ENABLE_COMPLEX_FLOAT} by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the scalar type complex<float>. This option is KokkosKernels_INST_COMPLEX_FLOAT=${Trilinos_ENABLE_COMPLEX_FLOAT} by default. Disabling this may increase build times."
${KokkosKernels_INST_COMPLEX_FLOAT_DEFAULT}
)

Expand All @@ -207,22 +207,88 @@ ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_LAYOUTLEFT
KOKKOSKERNELS_INST_LAYOUTLEFT
"Whether to pre instantiate kernels for the view layout LayoutLeft. This option is Kokkos_INST_LAYOUTLEFT=ON by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the view layout LayoutLeft. This option is KokkosKernels_INST_LAYOUTLEFT=ON by default. Disabling this may increase build times."
ON
)

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_LAYOUTRIGHT
KOKKOSKERNELS_INST_LAYOUTRIGHT
"Whether to pre instantiate kernels for the view layout LayoutRight. This option is Kokkos_INST_LAYOUTRIGHT=OFF by default. Disabling this may increase build times."
"Whether to pre instantiate kernels for the view layout LayoutRight. This option is KokkosKernels_INST_LAYOUTRIGHT=OFF by default. Disabling this may increase build times."
OFF
)

# ==================================================================
# Enable Ordinal Types for ETI
# ==================================================================


GLOBAL_SET(KokkosKernels_INST_ORDINAL_INT_DEFAULT ON)
GLOBAL_SET(KokkosKernels_INST_ORDINAL_INT64_T_DEFAULT OFF)


TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_ORDINAL_INT
KOKKOSKERNELS_INST_ORDINAL_INT
"Whether to pre instantiate kernels for the ordinal type int. This option is KokkosKernels_INST_ORDINAL_INT=ON by default."
${KokkosKernels_INST_ORDINAL_INT_DEFAULT}
)

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_ORDINAL_INT64_T
KOKKOSKERNELS_INST_ORDINAL_INT64_T
"Whether to pre instantiate kernels for the ordinal type int64_t. This option is KokkosKernels_INST_ORDINAL_INT64_T=OFF by default."
${KokkosKernels_INST_ORDINAL_INT64_T_DEFAULT}
)

IF (KokkosKernels_INST_ORDINAL_INT)
LIST(APPEND ORDINAL_LIST "int")
ENDIF()

IF (KokkosKernels_INST_ORDINAL_INT64_T)
LIST(APPEND ORDINAL_LIST "int64_t")
ENDIF()


# ==================================================================
# Enable Offset Types for ETI
# ==================================================================


GLOBAL_SET(KokkosKernels_INST_OFFSET_SIZE_T_DEFAULT ON)
GLOBAL_SET(KokkosKernels_INST_OFFSET_INT_DEFAULT ON)
#GLOBAL_SET(KokkosKernels_INST_OFFSET_INT64_T_DEFAULT OFF)


TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_OFFSET_INT
KOKKOSKERNELS_INST_OFFSET_INT
"Whether to pre instantiate kernels for the offset type int. This option is KokkosKernels_INST_OFFSET_INT=ON by default."
${KokkosKernels_INST_OFFSET_INT_DEFAULT}
)

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_OFFSET_SIZE_T
KOKKOSKERNELS_INST_OFFSET_SIZE_T
"Whether to pre instantiate kernels for the offset type size_t. This option is KokkosKernels_INST_OFFSET_SIZE_T=OFF by default."
${KokkosKernels_INST_OFFSET_SIZE_T_DEFAULT}
)

IF (KokkosKernels_INST_OFFSET_INT)
LIST(APPEND OFFSET_LIST "int")
ENDIF()

IF (KokkosKernels_INST_OFFSET_SIZE_T)
LIST(APPEND OFFSET_LIST "size_t")
ENDIF()

MESSAGE("")
MESSAGE("=======================")
MESSAGE("KokkosKernels ETI Types")
MESSAGE(" Devices: ${DEVICE_LIST}")
MESSAGE(" Scalars: ${SCALAR_LIST}")
MESSAGE(" Devices: ${DEVICE_LIST}")
MESSAGE(" Scalars: ${SCALAR_LIST}")
MESSAGE(" Ordinals: ${ORDINAL_LIST}")
MESSAGE(" Offsets: ${OFFSET_LIST}")
MESSAGE("=======================")
MESSAGE("")

Expand All @@ -232,9 +298,9 @@ MESSAGE("")

ADD_SUBDIRECTORY(src)

TRIBITS_ADD_TEST_DIRECTORIES(perf_test)
#TRIBITS_ADD_TEST_DIRECTORIES(perf_test)
TRIBITS_ADD_TEST_DIRECTORIES(unit_test)
TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
#TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)

TRIBITS_PACKAGE_POSTPROCESS()

2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Expand Up @@ -4,6 +4,6 @@
# optional TPLs.

TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES KokkosCore KokkosContainers TeuchosCore TeuchosComm KokkosAlgorithms
LIB_REQUIRED_PACKAGES KokkosCore KokkosContainers KokkosAlgorithms
LIB_OPTIONAL_TPLS quadmath MKL
)
12 changes: 12 additions & 0 deletions cmake/KokkosKernels_config.h.in
Expand Up @@ -55,6 +55,18 @@
#cmakedefine KOKKOSKERNELS_INST_LAYOUTLEFT
/* Whether to build kernels for multivectors of LayoutRight */
#cmakedefine KOKKOSKERNELS_INST_LAYOUTRIGHT

/* Whether to build kernels for ordinal type int */
#cmakedefine KOKKOSKERNELS_INST_ORDINAL_INT
/* Whether to build kernels for ordinal type int64_t */
#cmakedefine KOKKOSKERNELS_INST_ORDINAL_INT64_T

/* Whether to build kernels for offset type int */
#cmakedefine KOKKOSKERNELS_INST_OFFSET_INT
/* Whether to build kernels for offset type size_t */
#cmakedefine KOKKOSKERNELS_INST_OFFSET_SIZE_T


/*
* "Optimization level" for computational kernels in this subpackage.
* The higher the level, the more code variants get generated, and
Expand Down
65 changes: 38 additions & 27 deletions src/CMakeLists.txt
Expand Up @@ -10,20 +10,52 @@ SET(TRILINOS_INCDIR ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DI

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR})
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/impl/tpls)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(HEADERS ${DIR}/generated_specializations_hpp/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/impl/tpls)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

#Include BLAS

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/blas)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/blas/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

#Include Sparse

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/sparse)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/sparse/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

#Include graph

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/graph)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/graph/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

#Include batched

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/batched)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/batched/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

#Include Common

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/impl)

IF (KokkosKernels_INST_EXECSPACE_SERIAL)
IF (KokkosKernels_INST_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_double_*_Serial_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_Serial_*.cpp)
ENDIF()
IF (KokkosKernels_INST_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_float_*_Serial_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_Serial_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
Expand All @@ -36,11 +68,9 @@ ENDIF()

IF (KokkosKernels_INST_EXECSPACE_PTHREAD)
IF (KokkosKernels_INST_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_double_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_Pthread_*.cpp)
ENDIF()
IF (KokkosKernels_INST_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_float_*_Pthread_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_Pthread_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
Expand All @@ -53,11 +83,9 @@ ENDIF()

IF (KokkosKernels_INST_EXECSPACE_OPENMP)
IF (KokkosKernels_INST_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_double_*_OpenMP_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_OpenMP_*.cpp)
ENDIF()
IF (KokkosKernels_INST_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_float_*_OpenMP_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_OpenMP_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
Expand All @@ -70,11 +98,9 @@ ENDIF()

IF (KokkosKernels_INST_EXECSPACE_CUDA)
IF (KokkosKernels_INST_DOUBLE)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_double_*_Cuda_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_double_*_Cuda_*.cpp)
ENDIF()
IF (KokkosKernels_INST_FLOAT)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*specialization_float_*_Cuda_*.cpp)
APPEND_GLOB(SOURCES ${DIR}/generated_specializations_cpp/*/*inst_float_*_Cuda_*.cpp)
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
Expand All @@ -86,25 +112,10 @@ IF (KokkosKernels_INST_EXECSPACE_CUDA)
ENDIF()

LIST(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h)
LIST(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_ETIHelperMacros.h)
#LIST(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_ETIHelperMacros.h)

#-----------------------------------------------------------------------------

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/stage/graph)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/stage/graph/impl)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/stage/graph/utils)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)

SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR}/batched)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)

TRIBITS_ADD_LIBRARY(
kokkoskernels
HEADERS ${HEADERS}
Expand Down

0 comments on commit 77a2fde

Please sign in to comment.