File: shmem_collect32.3

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (263 lines) | stat: -rw-r--r-- 8,431 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
.\" Man page generated from reStructuredText.
.
.TH "SHMEM_COLLECT32" "3" "May 30, 2025" "" "Open MPI"
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.sp
shmem_collect4(3), shmem_collect8(3), \fI\%shmem_collect32\fP(3),
\fI\%shmem_collect64\fP(3), shmem_fcollect(3), shmem_fcollect4(3), shmem_fcollect8(3), \fI\%shmem_fcollect32\fP(3),
\fI\%shmem_fcollect64\fP(3) \- Concatenates blocks of data from
multiple processing elements (PEs) to an array in every PE
.SH SYNOPSIS
.sp
C or C++:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include <mpp/shmem.h>

void shmem_collect32(void *target, const void *source,
  size_t nelems, int PE_start, int logPE_stride, int PE_size,
  long *pSync)

void shmem_collect64(void *target, const void *source,
  size_t nelems, int PE_start, int logPE_stride, int PE_size,
  long *pSync)

void shmem_fcollect32(void *target, const void *source,
  size_t nelems, int PE_start, int logPE_stride, int PE_size,
  long *pSync)

void shmem_fcollect64(void *target, const void *source,
  size_t nelems, int PE_start, int logPE_stride, int PE_size,
  long *pSync)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Fortran:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
INCLUDE "mpp/shmem.fh"

INTEGER nelems
INTEGER PE_start, logPE_stride, PE_size
INTEGER pSync(SHMEM_COLLECT_SYNC_SIZE)

CALL SHMEM_COLLECT4(target, source, nelems, PE_start,
& logPE_stride, PE_size, pSync)

CALL SHMEM_COLLECT8(target, source, nelems, PE_start,
& logPE_stride, PE_size, pSync)

CALL SHMEM_FCOLLECT4(target, source, nelems, PE_start,
& logPE_stride, PE_size, pSync)

CALL SHMEM_FCOLLECT8(target, source, nelems, PE_start,
& logPE_stride, PE_size, pSync)
.ft P
.fi
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
The shared memory (SHMEM) collect and fcollect routines concatenate
nelems 64\-bit or 32\-bit data items from the source array into the target
array, over the set of PEs defined by PE_start, log2PE_stride, and
PE_size, in processor number order. The resultant target array contains
the contribution from PE PE_start first, then the contribution from PE
PE_start + PE_stride second, and so on. The collected result is written
to the target array for all PEs in the active set.
.sp
The fcollect routines require that nelems be the same value in all
participating PEs, while the collect routines allow nelems to vary from
PE to PE.
.sp
The resulting target array is as follows:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
   source(1..nelems)
       from PE (PE_start + 0 * (2**logPE_stride))
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
   source(1..nelems)
       from PE (PE_start + 1 * (2**logPE_stride))
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
   ...
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
   source(1..nelems) from
       PE (PE_start + (PE_size \- 1) * (2**logPE_stride))
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
As with all SHMEM collective routines, each of these routines assumes
that only PEs in the active set call the routine. If a PE not in the
active set calls a SHMEM collective routine, undefined behavior results.
.sp
The arguments are as follows:
.INDENT 0.0
.TP
.B target
A symmetric array. The target argument must be large enough to accept
the concatenation of the source arrays on all PEs. The data types are
as follows:
.INDENT 7.0
.TP
.B [shmem_collect8, \fI\%shmem_collect64\fP, shmem_fcollect8, and
shmem_fcollect64] any data type with an element size of 64 bits.
Fortran derived types, Fortran character type, and C/C++
structures are not permitted.
.TP
.B [shmem_collect4, \fI\%shmem_collect32\fP, shmem_fcollect4, and
shmem_fcollect32] any data type with an element size of 32 bits.
Fortran derived types, Fortran character type, and C/C++
structures are not permitted.
.UNINDENT
.TP
.B source
A symmetric data object that can be of any type permissible for the
target argument.
.TP
.B nelems
The number of elements in the source array. nelems must be of type
integer. If you are using Fortran, it must be a default integer
value.
.TP
.B PE_start
The lowest virtual PE number of the active set of PEs. PE_start must
be of type integer. If you are using Fortran, it must be a default
integer value.
.TP
.B logPE_stride
The log (base 2) of the stride between consecutive virtual PE numbers
in the active set. logPE_stride must be of type integer. If you are
using Fortran, it must be a default integer value.
.TP
.B PE_size
The number of PEs in the active set. PE_size must be of type integer.
If you are using Fortran, it must be a default integer value.
.TP
.B pSync
A symmetric work array. In C/C++, pSync must be of type int and size
_SHMEM_COLLECT_SYNC_SIZE. In Fortran, pSync must be of type integer
and size SHMEM_COLLECT_SYNC_SIZE. If you are using Fortran, it must
be a default integer value. Every element of this array must be
initialized with the value _SHMEM_SYNC_VALUE in C/C++ or
SHMEM_SYNC_VALUE in Fortran before any of the PEs in the active set
enter shmem_barrier().
.UNINDENT
.sp
The values of arguments PE_start, logPE_stride, and PE_size must be
equal on all PEs in the active set. The same target and source arrays
and the same pSync work array must be passed to all PEs in the active
set.
.sp
Upon return from a collective routine, the following are true for the
local PE: The target array is updated. The values in the pSync array are
restored to the original values.
.SH NOTES
.sp
The terms collective and symmetric are defined in \fIintro_shmem\fP(3).
All SHMEM collective routines reset the values in pSync before they
return, so a particular pSync buffer need only be initialized the first
time it is used.
.sp
You must ensure that the pSync array is not being updated on any PE in
the active set while any of the PEs participate in processing of a SHMEM
collective routine. Be careful to avoid these situations: If the pSync
array is initialized at run time, some type of synchronization is needed
to ensure that all PEs in the working set have initialized pSync before
any of them enter a SHMEM routine called with the pSync synchronization
array. A pSync array can be reused on a subsequent SHMEM collective
routine only if none of the PEs in the active set are still processing a
prior SHMEM collective routine call that used the same pSync array. In
general, this may be ensured only by doing some type of synchronization.
However, in the special case of SHMEM routines being called with the
same active set, you can allocate two pSync arrays and alternate between
them on successive calls.
.sp
The collective routines operate on active PE sets that have a
non\-power\-of\-two PE_size with some performance degradation. They operate
with no performance degradation when nelems is a non\-power\-of\-two value.
.SH EXAMPLES
.sp
C/C++:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
for (i=0; i < _SHMEM_COLLECT_SYNC_SIZE; i++) {
  pSync[i] = _SHMEM_SYNC_VALUE;
}
shmem_barrier_all(); /* Wait for all PEs to initialize pSync */
shmem_collect32(target, source, 64, pe_start, logPE_stride,
   pe_size, pSync);
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Fortran:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
INTEGER PSYNC(SHMEM_COLLECT_SYNC_SIZE)
DATA PSYNC /SHMEM_COLLECT_SYNC_SIZE*SHMEM_SYNC_VALUE/

CALL SHMEM_COLLECT4(TARGET, SOURCE, 64, PE_START,
& LOGPE_STRIDE, PE_SIZE, PSYNC)
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
\fBSEE ALSO:\fP
.INDENT 0.0
.INDENT 3.5
\fIintro_shmem\fP(3)
.UNINDENT
.UNINDENT
.SH COPYRIGHT
2003-2025, The Open MPI Community
.\" Generated by docutils manpage writer.
.