Skip to content

Commit

Permalink
Make supernodal a configurable CMake option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremiah J Wilke authored and jjwilke committed Mar 12, 2020
1 parent 0e3da51 commit 18ea3e7
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 35 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ IF (NOT KOKKOSKERNELS_HAS_TRILINOS)
)
ENDIF()
INCLUDE(cmake/kokkoskernels_tpls.cmake)
INCLUDE(cmake/kokkoskernels_features.cmake)

# ==================================================================
# Fortran Complex BLAS
Expand Down
4 changes: 4 additions & 0 deletions cmake/KokkosKernels_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
#cmakedefine KOKKOSKERNELS_ENABLE_TPL_CBLAS
/* LAPACKE */
#cmakedefine KOKKOSKERNELS_ENABLE_TPL_LAPACKE
/* METIS */
#cmakedefine KOKKOSKERNELS_ENABLE_TPL_METIS

#cmakedefine KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV

/* if MKL, BLAS is also defined */
#if defined(KOKKOSKERNELS_ENABLE_TPL_MKL)
Expand Down
5 changes: 4 additions & 1 deletion cmake/Modules/FindTPLCBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
IF (NOT CBLAS_ROOT)
SET(CBLAS_ROOT $ENV{CBLAS_ROOT})
ENDIF()
IF (NOT CBLAS_ROOT)
SET(CBLAS_ROOT $ENV{OPENBLAS_ROOT})
ENDIF()
Expand All @@ -12,7 +15,7 @@ IF (CBLAS_LIBRARIES)
ELSE()
#we need to find one of the valid versions from the list below
KOKKOSKERNELS_FIND_IMPORTED(CBLAS
LIBRARY cblas blas blis openblas
LIBRARY cblas openblas blas blis
LIBRARY_PATHS ${CBLAS_LIBRARY_DIRS}
HEADERS cblas.h
HEADER_PATHS ${CBLAS_INCLUDE_DIRS})
Expand Down
3 changes: 3 additions & 0 deletions cmake/Modules/FindTPLLAPACKE.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
IF (NOT LAPACKE_ROOT)
SET(LAPACKE_ROOT $ENV{LAPACKE_ROOT})
ENDIF()
IF (NOT LAPACKE_ROOT)
SET(LAPACKE_ROOT $ENV{OPENBLAS_ROOT})
ENDIF()
Expand Down
9 changes: 9 additions & 0 deletions cmake/Modules/FindTPLMETIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
IF (NOT METIS_ROOT)
SET(METIS_ROOT $ENV{METIS_ROOT})
ENDIF()
#we need to find one of the valid versions from the list below
KOKKOSKERNELS_FIND_IMPORTED(METIS
LIBRARY metis
LIBRARY_PATHS ${METIS_LIBRARY_DIRS}
HEADERS metis.h
HEADER_PATHS ${METIS_INCLUDE_DIRS})
22 changes: 22 additions & 0 deletions cmake/kokkoskernels_features.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function(kokkoskernels_feature_depends_on_tpls FEATURE)
IF (KOKKOSKERNELS_ENABLE_${FEATURE})
FOREACH(TPL ${ARGN})
IF (NOT KOKKOSKERNELS_ENABLE_TPL_${TPL})
MESSAGE(SEND_ERROR "Feature ${FEATURE} requires TPL support for ${TPL}. Must build with -DKokkosKernels_ENABLE_TPL_${TPL}:BOOL=ON and potentially -D${TPL}_ROOT=<INSTALL> to the desired package location")
ENDIF()
ENDFOREACH()
ENDIF()
endfunction()

KOKKOSKERNELS_ADD_OPTION(
ENABLE_SUPERNODAL_SPTRSV
OFF
BOOL
"Whether to build supernodal SPTRSV support")
KOKKOSKERNELS_FEATURE_DEPENDS_ON_TPLS(
SUPERNODAL_SPTRSV
CHOLMOD
SUPERLU
LAPACKE
CBLAS
)
2 changes: 2 additions & 0 deletions cmake/kokkoskernels_tpls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ ENDIF()

KOKKOSKERNELS_ADD_TPL_OPTION(CHOLMOD OFF "Whether to enable CHOLMOD")
KOKKOSKERNELS_ADD_TPL_OPTION(SUPERLU OFF "Whether to enable SUPERLU")
KOKKOSKERNELS_ADD_TPL_OPTION(METIS OFF "Whether to enable METIS")

# We need to do all the import work
IF (NOT KOKKOSKERNELS_HAS_TRILINOS)
Expand All @@ -479,6 +480,7 @@ IF (NOT KOKKOSKERNELS_HAS_TRILINOS)
KOKKOSKERNELS_IMPORT_TPL(LAPACKE)
KOKKOSKERNELS_IMPORT_TPL(CHOLMOD)
KOKKOSKERNELS_IMPORT_TPL(SUPERLU)
KOKKOSKERNELS_IMPORT_TPL(METIS)
ENDIF()

#Convert list to newlines (which CMake doesn't always like in cache variables)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,5 @@ KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC CHOLMOD)
KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC MKL)
KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC CUBLAS)
KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC CUSPARSE)
KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC METIS)
# Not yet here KOKKOSKERNELS_LINK_TPL(kokkoskernels PUBLIC MAGMA)
10 changes: 0 additions & 10 deletions src/common/KokkosKernels_Handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@
#ifndef _KOKKOSKERNELHANDLE_HPP
#define _KOKKOSKERNELHANDLE_HPP

#if defined(KOKKOSKERNELS_ENABLE_TPL_CBLAS) && \
defined(KOKKOSKERNELS_ENABLE_TPL_LAPACKE) && \
(defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) || \
defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD))

// Enable supernodal sptrsv
#define KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV

#endif

namespace KokkosKernels{

namespace Experimental{
Expand Down
10 changes: 2 additions & 8 deletions src/sparse/KokkosSparse_sptrsv_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,9 @@
#define KOKKOSKERNELS_SPTRSV_CUDAGRAPHSUPPORT
#endif

#if defined(KOKKOSKERNELS_ENABLE_TPL_CBLAS) && \
defined(KOKKOSKERNELS_ENABLE_TPL_LAPACKE) && \
(defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) || \
defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD))

// Enable supernodal sptrsv
#define KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV
#include <KokkosSparse_CrsMatrix.hpp>

#ifdef KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV
#include <KokkosSparse_CrsMatrix.hpp>
#endif

namespace KokkosSparse {
Expand Down
7 changes: 1 addition & 6 deletions src/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,9 @@
#include <KokkosSparse_spmv.hpp>
#include <KokkosSparse_CrsMatrix.hpp>

#if defined(KOKKOSKERNELS_ENABLE_TPL_CBLAS) && \
defined(KOKKOSKERNELS_ENABLE_TPL_LAPACKE) && \
(defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) || \
defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD))
#ifdef KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV

// Enable supernodal sptrsv
#define KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV

#include "KokkosBlas2_gemv.hpp"
#include "KokkosBlas2_team_gemv.hpp"
#include "KokkosSparse_spmv.hpp"
Expand Down
10 changes: 0 additions & 10 deletions src/sparse/impl/KokkosSparse_sptrsv_symbolic_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@
/// \file Kokkos_Sparse_impl_sptrsv_symbolic.hpp
/// \brief Implementation(s) of sparse triangular solve.

#if defined(KOKKOSKERNELS_ENABLE_TPL_CBLAS) && \
defined(KOKKOSKERNELS_ENABLE_TPL_LAPACKE) && \
(defined(KOKKOSKERNELS_ENABLE_TPL_SUPERLU) || \
defined(KOKKOSKERNELS_ENABLE_TPL_CHOLMOD))

// Enable supernodal sptrsv
#define KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV

#endif

#include <KokkosKernels_config.h>
#include <Kokkos_ArithTraits.hpp>
#include <KokkosSparse_sptrsv_handle.hpp>
Expand Down

0 comments on commit 18ea3e7

Please sign in to comment.