Skip to content

Commit dc3df93

Browse files
committed
put default types in KokkosKernels namespace
1 parent d4c2511 commit dc3df93

22 files changed

+353
-321
lines changed

blas/src/KokkosBlas1_dot.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_va
7777
// These special cases are to maintain accuracy.
7878
using result_type = typename KokkosBlas::Impl::DotAccumulatingScalar<dot_type>::type;
7979
using RVector_Internal =
80-
Kokkos::View<dot_type, default_layout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
81-
using RVector_Result =
82-
Kokkos::View<result_type, default_layout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
80+
Kokkos::View<dot_type, KokkosKernels::default_layout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
81+
using RVector_Result = Kokkos::View<result_type, KokkosKernels::default_layout, Kokkos::HostSpace,
82+
Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
8383

8484
XVector_Internal X = x;
8585
YVector_Internal Y = y;

blas/src/KokkosBlas1_nrm1.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_va
4949
typename KokkosKernels::Impl::GetUnifiedLayout<XVector>::array_layout,
5050
typename XVector::device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> >;
5151

52-
using RVector_Internal =
53-
Kokkos::View<mag_type, default_layout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >;
52+
using RVector_Internal = Kokkos::View<mag_type, KokkosKernels::default_layout, Kokkos::HostSpace,
53+
Kokkos::MemoryTraits<Kokkos::Unmanaged> >;
5454

5555
mag_type result;
5656
RVector_Internal R = RVector_Internal(&result);

blas/src/KokkosBlas1_nrm2_squared.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_va
5555
typename XVector::device_type, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
5656
XVector_Internal;
5757

58-
typedef Kokkos::View<mag_type, default_layout, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged> >
58+
typedef Kokkos::View<mag_type, KokkosKernels::default_layout, Kokkos::HostSpace,
59+
Kokkos::MemoryTraits<Kokkos::Unmanaged> >
5960
RVector_Internal;
6061

6162
mag_type result;

common/src/KokkosKernels_default_types.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "Kokkos_Core.hpp" //for LayoutLeft/LayoutRight
2121
#include <KokkosKernels_config.h> //for all the ETI #cmakedefine macros
2222

23+
namespace KokkosKernels {
24+
2325
#if defined(KOKKOSKERNELS_INST_ORDINAL_INT)
2426
using default_lno_t = int;
2527
#elif defined(KOKKOSKERNELS_INST_ORDINAL_INT64_T)
@@ -73,4 +75,6 @@ using default_device = Kokkos::Threads;
7375
using default_device = Kokkos::Serial;
7476
#endif
7577

78+
} // namespace KokkosKernels
79+
7680
#endif // KOKKOSKERNELS_DEFAULT_TYPES_H

sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,10 @@ struct SptrsvWrap {
734734
const int nsrow = colptr(j1 + 1) - i1;
735735

736736
// create a view for the s-th supernocal column
737-
// NOTE: we currently supports only default_layout = LayoutLeft
737+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
738738
scalar_t *dataL = const_cast<scalar_t *>(values.data());
739-
Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> viewL(&dataL[i1], nsrow,
740-
nscol);
739+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> viewL(
740+
&dataL[i1], nsrow, nscol);
741741

742742
// extract part of the solution, corresponding to the diagonal block
743743
auto Xj = Kokkos::subview(X, range_type(j1, j2));
@@ -776,8 +776,9 @@ struct SptrsvWrap {
776776
KokkosBlas::TeamGemv<member_type, KokkosBlas::Trans::NoTranspose,
777777
KokkosBlas::Algo::Gemv::Unblocked>::invoke(team, one, Ljj, Y, zero, Xj);
778778
} else {
779-
// NOTE: we currently supports only default_layout = LayoutLeft
780-
Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol, 1);
779+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
780+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(
781+
Xj.data(), nscol, 1);
781782
if (unit_diagonal) {
782783
KokkosBatched::TeamTrsm<member_type, KokkosBatched::Side::Left, KokkosBatched::Uplo::Lower,
783784
KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::Unit,
@@ -815,8 +816,9 @@ struct SptrsvWrap {
815816
// Functor for Upper-triangular solve in CSR
816817
template <class ColptrType, class RowindType, class ValuesType, class LHSType>
817818
struct UpperTriSupernodalFunctor {
818-
// NOTE: we currently supports only default_layout = LayoutLeft
819-
using SupernodeView = typename Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged>;
819+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
820+
using SupernodeView =
821+
typename Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged>;
820822

821823
bool invert_diagonal;
822824
const int *supercols;
@@ -939,8 +941,9 @@ struct SptrsvWrap {
939941
KokkosBlas::TeamGemv<member_type, KokkosBatched::Trans::Transpose, KokkosBlas::Algo::Gemv::Unblocked>::
940942
template invoke<const scalar_t, Ujj_type, Y_type, Xj_type>(team, one, Ujj, Y, zero, Xj);
941943
} else {
942-
// NOTE: we currently supports only default_layout = LayoutLeft
943-
Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol, 1);
944+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
945+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(
946+
Xj.data(), nscol, 1);
944947
KokkosBatched::TeamTrsm<member_type, KokkosBatched::Side::Left, KokkosBatched::Uplo::Lower,
945948
KokkosBatched::Trans::Transpose, KokkosBatched::Diag::NonUnit,
946949
KokkosBatched::Algo::Trsm::Unblocked>::invoke(team, one, Ujj, Xjj);
@@ -1030,10 +1033,10 @@ struct SptrsvWrap {
10301033
const int nsrow2 = nsrow - nscol;
10311034

10321035
// create a view of the s-th supernocal column of U
1033-
// NOTE: we currently supports only default_layout = LayoutLeft
1036+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
10341037
scalar_t *dataU = const_cast<scalar_t *>(values.data());
1035-
Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> viewU(&dataU[i1], nsrow,
1036-
nscol);
1038+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> viewU(
1039+
&dataU[i1], nsrow, nscol);
10371040

10381041
// extract part of solution, corresponding to the diagonal block U(s, s)
10391042
auto Xj = Kokkos::subview(X, range_type(j1, j2));
@@ -1069,8 +1072,9 @@ struct SptrsvWrap {
10691072
KokkosBlas::TeamGemv<member_type, KokkosBatched::Trans::NoTranspose,
10701073
KokkosBlas::Algo::Gemv::Unblocked>::invoke(team, one, Ujj, Y, zero, Xj);
10711074
} else {
1072-
// NOTE: we currently supports only default_layout = LayoutLeft
1073-
Kokkos::View<scalar_t **, default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol, 1);
1075+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
1076+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, temp_mem_space, Kokkos::MemoryUnmanaged> Xjj(
1077+
Xj.data(), nscol, 1);
10741078
KokkosBatched::TeamTrsm<member_type, KokkosBatched::Side::Left, KokkosBatched::Uplo::Upper,
10751079
KokkosBatched::Trans::NoTranspose, KokkosBatched::Diag::NonUnit,
10761080
KokkosBatched::Algo::Trsm::Unblocked>::invoke(team, one, Ujj, Xjj);
@@ -1280,8 +1284,9 @@ struct SptrsvWrap {
12801284
timer.reset();
12811285
#endif
12821286

1283-
// NOTE: we currently supports only default_layout = LayoutLeft
1284-
using supernode_view_type = Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged>;
1287+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
1288+
using supernode_view_type =
1289+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged>;
12851290
if (diag_kernel_type_host(lvl) == 3) {
12861291
// using device-level kernels (functor is called to scatter the
12871292
// results)
@@ -1340,9 +1345,10 @@ struct SptrsvWrap {
13401345
KokkosBlas::gemv(space, "N", one, Ljj, Y, zero, Xj);
13411346
} else {
13421347
char unit_diag = (unit_diagonal ? 'U' : 'N');
1343-
// NOTE: we currently supports only default_layout =
1348+
// NOTE: we currently supports only KokkosKernels::default_layout =
13441349
// LayoutLeft
1345-
Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol, 1);
1350+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(
1351+
Xj.data(), nscol, 1);
13461352
KokkosBlas::trsm(space, "L", "L", "N", &unit_diag, one, Ljj, Xjj);
13471353
// TODO: space.fence();
13481354
Kokkos::fence();
@@ -1612,9 +1618,9 @@ struct SptrsvWrap {
16121618
int workoffset = work_offset_host(s);
16131619

16141620
// create a view for the s-th supernocal block column
1615-
// NOTE: we currently supports only default_layout = LayoutLeft
1616-
Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged> viewU(&dataU[i1], nsrow,
1617-
nscol);
1621+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
1622+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged> viewU(
1623+
&dataU[i1], nsrow, nscol);
16181624

16191625
if (invert_offdiagonal) {
16201626
auto Uij = Kokkos::subview(viewU, range_type(0, nsrow), Kokkos::ALL());
@@ -1637,10 +1643,10 @@ struct SptrsvWrap {
16371643
// instead of trmv/trsv
16381644
KokkosBlas::gemv(space, "N", one, Ujj, Y, zero, Xj);
16391645
} else {
1640-
// NOTE: we currently supports only default_layout =
1646+
// NOTE: we currently supports only KokkosKernels::default_layout =
16411647
// LayoutLeft
1642-
Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol,
1643-
1);
1648+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(
1649+
Xj.data(), nscol, 1);
16441650
KokkosBlas::trsm(space, "L", "U", "N", "N", one, Ujj, Xjj);
16451651
}
16461652
// update off-diagonal blocks
@@ -1713,9 +1719,9 @@ struct SptrsvWrap {
17131719
int workoffset = work_offset_host(s);
17141720

17151721
// create a view for the s-th supernocal block column
1716-
// NOTE: we currently supports only default_layout = LayoutLeft
1717-
Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged> viewU(&dataU[i1], nsrow,
1718-
nscol);
1722+
// NOTE: we currently supports only KokkosKernels::default_layout = LayoutLeft
1723+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged> viewU(
1724+
&dataU[i1], nsrow, nscol);
17191725

17201726
// extract part of the solution, corresponding to the diagonal
17211727
// block
@@ -1741,9 +1747,10 @@ struct SptrsvWrap {
17411747
if (invert_diagonal) {
17421748
KokkosBlas::gemv(space, "T", one, Ujj, Xj, zero, Y);
17431749
} else {
1744-
// NOTE: we currently supports only default_layout =
1750+
// NOTE: we currently supports only KokkosKernels::default_layout =
17451751
// LayoutLeft
1746-
Kokkos::View<scalar_t **, default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(Xj.data(), nscol, 1);
1752+
Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t, Kokkos::MemoryUnmanaged> Xjj(
1753+
Xj.data(), nscol, 1);
17471754
KokkosBlas::trsm(space, "L", "L", "T", "N", one, Ujj, Xjj);
17481755
}
17491756
}

sparse/src/KokkosKernels_Handle.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class KokkosKernelsHandle {
223223
typename size_type_persistent_work_view_t::HostMirror size_type_persistent_work_host_view_t; // Host view type
224224
typedef typename Kokkos::View<nnz_scalar_t *, HandleTempMemorySpace> scalar_temp_work_view_t;
225225
typedef typename Kokkos::View<nnz_scalar_t *, HandlePersistentMemorySpace> scalar_persistent_work_view_t;
226-
typedef typename Kokkos::View<nnz_scalar_t **, default_layout, HandlePersistentMemorySpace>
226+
typedef typename Kokkos::View<nnz_scalar_t **, KokkosKernels::default_layout, HandlePersistentMemorySpace>
227227
scalar_persistent_work_view2d_t;
228228
typedef typename Kokkos::View<nnz_lno_t *, HandleTempMemorySpace> nnz_lno_temp_work_view_t;
229229
typedef typename Kokkos::View<nnz_lno_t *, HandlePersistentMemorySpace> nnz_lno_persistent_work_view_t;

sparse/src/KokkosSparse_BsrMatrix.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ struct BsrRowViewConst {
300300
/// storage for sparse matrices, as described, for example, in Saad
301301
/// (2nd ed.).
302302
template <class ScalarType, class OrdinalType, class Device, class MemoryTraits = void,
303-
class SizeType = default_size_type>
303+
class SizeType = KokkosKernels::default_size_type>
304304
class BsrMatrix {
305305
static_assert(std::is_signed<OrdinalType>::value, "BsrMatrix requires that OrdinalType is a signed integer type.");
306306
static_assert(Kokkos::is_memory_traits_v<MemoryTraits> || std::is_void_v<MemoryTraits>,

sparse/src/KokkosSparse_CcsMatrix.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CcsMatrix {
142142
//! Type of each (column) index in the matrix.
143143
typedef OrdinalType ordinal_type;
144144
//! Type of the graph structure of the sparse matrix - consistent with Kokkos.
145-
typedef Kokkos::StaticCcsGraph<ordinal_type, default_layout, device_type, memory_traits, size_type>
145+
typedef Kokkos::StaticCcsGraph<ordinal_type, KokkosKernels::default_layout, device_type, memory_traits, size_type>
146146
staticccsgraph_type;
147147
//! Type of the "column map" (which contains the offset for each column's
148148
//! data).

sparse/src/KokkosSparse_CrsMatrix.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ struct SparseRowViewConst {
315315
/// storage for sparse matrices, as described, for example, in Saad
316316
/// (2nd ed.).
317317
template <class ScalarType, class OrdinalType, class Device, class MemoryTraits = void,
318-
class SizeType = default_size_type>
318+
class SizeType = KokkosKernels::default_size_type>
319319
class CrsMatrix {
320320
static_assert(std::is_signed<OrdinalType>::value, "CrsMatrix requires that OrdinalType is a signed integer type.");
321321

@@ -344,10 +344,10 @@ class CrsMatrix {
344344
//! Type of a host-memory mirror of the sparse matrix.
345345
typedef CrsMatrix<ScalarType, OrdinalType, host_mirror_space, MemoryTraits, SizeType> HostMirror;
346346
//! Type of the graph structure of the sparse matrix.
347-
typedef Kokkos::StaticCrsGraph<ordinal_type, default_layout, device_type, memory_traits, size_type>
347+
typedef Kokkos::StaticCrsGraph<ordinal_type, KokkosKernels::default_layout, device_type, memory_traits, size_type>
348348
StaticCrsGraphType;
349349
//! Type of the graph structure of the sparse matrix - consistent with Kokkos.
350-
typedef Kokkos::StaticCrsGraph<ordinal_type, default_layout, device_type, memory_traits, size_type>
350+
typedef Kokkos::StaticCrsGraph<ordinal_type, KokkosKernels::default_layout, device_type, memory_traits, size_type>
351351
staticcrsgraph_type;
352352
//! Type of column indices in the sparse matrix.
353353
typedef typename staticcrsgraph_type::entries_type index_type;

sparse/src/KokkosSparse_gauss_seidel_handle.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class PointGaussSeidelHandle : public GaussSeidelHandle<size_type_, lno_t_, scal
208208

209209
typedef typename Kokkos::View<nnz_scalar_t *, HandleTempMemorySpace> scalar_temp_work_view_t;
210210
typedef typename Kokkos::View<nnz_scalar_t *, HandlePersistentMemorySpace> scalar_persistent_work_view_t;
211-
typedef typename Kokkos::View<nnz_scalar_t **, default_layout, HandlePersistentMemorySpace>
211+
typedef typename Kokkos::View<nnz_scalar_t **, KokkosKernels::default_layout, HandlePersistentMemorySpace>
212212
scalar_persistent_work_view2d_t;
213213
typedef typename scalar_persistent_work_view_t::HostMirror scalar_persistent_work_host_view_t; // Host view type
214214

@@ -532,7 +532,7 @@ class TwoStageGaussSeidelHandle
532532
using const_ordinal_t = typename const_entries_view_t::value_type;
533533
using const_scalar_t = typename const_values_view_t::value_type;
534534

535-
using vector_view_t = Kokkos::View<scalar_t **, default_layout, device_t>;
535+
using vector_view_t = Kokkos::View<scalar_t **, KokkosKernels::default_layout, device_t>;
536536

537537
using GSHandle = GaussSeidelHandle<input_size_t, input_ordinal_t, input_scalar_t, ExecutionSpace,
538538
TemporaryMemorySpace, PersistentMemorySpace>;

0 commit comments

Comments
 (0)