From b2bc5d6becd479b84561781bc5a0beea40c476b7 Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Mon, 15 Nov 2021 06:54:43 -0700 Subject: [PATCH 1/2] Fix issues with SpMV using tensor cores This might be a bit aggressive but it seems to pass build and tests correctly. Basically removing compilation of the tensore core code path unless it is compiled with the cuda compiler. --- src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp | 2 +- src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp index 1e5c098814..cbec458ae9 100644 --- a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp +++ b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp @@ -45,7 +45,7 @@ #ifndef KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_ #define KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_ -#if defined(KOKKOS_ENABLE_CUDA) && \ +#if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__) && \ (defined(KOKKOS_ARCH_VOLTA) || defined(KOKKOS_ARCH_AMPERE)) #include diff --git a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp index 621c52c157..530f713044 100644 --- a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp +++ b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp @@ -50,7 +50,7 @@ #include "KokkosSparse_BsrMatrix.hpp" #include "KokkosKernels_Controls.hpp" -#if !defined(KOKKOSKERNELS_ETI_ONLY) || KOKKOSKERNELS_IMPL_COMPILE_LIBRARY +#if !defined(KOKKOSKERNELS_ETI_ONLY) || KOKKOSKERNELS_IMPL_COMPILE_LIBRARY && defined(__CUDA_ARCH__) #include #endif @@ -136,7 +136,9 @@ struct SPMV_BSRMATRIX::dispatch(alpha, A, x, beta, y); } -#elif defined(KOKKOS_ARCH_VOLTA) +#elif defined(KOKKOS_ARCH_VOLTA) && defined(__CUDA_ARCH__) /* Volta has float += half * half use it for all matrices */ From 2f71c8c37fec2fccfa2938ef09dc3ce4995635e4 Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Mon, 15 Nov 2021 06:58:43 -0700 Subject: [PATCH 2/2] Apply clang-format --- src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp | 2 +- src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp index cbec458ae9..f4254f129d 100644 --- a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp +++ b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_impl.hpp @@ -45,7 +45,7 @@ #ifndef KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_ #define KOKKOSSPARSE_IMPL_SPMV_TENSOR_CORE_DEF_HPP_ -#if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__) && \ +#if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__) && \ (defined(KOKKOS_ARCH_VOLTA) || defined(KOKKOS_ARCH_AMPERE)) #include diff --git a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp index 530f713044..10abd991d1 100644 --- a/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp +++ b/src/sparse/impl/KokkosSparse_spmv_bsrmatrix_spec.hpp @@ -50,7 +50,8 @@ #include "KokkosSparse_BsrMatrix.hpp" #include "KokkosKernels_Controls.hpp" -#if !defined(KOKKOSKERNELS_ETI_ONLY) || KOKKOSKERNELS_IMPL_COMPILE_LIBRARY && defined(__CUDA_ARCH__) +#if !defined(KOKKOSKERNELS_ETI_ONLY) || \ + KOKKOSKERNELS_IMPL_COMPILE_LIBRARY && defined(__CUDA_ARCH__) #include #endif