50 #ifndef _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
51 #define _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
53 #include <Kokkos_Core.hpp>
83 template <
typename User>
109 Kokkos::View<gno_t*, device_t> &ids,
110 Kokkos::View<scalar_t**, device_t> &
weights);
117 return idsView_.extent(0);
121 auto kokkosIds = idsView_.view_host();
122 ids = kokkosIds.data();
126 ids = idsView_.view_device();
130 return weightsView_.extent(1);
134 int idx = 0)
const override
136 auto h_wgts_2d = weightsView_.view_host();
138 wgt = Kokkos::subview(h_wgts_2d, Kokkos::ALL, idx).data();
143 wgts = weightsView_.template view<device_t>();
147 Kokkos::DualView<gno_t *, device_t> idsView_;
148 Kokkos::DualView<scalar_t **, device_t> weightsView_;
155 template <
typename User>
157 Kokkos::View<gno_t *, device_t> &ids,
158 Kokkos::View<scalar_t **, device_t> &
weights)
160 idsView_ = Kokkos::DualView<gno_t *, device_t>(
"idsView_", ids.extent(0));
161 Kokkos::deep_copy(idsView_.h_view, ids);
163 weightsView_ = Kokkos::DualView<scalar_t **, device_t>(
"weightsView_",
166 Kokkos::deep_copy(weightsView_.h_view, weights);
168 weightsView_.modify_host();
169 weightsView_.sync_host();
170 weightsView_.template sync<device_t>();
172 idsView_.modify_host();
173 idsView_.sync_host();
174 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.