50 #ifndef _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
51 #define _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
53 #include <Kokkos_Core.hpp>
83 template <
typename User>
108 Kokkos::View<gno_t*, typename node_t::device_type> &ids,
109 Kokkos::View<scalar_t**, typename node_t::device_type> &
weights);
116 return idsView_.extent(0);
120 auto kokkosIds = idsView_.view_host();
121 ids = kokkosIds.data();
125 typename node_t::device_type> &ids)
const override {
126 ids = idsView_.template view<typename node_t::device_type>();
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 typename node_t::device_type> &wgts)
const override {
144 wgts = weightsView_.template view<typename node_t::device_type>();
148 Kokkos::DualView<gno_t *> idsView_;
149 Kokkos::DualView<scalar_t **> weightsView_;
156 template <
typename User>
158 Kokkos::View<gno_t *, typename node_t::device_type> &ids,
159 Kokkos::View<scalar_t **, typename node_t::device_type> &
weights)
161 idsView_ = Kokkos::DualView<gno_t *>(
"idsView_", ids.extent(0));
162 Kokkos::deep_copy(idsView_.h_view, ids);
164 weightsView_ = Kokkos::DualView<scalar_t **>(
"weightsView_",
weights.extent(0),
weights.extent(1));
165 Kokkos::deep_copy(weightsView_.h_view,
weights);
167 weightsView_.modify_host();
168 weightsView_.sync_host();
169 weightsView_.template sync<typename node_t::device_type>();
171 idsView_.modify_host();
172 idsView_.sync_host();
173 idsView_.template sync<typename node_t::device_type>();
Defines the IdentifierAdapter interface.
This file defines the StridedData class.
InputTraits< User >::scalar_t scalar_t
InputTraits< User >::gno_t gno_t
This class represents a collection of global Identifiers and their associated weights,...
void getIDsKokkosView(Kokkos::View< const gno_t *, typename node_t::device_type > &ids) const override
Provide a Kokkos view to this process' identifiers.
void getIDsView(const gno_t *&ids) const override
Provide a pointer to this process' identifiers.
InputTraits< User >::part_t part_t
InputTraits< User >::scalar_t scalar_t
InputTraits< User >::gno_t gno_t
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater....
InputTraits< User >::node_t node_t
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
void getWeightsKokkosView(Kokkos::View< scalar_t **, typename node_t::device_type > &wgts) const override
BasicKokkosIdentifierAdapter(Kokkos::View< gno_t *, typename node_t::device_type > &ids, Kokkos::View< scalar_t **, typename node_t::device_type > &weights)
Constructor.
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
InputTraits< User >::lno_t lno_t
IdentifierAdapter defines the interface for identifiers.
Created by mbenlioglu on Aug 31, 2020.