Zoltan2
Toggle main menu visibility
Loading...
Searching...
No Matches
Zoltan2_BasicKokkosIdentifierAdapter.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Zoltan2: A package of combinatorial algorithms for scientific computing
4
//
5
// Copyright 2012 NTESS and the Zoltan2 contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
13
14
#ifndef _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
15
#define _ZOLTAN2_BASICKOKKOSIDENTIFIERADAPTER_HPP_
16
17
#include <Kokkos_Core.hpp>
18
#include <
Zoltan2_IdentifierAdapter.hpp
>
19
#include <
Zoltan2_StridedData.hpp
>
20
21
using
Kokkos::ALL;
22
23
namespace
Zoltan2
{
24
47
template
<
typename
User>
48
class
BasicKokkosIdentifierAdapter
:
public
IdentifierAdapter
<User> {
49
50
public
:
51
typedef
typename
InputTraits<User>::scalar_t
scalar_t
;
52
typedef
typename
InputTraits<User>::lno_t
lno_t
;
53
typedef
typename
InputTraits<User>::gno_t
gno_t
;
54
typedef
typename
InputTraits<User>::part_t
part_t
;
55
typedef
typename
InputTraits<User>::node_t
node_t
;
56
typedef
typename
node_t::device_type
device_t
;
57
typedef
User
user_t
;
58
72
BasicKokkosIdentifierAdapter
(
73
Kokkos::View<gno_t*, device_t> &ids,
74
Kokkos::View<scalar_t**, device_t> &
weights
);
75
77
// The Adapter interface.
79
80
size_t
getLocalNumIDs
()
const override
{
81
return
idsView_.extent(0);
82
}
83
84
void
getIDsView
(
const
gno_t
*&ids)
const override
{
85
auto
kokkosIds = idsView_.view_host();
86
ids = kokkosIds.data();
87
}
88
89
void
getIDsKokkosView
(Kokkos::View<const gno_t *, device_t> &ids)
const override
{
90
ids = idsView_.view_device();
91
}
92
93
int
getNumWeightsPerID
()
const override
{
94
return
weightsView_.extent(1);
95
}
96
97
void
getWeightsView
(
const
scalar_t
*&wgt,
int
&stride,
98
int
idx = 0)
const override
99
{
100
auto
h_wgts_2d = weightsView_.view_host();
101
102
wgt = Kokkos::subview(h_wgts_2d, Kokkos::ALL, idx).data();
103
stride = 1;
104
}
105
106
void
getWeightsKokkosView
(Kokkos::View<scalar_t **, device_t> &wgts)
const override
{
107
wgts = weightsView_.template view<device_t>();
108
}
109
110
private
:
111
Kokkos::DualView<gno_t *, device_t> idsView_;
112
Kokkos::DualView<scalar_t **, device_t> weightsView_;
113
};
114
116
// Definitions
118
119
template
<
typename
User>
120
BasicKokkosIdentifierAdapter<User>::BasicKokkosIdentifierAdapter
(
121
Kokkos::View<gno_t *, device_t> &ids,
122
Kokkos::View<scalar_t **, device_t> &
weights
)
123
{
124
idsView_ = Kokkos::DualView<gno_t *, device_t>(
"idsView_"
, ids.extent(0));
125
Kokkos::deep_copy(idsView_.view_host(), ids);
126
127
weightsView_ = Kokkos::DualView<scalar_t **, device_t>(
"weightsView_"
,
128
weights
.extent(0),
129
weights
.extent(1));
130
Kokkos::deep_copy(weightsView_.view_host(),
weights
);
131
132
weightsView_.modify_host();
133
weightsView_.sync_host();
134
weightsView_.template sync<device_t>();
135
136
idsView_.modify_host();
137
idsView_.sync_host();
138
idsView_.template sync<device_t>();
139
}
140
141
}
//namespace Zoltan2
142
143
#endif
Zoltan2_IdentifierAdapter.hpp
Defines the IdentifierAdapter interface.
Zoltan2_StridedData.hpp
This file defines the StridedData class.
Zoltan2::BasicKokkosIdentifierAdapter::getWeightsKokkosView
void getWeightsKokkosView(Kokkos::View< scalar_t **, device_t > &wgts) const override
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:106
Zoltan2::BasicKokkosIdentifierAdapter::getIDsView
void getIDsView(const gno_t *&ids) const override
Provide a pointer to this process' identifiers.
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:84
Zoltan2::BasicKokkosIdentifierAdapter::part_t
InputTraits< User >::part_t part_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:54
Zoltan2::BasicKokkosIdentifierAdapter::BasicKokkosIdentifierAdapter
BasicKokkosIdentifierAdapter(Kokkos::View< gno_t *, device_t > &ids, Kokkos::View< scalar_t **, device_t > &weights)
Constructor.
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:120
Zoltan2::BasicKokkosIdentifierAdapter::scalar_t
InputTraits< User >::scalar_t scalar_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:51
Zoltan2::BasicKokkosIdentifierAdapter::gno_t
InputTraits< User >::gno_t gno_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:53
Zoltan2::BasicKokkosIdentifierAdapter::getNumWeightsPerID
int getNumWeightsPerID() const override
Returns the number of weights per object. Number of weights per object should be zero or greater....
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:93
Zoltan2::BasicKokkosIdentifierAdapter::device_t
node_t::device_type device_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:56
Zoltan2::BasicKokkosIdentifierAdapter::getIDsKokkosView
void getIDsKokkosView(Kokkos::View< const gno_t *, device_t > &ids) const override
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:89
Zoltan2::BasicKokkosIdentifierAdapter::node_t
InputTraits< User >::node_t node_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:55
Zoltan2::BasicKokkosIdentifierAdapter::getWeightsView
void getWeightsView(const scalar_t *&wgt, int &stride, int idx=0) const override
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:97
Zoltan2::BasicKokkosIdentifierAdapter::user_t
User user_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:57
Zoltan2::BasicKokkosIdentifierAdapter::getLocalNumIDs
size_t getLocalNumIDs() const override
Returns the number of objects on this process.
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:80
Zoltan2::BasicKokkosIdentifierAdapter::lno_t
InputTraits< User >::lno_t lno_t
Definition
Zoltan2_BasicKokkosIdentifierAdapter.hpp:52
Zoltan2::IdentifierAdapter
IdentifierAdapter defines the interface for identifiers.
Definition
Zoltan2_IdentifierAdapter.hpp:60
Zoltan2
Created by mbenlioglu on Aug 31, 2020.
Definition
Zoltan2_AlgHybrid2GL.hpp:47
weights
static ArrayRCP< ArrayRCP< zscalar_t > > weights
Definition
partition/rcbPerformanceZ1.cpp:46
Zoltan2::InputTraits::gno_t
default_gno_t gno_t
The ordinal type (e.g., int, long, int64_t) that can represent global counts and identifiers.
Definition
Zoltan2_InputTraits.hpp:151
Zoltan2::InputTraits::node_t
default_node_t node_t
The Kokkos node type. This is only meaningful for users of Tpetra objects.
Definition
Zoltan2_InputTraits.hpp:164
Zoltan2::InputTraits::lno_t
default_lno_t lno_t
The ordinal type (e.g., int, long, int64_t) that represents local counts and local indices.
Definition
Zoltan2_InputTraits.hpp:146
Zoltan2::InputTraits::part_t
default_part_t part_t
The data type to represent part numbers.
Definition
Zoltan2_InputTraits.hpp:159
Zoltan2::InputTraits::scalar_t
default_scalar_t scalar_t
The data type for weights and coordinates.
Definition
Zoltan2_InputTraits.hpp:141
core
src
input
Zoltan2_BasicKokkosIdentifierAdapter.hpp
Generated by
1.17.0