MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_LWGraph_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_LWGRAPH_DEF_HPP
11#define MUELU_LWGRAPH_DEF_HPP
12
13#include "MueLu_LWGraph_kokkos.hpp"
15
16namespace MueLu {
17
18template <class LocalOrdinal, class GlobalOrdinal, class Node>
19RCP<MueLu::LWGraph_kokkos<LocalOrdinal, GlobalOrdinal, Node> > MueLu::LWGraph<LocalOrdinal, GlobalOrdinal, Node>::copyToDevice() {
20 // This could be improved to skip copies for UVM.
21
22 auto graph = this->getGraph();
23
25 auto rows = typename dev_crs_graph_type::local_graph_device_type::row_map_type::non_const_type("rows", graph.numRows() + 1);
26 auto entries = typename dev_crs_graph_type::local_graph_device_type::entries_type::non_const_type("columns", graph.entries.extent(0));
27 Kokkos::deep_copy(rows, graph.row_map);
28 Kokkos::deep_copy(entries, graph.entries);
29
31 auto graph_d = local_graph_type_device(entries, rows);
32
33 auto lw_d = rcp(new MueLu::LWGraph_kokkos<LocalOrdinal, GlobalOrdinal, Node>(graph_d, this->GetDomainMap(), this->GetImportMap(), this->getObjectLabel()));
34
36
37 auto bndry = this->GetBoundaryNodeMap();
38 auto bndry_d = bndry_nodes_type("boundary_nodes", bndry.extent(0));
39 Kokkos::deep_copy(bndry_d, bndry);
40 lw_d->SetBoundaryNodeMap(bndry_d);
41
42 return lw_d;
43}
44
45} // namespace MueLu
46
47#endif // MUELU_LWGRAPH_DEF_HPP
typename std::conditional< OnHost, typename local_graph_device_type::HostMirror, local_graph_device_type >::type local_graph_type
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > crs_graph_type
Kokkos::View< bool *, memory_space > boundary_nodes_type
Lightweight MueLu representation of a compressed row storage graph.
RCP< MueLu::LWGraph_kokkos< LocalOrdinal, GlobalOrdinal, Node > > copyToDevice()
Namespace for MueLu classes and methods.