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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
|
.\" Man page generated from reStructuredText.
.
.TH "SHMEM_ALLTOALL32" "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
\fI\%shmem_alltoall32\fP(3), \fI\%shmem_alltoall64\fP(3),
\fI\%shmem_alltoalls32\fP(3), \fI\%shmem_alltoalls64\fP(3) \- collective routine
where each PE exchanges a fixed amount of data with all other PEs in the
Active set
.SH SYNOPSIS
.sp
C or C++:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include <mpp/shmem.h>
void shmem_alltoall32(void *target, const void *source,
size_t nelems, int PE_start, int logPE_stride,
int PE_size, long *pSync)
void shmem_alltoall64(void *target, const void *source,
size_t nelems, int PE_start, int logPE_stride,
int PE_size, long *pSync)
void shmem_alltoalls32(void *target, const void *source,
ptrdiff_t dst, ptrdiff_t sst,
size_t nelems, int PE_start, int logPE_stride,
int PE_size, long *pSync)
void shmem_alltoalls64(void *target, const void *source,
ptrdiff_t dst, ptrdiff_t sst,
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 dst, sst, nelems, PE_root, PE_start, logPE_stride, PE_size
INTEGER pSync(SHMEM_ALLTOALL_SYNC_SIZE)
CALL SHMEM_ALLTOALL32(target, source, nelems,
& PE_start, logPE_stride, PE_size, fIpSync)
CALL SHMEM_ALLTOALL64(target, source, nelems,
& PE_start, logPE_stride, PE_size, pSync)
CALL SHMEM_ALLTOALLS32(target, source, dst, sst, nelems,
& PE_start, logPE_stride, PE_size, pSync)
CALL SHMEM_ALLTOALLS64(target, source, dst, sst, nelems,
& PE_start, logPE_stride, PE_size, pSync)
.ft P
.fi
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
The shmem_alltoalls routines are collective routines. Each PE in the
Active set exchanges nelems strided data elements of size 32 bits (for
shmem_alltoalls32) or 64 bits (for shmem_alltoalls64) with all other PEs
in the set. Both strides, dst and sst, must be greater than or equal to
1. The sst*jth block sent from PE i to PE j is placed in the dst*ith
block of the dest data object on PE j. As with all OpenSHMEM collective
routines, these routines assume that only PEs in the Active set call the
routine. If a PE not in the Active set calls an OpenSHMEM collective
routine, undefined behavior results. The values of arguments dst, sst,
nelems, PE_start, logPE_stride, and PE_size must be equal on all PEs in
the Active set. The same dest and source data objects, and the same
pSync work array must be passed to all PEs in the Active set. Before any
PE calls to a shmem_alltoalls routine, the following conditions must
exist (synchronization via a barrier or some other method is often
needed to ensure this): The pSync array on all PEs in the Active set is
not still in use from a prior call to a shmem_alltoalls routine. The
dest data object on all PEs in the Active set is ready to accept the
shmem_alltoalls data. Upon return from a shmem_alltoalls routine, the
following is true for the local PE: Its dest symmetric data object is
completely updated and the data has been copied out of the source data
object. The values in the pSync array are restored to the original
values.
.sp
The arguments are as follows:
.sp
A symmetric data object with one of the following data types:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.TP
.B \fI\%shmem_alltoall32\fP: Any noncharacter type that
has an element size of 32 bits. No Fortran derived types or C/C++
structures are allowed.
.TP
.B \fI\%shmem_alltoall64\fP: Any noncharacter type that has an element size
of 64 bits. No Fortran derived types or C/C++ structures are
allowed.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
target A symmetric data object large enough to receive the combined
total of nelems elements from each PE in the Active set.
.INDENT 0.0
.TP
.B source
A symmetric data object that contains nelems elements of data for
each PE in the Active set, ordered according to destination PE.
.TP
.B dst
The stride between consecutive elements of the dest data object. The
stride is scaled by the element size. A value of 1 indicates
contiguous data. dst must be of type ptrdiff_t. If you are using
Fortran, it must be a default integer value.
.TP
.B sst
The stride between consecutive elements of the source data object.
The stride is scaled by the element size. A value of 1 indicates
contiguous data. sst must be of type ptrdiff_t. If you are using
Fortran, it must be a default integer value.
.TP
.B nelems
The number of elements to exchange for each PE. nelems must be of
type size_t for C/C++. 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. log_PE_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 long and size
_SHMEM_ALLTOALL_SYNC_SIZE. In Fortran, pSync must be of type integer
and size SHMEM_ALLTOALL_SYNC_SIZE. 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
Upon return from a shmem_alltoalls routine, the following is true for
the local PE: Its dest symmetric data object is completely updated and
the data has been copied out of the source data object. The values in
the pSync array are restored to the original values.
.sp
The values of arguments PE_root, PE_start, logPE_stride, and PE_size
must be equal on all PEs in the active set. The same target and source
data objects and the same pSync work array must be passed to all PEs in
the active set.
.sp
Before any PE calls a alltoall routine, you must ensure that the
following conditions exist (synchronization via a barrier or some other
method is often needed to ensure this): The pSync array on all PEs in
the active set is not still in use from a prior call to a alltoall
routine. The target array on all PEs in the active set is ready to
accept the alltoall data.
.SH NOTES
.sp
The terms collective and symmetric are defined in \fIintro_shmem\fP(3).
.sp
All SHMEM alltoall routines restore pSync to its original contents.
Multiple calls to SHMEM routines that use the same pSync array do not
require that pSync be reinitialized after the first call.
.sp
You must ensure the that the pSync array is not being updated by any PE
in the active set while any of the PEs participates in processing of a
SHMEM broadcast 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 may be reused on a subsequent SHMEM
broadcast routine only if none of the PEs in the active set are still
processing a prior SHMEM alltoall routine call that used the same pSync
array. In general, this can 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.
.SH EXAMPLES
.sp
C/C++ example:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
#include <shmem.h>
#include <stdio.h>
long pSync[SHMEM_ALLTOALL_SYNC_SIZE];
int main(void)
{
int64_t *source, *dest;
int i, count, pe;
shmem_init();
count = 2;
dest = (int64_t*) shmem_malloc(count * shmem_n_pes() * sizeof(int64_t));
source = (int64_t*) shmem_malloc(count * shmem_n_pes() * sizeof(int64_t));
/* assign source values */
for (pe=0; pe <shmem_n_pes(); pe++){
for (i=0; i<count; i++){
source[(pe*count)+i] = shmem_my_pe() + pe;
dest[(pe*count)+i] = 9999;
}
}
for (i=0; i< SHMEM_ALLTOALLS_SYNC_SIZE; i++) {
pSync[i] = SHMEM_SYNC_VALUE;
}
/* wait for all PEs to initialize pSync */
shmem_barrier_all();
/* alltoalls on all PES */
shmem_alltoalls64(dest, source, 1, 1, count, 0, 0, shmem_n_pes(), pSync);
/* verify results */
for (pe=0; pe<shmem_n_pes(); pe++) {
for (i=0; i<count; i++){
if (dest[(pe*count)+i] != shmem_my_pe() + pe) {
printf("[%d] ERROR: dest[%d]=%ld, should be %d,
shmem_my_pe(),(pe*count)+i,dest[(pe*count)+i],
shmem_n_pes() + pe);
}
}
}
shmem_barrier_all();
shmem_free(dest);
shmem_free(source);
shmem_finalize();
return 0;
}
.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.
.
|