This source file includes following definitions.
- MPI_Op
- MPI_Op
- Init
- Free
- Reduce_local
- Is_commutative
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #if 0
22
23 inline
24 MPI::Op::Op() { }
25
26 inline
27 MPI::Op::Op(const MPI::Op& o) : pmpi_op(o.pmpi_op) { }
28
29 inline
30 MPI::Op::Op(MPI_Op o) : pmpi_op(o) { }
31
32 inline
33 MPI::Op::~Op() { }
34
35 inline
36 MPI::Op& MPI::Op::operator=(const MPI::Op& op) {
37 pmpi_op = op.pmpi_op; return *this;
38 }
39
40
41 inline bool
42 MPI::Op::operator== (const MPI::Op &a) {
43 return (bool)(pmpi_op == a.pmpi_op);
44 }
45
46 inline bool
47 MPI::Op::operator!= (const MPI::Op &a) {
48 return (bool)!(*this == a);
49 }
50
51
52 inline MPI::Op&
53 MPI::Op::operator= (const MPI_Op &i) { pmpi_op = i; return *this; }
54
55 inline
56 MPI::Op::operator MPI_Op () const { return pmpi_op; }
57
58
59
60
61
62 #else
63
64
65 inline
66 MPI::Op::Op() : mpi_op(MPI_OP_NULL) { }
67
68 inline
69 MPI::Op::Op(MPI_Op i) : mpi_op(i) { }
70
71 inline
72 MPI::Op::Op(const MPI::Op& op)
73 : mpi_op(op.mpi_op) { }
74
75 inline
76 MPI::Op::~Op()
77 {
78 #if 0
79 mpi_op = MPI_OP_NULL;
80 op_user_function = 0;
81 #endif
82 }
83
84 inline MPI::Op&
85 MPI::Op::operator=(const MPI::Op& op) {
86 mpi_op = op.mpi_op;
87 return *this;
88 }
89
90
91 inline bool
92 MPI::Op::operator== (const MPI::Op &a) { return (bool)(mpi_op == a.mpi_op); }
93
94 inline bool
95 MPI::Op::operator!= (const MPI::Op &a) { return (bool)!(*this == a); }
96
97
98 inline MPI::Op&
99 MPI::Op::operator= (const MPI_Op &i) { mpi_op = i; return *this; }
100
101 inline
102 MPI::Op::operator MPI_Op () const { return mpi_op; }
103
104
105
106
107 #endif
108
109
110
111
112
113 extern "C" void ompi_op_set_cxx_callback(MPI_Op op, MPI_User_function*);
114
115
116
117
118 inline void
119 MPI::Op::Init(MPI::User_function *func, bool commute)
120 {
121 (void)MPI_Op_create((MPI_User_function*) ompi_mpi_cxx_op_intercept,
122 (int) commute, &mpi_op);
123 ompi_op_set_cxx_callback(mpi_op, (MPI_User_function*) func);
124 }
125
126
127 inline void
128 MPI::Op::Free()
129 {
130 (void)MPI_Op_free(&mpi_op);
131 }
132
133
134 inline void
135 MPI::Op::Reduce_local(const void *inbuf, void *inoutbuf, int count,
136 const MPI::Datatype& datatype) const
137 {
138 (void)MPI_Reduce_local(const_cast<void*>(inbuf), inoutbuf, count,
139 datatype, mpi_op);
140 }
141
142
143 inline bool
144 MPI::Op::Is_commutative(void) const
145 {
146 int commute;
147 (void)MPI_Op_commutative(mpi_op, &commute);
148 return (bool) commute;
149 }