46 #ifndef MUELU_LWGRAPH_KOKKOS_DEF_HPP
47 #define MUELU_LWGRAPH_KOKKOS_DEF_HPP
49 #include <Kokkos_Core.hpp>
51 #include <Teuchos_ArrayView.hpp>
59 template<
class LocalOrdinal,
class RowType>
60 class MaxNumRowEntriesFunctor {
62 MaxNumRowEntriesFunctor(RowType rowPointers) :
rowPointers_(rowPointers) { }
64 KOKKOS_INLINE_FUNCTION
65 void operator()(
const LocalOrdinal i,
size_t& maxLength)
const {
68 maxLength = (d > maxLength ? d : maxLength);
71 KOKKOS_INLINE_FUNCTION
72 void join(
volatile size_t& dest,
const volatile size_t& src) {
73 dest = (dest > src ? dest : src);
76 KOKKOS_INLINE_FUNCTION
77 void init(
size_t& initValue) {
87 template<
class LocalOrdinal,
class GlobalOrdinal,
class DeviceType>
88 LWGraph_kokkos<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosDeviceWrapperNode<DeviceType>>::
89 LWGraph_kokkos(
const local_graph_type& graph,
90 const RCP<const map_type>& domainMap,
91 const RCP<const map_type>& importMap,
92 const std::string& objectLabel)
93 : graph_(graph), domainMap_(domainMap), importMap_(importMap), objectLabel_(objectLabel)
95 minLocalIndex_ = domainMap_->getMinLocalIndex();
96 maxLocalIndex_ = domainMap_->getMaxLocalIndex();
98 MaxNumRowEntriesFunctor<LO,typename local_graph_type::row_map_type> maxNumRowEntriesFunctor(graph_.row_map);
99 Kokkos::parallel_reduce(
"MueLu:LWGraph:LWGraph:maxnonzeros", range_type(0,graph_.numRows()), maxNumRowEntriesFunctor, maxNumRowEntries_);
104 #endif // MUELU_LWGRAPH_KOKKOS_DEF_HPP
void parallel_reduce(const std::string &label, const PolicyType &policy, const FunctorType &functor, ReturnType &return_value, typename Impl::enable_if< Kokkos::Impl::is_execution_policy< PolicyType >::value >::type *=0)