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

KokkosKernels: remove static constexpr member (#8418) #8443

Merged
merged 1 commit into from
Dec 15, 2020
Merged
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
70 changes: 5 additions & 65 deletions packages/kokkos-kernels/src/sparse/KokkosSparse_spadd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "KokkosKernels_Handle.hpp"
#include "KokkosKernels_Sorting.hpp"
#include <limits>
#include "Kokkos_ArithTraits.hpp"

namespace KokkosSparse {
namespace Experimental {
Expand Down Expand Up @@ -86,10 +86,10 @@ struct SortedCountEntries {
Bcolinds(Bcolinds_),
Crowcounts(Crowcounts_) {}

static constexpr ordinal_type ORDINAL_MAX = std::numeric_limits<ordinal_type>::max();

KOKKOS_INLINE_FUNCTION void operator()(const ordinal_type i) const
{
const ordinal_type ORDINAL_MAX = Kokkos::ArithTraits<ordinal_type>::max();

// count the union of nonzeros in Arow and Brow
size_type numEntries = 0;
size_type ai = 0;
Expand Down Expand Up @@ -202,67 +202,6 @@ struct UnmergedSumFunctor {
CcolindsT ABperm;
};

template <typename ExecSpace, typename size_type, typename ordinal_type,
typename CrowptrsT, typename CcolindsT>
struct SortEntriesFunctor {
SortEntriesFunctor(const CrowptrsT& Crowptrs_, const CcolindsT& Ccolinds_,
const CcolindsT& ABperm_)
: Crowptrs(Crowptrs_),
Ccolinds(Ccolinds_),
CcolindsAux("C colind aux", Ccolinds_.extent(0)),
ABperm(ABperm_),
ABpermAux("AB perm aux", ABperm_.extent(0)) {}
typedef typename Kokkos::TeamPolicy<ExecSpace>::member_type TeamMember;
KOKKOS_INLINE_FUNCTION void operator()(const TeamMember t) const {
// 3: Sort each row's colinds (permuting values at same time), then count
// unique colinds (write that to Crowptr(i)) CrowptrTemp tells how many
// entries in each oversized row
ordinal_type i = t.league_rank();
size_type rowStart = Crowptrs(i);
size_type rowEnd = Crowptrs(i + 1);
size_type rowNum = rowEnd - rowStart;
using lno_t = typename CcolindsT::non_const_value_type;
using unsigned_lno_t = typename std::make_unsigned<lno_t>::type;
KokkosKernels::Impl::SerialRadixSort2<size_type, unsigned_lno_t, lno_t>(
(unsigned_lno_t*)Ccolinds.data() + rowStart,
(unsigned_lno_t*)CcolindsAux.data() + rowStart,
ABperm.data() + rowStart, ABpermAux.data() + rowStart, rowNum);
}
CrowptrsT Crowptrs;
CcolindsT Ccolinds;
CcolindsT CcolindsAux;
CcolindsT ABperm;
CcolindsT ABpermAux;
};

#ifdef KOKKOS_ENABLE_CUDA
template <typename size_type, typename ordinal_type, typename CrowptrsT,
typename CcolindsT>
struct SortEntriesFunctor<Kokkos::Cuda, size_type, ordinal_type, CrowptrsT,
CcolindsT> {
SortEntriesFunctor(const CrowptrsT& Crowptrs_, CcolindsT& Ccolinds_,
CcolindsT& ABperm_)
: Crowptrs(Crowptrs_), Ccolinds(Ccolinds_), ABperm(ABperm_) {}
typedef typename Kokkos::TeamPolicy<Kokkos::Cuda>::member_type TeamMember;
KOKKOS_INLINE_FUNCTION void operator()(const TeamMember t) const {
// 3: Sort each row's colinds (permuting values at same time), then count
// unique colinds (write that to Crowptr(i)) CrowptrTemp tells how many
// entries in each oversized row
size_type i = t.league_rank();
size_type rowStart = Crowptrs(i);
size_type rowEnd = Crowptrs(i + 1);
size_type rowNum = rowEnd - rowStart;
KokkosKernels::Impl::TeamBitonicSort2<
size_type, typename CcolindsT::non_const_value_type,
typename CcolindsT::non_const_value_type, TeamMember>(
Ccolinds.data() + rowStart, ABperm.data() + rowStart, rowNum, t);
}
CrowptrsT Crowptrs;
CcolindsT Ccolinds;
CcolindsT ABperm;
};
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brian-kelley Why was it necessary to remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I missed that when I copied from KokkosKernels - but like Nathan said it's not used anymore (replaced by sort_crs_matrix()).

template <typename size_type, typename ordinal_type, typename ArowptrsT,
typename BrowptrsT, typename CrowptrsT, typename CcolindsT>
struct MergeEntriesFunctor {
Expand Down Expand Up @@ -478,7 +417,6 @@ template <typename size_type, typename ordinal_type, typename ArowptrsT,
typename BscalarT>
struct SortedNumericSumFunctor {
using CscalarT = typename CvaluesT::non_const_value_type;
static constexpr ordinal_type ORDINAL_MAX = std::numeric_limits<ordinal_type>::max();

SortedNumericSumFunctor(const ArowptrsT& Arowptrs_,
const BrowptrsT& Browptrs_,
Expand All @@ -502,6 +440,8 @@ struct SortedNumericSumFunctor {

KOKKOS_INLINE_FUNCTION void operator()(const ordinal_type i) const
{
const ordinal_type ORDINAL_MAX = Kokkos::ArithTraits<ordinal_type>::max();

// count the union of nonzeros in Arow and Brow
size_type ai = 0;
size_type bi = 0;
Expand Down