Support Software for Vector Reduction/Transformation Operators
Version of the Day
src
support
RTOpPack_SPMD_apply_op_decl.hpp
1
// @HEADER
2
// ***********************************************************************
3
//
4
// RTOp: Interfaces and Support Software for Vector Reduction Transformation
5
// Operations
6
// Copyright (2006) Sandia Corporation
7
//
8
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9
// license for use of this work by or on behalf of the U.S. Government.
10
//
11
// Redistribution and use in source and binary forms, with or without
12
// modification, are permitted provided that the following conditions are
13
// met:
14
//
15
// 1. Redistributions of source code must retain the above copyright
16
// notice, this list of conditions and the following disclaimer.
17
//
18
// 2. Redistributions in binary form must reproduce the above copyright
19
// notice, this list of conditions and the following disclaimer in the
20
// documentation and/or other materials provided with the distribution.
21
//
22
// 3. Neither the name of the Corporation nor the names of the
23
// contributors may be used to endorse or promote products derived from
24
// this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
//
38
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
39
//
40
// ***********************************************************************
41
// @HEADER
42
43
#ifndef RTOPPACK_SPMD_APPLY_OP_DECL_HPP
44
#define RTOPPACK_SPMD_APPLY_OP_DECL_HPP
45
46
#include "RTOpPack_RTOpT.hpp"
47
#include "Teuchos_Serializer.hpp"
48
#include "Teuchos_ReductionOp.hpp"
49
50
51
namespace
Teuchos {
template
<
typename
Ordinal>
class
Comm; }
52
53
54
// Enable this by hand to enable showing the dump of the RTOp
55
#define RTOPPACK_ENABLE_SHOW_DUMP
56
57
58
#ifdef RTOP_DEBUG
59
# define RTOPPACK_ENABLE_SHOW_DUMP
60
#endif
61
62
63
namespace
RTOpPack {
64
65
73
void
set_SPMD_apply_op_dump_out(
const
RCP<FancyOStream> &dumpOut);
74
75
#ifdef RTOPPACK_ENABLE_SHOW_DUMP
76
RTOP_DEPRECATED
extern
bool
show_spmd_apply_op_dump;
77
#endif // RTOPPACK_ENABLE_SHOW_DUMP
78
79
85
template
<
class
PrimitiveScalar>
86
int
serializedSize(
87
int
num_values
88
,
int
num_indexes
89
,
int
num_chars
90
);
91
92
97
template
<
class
Scalar>
98
void
serialize(
99
const
RTOpT<Scalar> &op,
100
Ordinal num_values,
101
Ordinal num_indexes,
102
Ordinal num_chars,
103
const
ReductTarget &reduct_obj,
104
char
reduct_obj_ext[]
105
);
106
107
112
template
<
class
Scalar>
113
void
deserialize(
114
const
RTOpT<Scalar> &op,
115
int
num_values,
116
int
num_indexes,
117
int
num_chars,
118
const
char
reduct_obj_ext[],
119
ReductTarget *reduct_obj
120
);
121
122
127
template
<
class
Scalar>
128
class
ReductTargetSerializer
:
public
Teuchos::Serializer
<index_type,ReductTarget> {
129
public
:
131
ReductTargetSerializer
(
132
const
Teuchos::RCP
<
const
RTOpT<Scalar>
> &op
133
);
137
index_type
getBufferSize
(
const
index_type count)
const
;
139
void
serialize
(
140
const
index_type count
141
,
const
ReductTarget
*
const
reduct_objs[]
142
,
const
index_type bytes
143
,
char
charBuffer[]
144
)
const
;
146
Teuchos::RCP<ReductTarget>
createObj
()
const
;
148
void
deserialize
(
149
const
index_type bytes
150
,
const
char
charBuffer[]
151
,
const
index_type count
152
,
ReductTarget
*
const
reduct_objs[]
153
)
const
;
155
private
:
156
Teuchos::RCP<const RTOpT<Scalar>
> op_;
157
int
num_values_;
158
int
num_indexes_;
159
int
num_chars_;
160
int
reduct_obj_ext_size_;
161
// Not defined and not to be called!
162
ReductTargetSerializer
();
163
ReductTargetSerializer
& operator=(
const
ReductTargetSerializer
&);
164
};
165
166
171
template
<
class
Scalar>
172
class
ReductTargetReductionOp
173
:
public
Teuchos::ReferenceTypeReductionOp
<Teuchos_Ordinal,ReductTarget>
174
{
175
public
:
177
typedef
Teuchos_Ordinal
Ordinal
;
179
ReductTargetReductionOp
(
180
const
Teuchos::RCP
<
const
RTOpT<Scalar>
> &op
181
);
185
void
reduce
(
186
const
Ordinal
count
187
,
const
ReductTarget
*
const
inBuffer[]
188
,
ReductTarget
*
const
inoutBuffer[]
189
)
const
;
191
private
:
192
Teuchos::RCP<const RTOpT<Scalar>
> op_;
193
// Not defined and not to be called!
194
ReductTargetReductionOp
();
195
ReductTargetReductionOp<Scalar>
(
const
ReductTargetReductionOp<Scalar>
&);
196
ReductTargetReductionOp<Scalar>
& operator=(
const
ReductTargetReductionOp<Scalar>
&);
197
};
198
199
206
template
<
class
Scalar>
207
void
SPMD_all_reduce(
208
const
Teuchos::Comm<index_type>
*comm
209
,
const
RTOpT<Scalar>
&op
210
,
const
int
num_cols
211
,
const
ReductTarget
*
const
i_reduct_objs[]
212
,
ReductTarget
*
const
reduct_objs[]
213
);
214
215
223
template
<
class
Scalar>
224
void
SPMD_apply_op(
225
const
Teuchos::Comm<index_type>
*comm
226
,
const
RTOpT<Scalar>
&op
227
,
const
int
num_vecs
228
,
const
ConstSubVectorView<Scalar>
sub_vecs[]
229
,
const
int
num_targ_vecs
230
,
const
SubVectorView<Scalar>
targ_sub_vecs[]
231
,
ReductTarget
*reduct_obj
232
);
233
234
242
template
<
class
Scalar>
243
void
SPMD_apply_op(
244
const
Teuchos::Comm<index_type>
*comm
245
,
const
RTOpT<Scalar>
&op
246
,
const
int
num_cols
247
,
const
int
num_multi_vecs
248
,
const
ConstSubMultiVectorView<Scalar>
sub_multi_vecs[]
249
,
const
int
num_targ_multi_vecs
250
,
const
SubMultiVectorView<Scalar>
targ_sub_multi_vecs[]
251
,
ReductTarget
*
const
reduct_objs[]
252
);
253
254
262
template
<
class
Scalar>
263
void
SPMD_apply_op(
264
const
Teuchos::Comm<index_type>
*comm
265
,
const
RTOpT<Scalar>
&op
266
,
const
int
num_cols
267
,
const
int
num_vecs
268
,
const
ConstSubVectorView<Scalar>
sub_vecs[]
269
,
const
int
num_targ_vecs
270
,
const
SubVectorView<Scalar>
sub_targ_vecs[]
271
,
ReductTarget
*
const
reduct_objs[]
272
);
273
274
275
}
// end namespace RTOpPack
276
277
278
#endif // RTOPPACK_SPMD_APPLY_OP_DECL_HPP
RTOpPack::ReductTargetSerializer::createObj
Teuchos::RCP< ReductTarget > createObj() const
Definition:
RTOpPack_SPMD_apply_op_def.hpp:251
Teuchos::Serializer
Teuchos::ReferenceTypeReductionOp
RTOpPack::ReductTargetSerializer::getBufferSize
index_type getBufferSize(const index_type count) const
Definition:
RTOpPack_SPMD_apply_op_def.hpp:219
RTOpPack::ConstSubVectorView
RTOpPack::SubMultiVectorView
RTOpPack::ReductTargetReductionOp::Ordinal
Teuchos_Ordinal Ordinal
Definition:
RTOpPack_SPMD_apply_op_decl.hpp:177
Teuchos::RCP
RTOpPack::ReductTargetSerializer
Serializer subclass for ReductTarget objects.
Definition:
RTOpPack_SPMD_apply_op_decl.hpp:128
RTOpPack::ReductTargetSerializer::deserialize
void deserialize(const index_type bytes, const char charBuffer[], const index_type count, ReductTarget *const reduct_objs[]) const
Definition:
RTOpPack_SPMD_apply_op_def.hpp:257
RTOpPack::ReductTargetReductionOp::reduce
void reduce(const Ordinal count, const ReductTarget *const inBuffer[], ReductTarget *const inoutBuffer[]) const
Definition:
RTOpPack_SPMD_apply_op_def.hpp:294
RTOpPack::SubVectorView
RTOpPack::RTOpT< Scalar >
RTOpPack::ReductTarget
RTOpPack::ConstSubMultiVectorView
Teuchos::Comm
Definition:
RTOpPack_SPMD_apply_op_decl.hpp:51
RTOpPack::ReductTargetSerializer::serialize
void serialize(const index_type count, const ReductTarget *const reduct_objs[], const index_type bytes, char charBuffer[]) const
Definition:
RTOpPack_SPMD_apply_op_def.hpp:226
RTOpPack::ReductTargetReductionOp
ReductionOp subclass for ReductTarget objects.
Definition:
RTOpPack_SPMD_apply_op_decl.hpp:172
Generated by
1.8.16