Skip to content

Commit

Permalink
Check that ordinal types are signed
Browse files Browse the repository at this point in the history
This is required by several algorithms and is true of the possible ETI
types. Having an unsigned ordinal gives warnings now. It might take some
work to make it fully support unsigned.
  • Loading branch information
brian-kelley committed Nov 10, 2021
1 parent f9eb524 commit f0c98c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/KokkosKernels_Handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ namespace Experimental {
template <class size_type_, class lno_t_, class scalar_t_, class ExecutionSpace,
class TemporaryMemorySpace, class PersistentMemorySpace>
class KokkosKernelsHandle {
static_assert(std::is_signed<lno_t_>::value,
"KokkosKernelsHandle requires that lno_t_ (ordinal) is a "
"signed integer type.");

public:
typedef typename ExecutionSpace::execution_space HandleExecSpace;
typedef typename TemporaryMemorySpace::memory_space HandleTempMemorySpace;
Expand Down
4 changes: 4 additions & 0 deletions src/sparse/KokkosSparse_BlockCrsMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ template <class ScalarType, class OrdinalType, class Device,
class SizeType = typename Kokkos::ViewTraits<OrdinalType*, Device,
void, void>::size_type>
class BlockCrsMatrix {
static_assert(
std::is_signed<OrdinalType>::value,
"BlockCrsMatrix requires that OrdinalType is a signed integer type.");

private:
typedef
typename Kokkos::ViewTraits<ScalarType*, Device, void,
Expand Down
4 changes: 4 additions & 0 deletions src/sparse/KokkosSparse_BsrMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ template <class ScalarType, class OrdinalType, class Device,
class SizeType = typename Kokkos::ViewTraits<OrdinalType*, Device,
void, void>::size_type>
class BsrMatrix {
static_assert(
std::is_signed<OrdinalType>::value,
"BsrMatrix requires that OrdinalType is a signed integer type.");

private:
typedef
typename Kokkos::ViewTraits<ScalarType*, Device, void,
Expand Down
4 changes: 4 additions & 0 deletions src/sparse/KokkosSparse_CrsMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ template <class ScalarType, class OrdinalType, class Device,
class SizeType = typename Kokkos::ViewTraits<OrdinalType*, Device,
void, void>::size_type>
class CrsMatrix {
static_assert(
std::is_signed<OrdinalType>::value,
"CrsMatrix requires that OrdinalType is a signed integer type.");

private:
typedef typename Kokkos::ViewTraits<ScalarType*, Device, void,
MemoryTraits>::host_mirror_space
Expand Down

0 comments on commit f0c98c4

Please sign in to comment.