Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ifdefs for kokkos #23

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/pressio/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ template<class T, class Enable = void> struct Traits;

//*** vector ****
#include "type_traits/native_eigen_vector.hpp"
#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "type_traits/native_kokkos_vector.hpp"
#endif
#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#include "type_traits/native_teuchos_vector.hpp"
#include "type_traits/native_tpetra_block_vector.hpp"
Expand All @@ -73,9 +71,7 @@ template<class T, class Enable = void> struct Traits;
#endif // PRSSIO_ENABLE_TPL_TRILINOS

//*** matrix ****
#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "type_traits/native_kokkos_dense_matrix.hpp"
#endif
#ifdef PRESSIO_ENABLE_TPL_TRILINOS
#include "type_traits/native_teuchos_dense_matrix.hpp"
#endif
Expand Down
6 changes: 6 additions & 0 deletions include/pressio/type_traits/native_kokkos_dense_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_DENSE_MATRIX_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_DENSE_MATRIX_HPP_

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

namespace pressio{

Expand All @@ -61,27 +63,31 @@ struct is_static_dense_matrix_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_static_dense_matrix_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==2 &&
view_type::traits::rank_dynamic==0;
};
#endif

// -------------------------------------------------
template <typename T>
struct is_dynamic_dense_matrix_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_dynamic_dense_matrix_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==2 &&
view_type::traits::rank_dynamic!=0;
};
#endif

// -------------------------------------------------
template <typename T, typename enable = void>
Expand Down
6 changes: 6 additions & 0 deletions include/pressio/type_traits/native_kokkos_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
#ifndef PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_VECTOR_HPP_
#define PRESSIOOPS_TYPE_TRAITS_NATIVE_KOKKOS_VECTOR_HPP_

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
#include "Kokkos_Core.hpp"
#endif

namespace pressio{

Expand All @@ -64,13 +66,15 @@ struct is_static_vector_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_static_vector_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==1 &&
view_type::traits::rank_dynamic==0;
};
#endif

template <class T>
struct is_static_vector_kokkos<const T>: public is_static_vector_kokkos<T> {};
Expand All @@ -85,13 +89,15 @@ struct is_dynamic_vector_kokkos{
static constexpr bool value = false;
};

#ifdef PRESSIO_ENABLE_TPL_KOKKOS
template <class DataType, class ...Properties>
struct is_dynamic_vector_kokkos< Kokkos::View<DataType, Properties...> >
{
using view_type = Kokkos::View<DataType, Properties...>;
static constexpr bool value = view_type::traits::rank==1 &&
view_type::traits::rank_dynamic!=0;
};
#endif

template <class T>
struct is_dynamic_vector_kokkos<const T>: public is_dynamic_vector_kokkos<T> {};
Expand Down