14 #ifndef _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
15 #define _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
17 #include <Kokkos_Core.hpp>
47 template <
typename User>
73 Kokkos::View<gno_t*, device_t> &ids,
74 Kokkos::View<scalar_t**, device_t> &
weights);
81 return idsView_.extent(0);
85 auto kokkosIds = idsView_.view_host();
86 ids = kokkosIds.data();
90 ids = idsView_.view_device();
94 return weightsView_.extent(1);
98 int idx = 0)
const override
100 auto h_wgts_2d = weightsView_.view_host();
102 wgt = Kokkos::subview(h_wgts_2d, Kokkos::ALL, idx).data();
107 wgts = weightsView_.template view<device_t>();
111 Kokkos::DualView<gno_t *, device_t> idsView_;
112 Kokkos::DualView<scalar_t **, device_t> weightsView_;
119 template <
typename User>
121 Kokkos::View<gno_t *, device_t> &ids,
122 Kokkos::View<scalar_t **, device_t> &
weights)
124 idsView_ = Kokkos::DualView<gno_t *, device_t>(
"idsView_", ids.extent(0));
125 Kokkos::deep_copy(idsView_.h_view, ids);
127 weightsView_ = Kokkos::DualView<scalar_t **, device_t>(
"weightsView_",
130 Kokkos::deep_copy(weightsView_.h_view, weights);
132 weightsView_.modify_host();
133 weightsView_.sync_host();
134 weightsView_.template sync<device_t>();
136 idsView_.modify_host();
137 idsView_.sync_host();
138 idsView_.template sync<device_t>();
void getIDsKokkosView(Kokkos::View< const gno_t *, device_t > &ids) const override
IdentifierAdapter defines the interface for identifiers.
typename InputTraits< User >::scalar_t scalar_t
InputTraits< User >::scalar_t scalar_t
Defines the IdentifierAdapter interface.
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater...
This class represents a collection of global Identifiers and their associated weights, if any.
InputTraits< User >::part_t part_t
node_t::device_type device_t
typename InputTraits< User >::gno_t gno_t
InputTraits< User >::lno_t lno_t
BasicKokkosIdentifierAdapter(Kokkos::View< gno_t *, device_t > &ids, Kokkos::View< scalar_t **, device_t > &weights)
Constructor.
void getWeightsKokkosView(Kokkos::View< scalar_t **, device_t > &wgts) const override
Provide kokkos view of weights.
InputTraits< User >::node_t node_t
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
Provide pointer to a weight array with stride.
InputTraits< User >::gno_t gno_t
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
void getIDsView(const gno_t *&ids) const override
Provide a pointer to this process' identifiers.
This file defines the StridedData class.