Newer
Older
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
.TH P_Transpose 3 "10/22/2001" " " "ParLib 1.1"
.SH NAME
P_Transpose \- Performs blocking transposition
.SH SYNOPSIS
.nf
\fB#include "parlib.h"\fR
\fBint P_Transpose(\fR int ndims, void *arr_source, int dim_source,
int *lblks_source, void *arr_dest, int dim_dest, int *lblks_dest,
int *stride, int *blklen, int *overlap, MPI_Datatype datatype,
MPI_Comm comm, int period \fB);\fR
.fi
.SH INPUT PARAMETERS
.PD 0
.TP
.B ndims
- number of dimensions of the arrays (positive integer)
.PD 1
.PD 0
.TP
.B arr_source
- address of the local part of the source array (choice)
.PD 1
.PD 0
.TP
.B dim_source
- decomposed dimension of array \fIarr_source\fR
.PD 1
.PD 0
.TP
.B lblks_source
- distribution of array \fIarr_source\fR
.PD 1
.PD 0
.TP
.B dim_dest
- decomposed dimension of array \fIarr_dest\fR
.PD 1
.PD 0
.TP
.B lblks_dest
- distribution of array \fIarr_dest\fR
.PD 1
.PD 0
.TP
.B stride, blklen
- parameters specifying dimensions of the arrays \fIarr_source\fR, \fIarr_dest\fR
and location of the communicated data within the arrays
.PD 1
.PD 0
.TP
.B overlap
- overlapping of the output array \fIarr_dest\fR
.PD 1
.PD 0
.TP
.B datatype
- data type of the arrays
.PD 1
.PD 0
.TP
.B comm
- communicator specifying the processor group
.PD 1
.PD 0
.TP
.B period
- true, if the overlapping is periodic, false otherwise (logical)
.SH OUTPUT PARAMETER
.PD 0
.TP
.B arr_dest
- address of the local part of the destination array (choice)
.SH DESCRIPTION
.PD 0
The routine performes a transposition of array \fIarr_source\fR storing the result in array \fIarr_dest\fR.
Both of the arrays should have the same number of dimensions \fIndims\fR.
Array \fIarr_source\fR have to be distriduted in dimension \fIdim_source\fR while array \fIarr_dest\fR in dimension \fIdim_dest\fR.
The dimensions and the location of the communicated data within the arrays are specified by parameters \fIstride\fR, \fIblklen\fR, \fIlblks_source\fR and \fIlblks_dest\fR.
We assume all indexes to be ranged from 1 in this manual.
The arrays have the following dimensions:
.nf
| regular dim | \fIdim_source\fR | \fIdim_dest\fR
-----------|-------------|--------------------|-----------------
\fIarr_source\fR | \fIstride\fR(dim) | \fIblklen\fR(\fIdim_source\fR) | \fIstride\fR(\fIdim_dest\fR)
\fIarr_dest\fR | \fIstride\fR(dim) | \fIstride\fR(\fIdim_source\fR) | \fIblklen\fR(\fIdim_dest\fR)
.fi
The following blocks of the arrays are communicated:
.nf
| regular dim | \fIdim_source\fR | \fIdim_dest\fR
-----------|-------------|---------------------|-------------------
\fIarr_source\fR |1:\fIblklen\fR(dim)|1:\fIlblks_source\fR(\fIiproc\fR)|1:\fBSUM\fR(\fIlblks_dest\fR)
\fIarr_dest\fR |1:\fIblklen\fR(dim)|1:\fBSUM\fR(\fIlblks_source\fR) |1:\fIlblks_dest\fR(\fIiproc\fR)
.fi
where the regular dimension is any dimension but \fIdim_source\fR and \fIdim_dest\fR, \fIiproc\fR is the processor number within the given group; \fBSUM\fR denotes the summation upon all processors of the group (e.g.,
.nf
\fBSUM\fR(\fIlblks_source\fR)=SUM(\fIlblks_source\fR(i),i=1,\fInproc\fR)),
.fi
\fInproc\fR is the number of processors in the group.
These blocks should be augmented by overlapped regions, if overlapping is taking place.
In the next section, we will assume that the first index corresponds to dimension \fIdim_source\fR while the second to dimension \fIdim_dest\fR. Then the transposition algorithm can be outlined as follows.
Processor \fIiproc\fR sends
.nf
\fIarr_source\fR(1:\fIlblks_source\fR(\fIiproc\fR),
\fIjb\fR(\fIjproc\fR)-overlap(1):\fIje\fR(\fIjproc\fR)+overlap(2))
.fi
to every processor \fIjproc\fR of the group including himself and receives
.nf
\fIarr_dest\fR(\fIib\fR(\fIjproc\fR):\fIie\fR(\fIjproc\fR),
1-overlap(1):\fIlblks_dest\fR(\fIiproc\fR)+overlap(2))
.fi
In the nonperiodic case (\fIperiod\fR is false), \fIoverlap\fR(1) is counted for 0, if \fIiproc\fR is equal to 1 as well as \fIoverlap\fR(2), if \fIiproc\fR is equal to \fInproc\fR.
Starting and ending indexes \fIib\fR, \fIie\fR, \fIjb\fR, \fIje\fR are calculated as follows
.nf
\fIib\fR(1)=1; \fIib\fR(i+1)=\fIib\fR(i)+\fIlblks_dest\fR(i),i=1,...,\fInproc\fR-1;
\fIie\fR(\fInproc\fR)=\fBSUM\fR(\fIlblks_dest\fR);
\fIie\fR(i-1)=\fIie\fR(i)-\fIlblks_dest\fR(i),i=\fInproc\fR,...,2;
.fi
.nf
\fIjb\fR(1)=1; \fIjb\fR(j+1)=\fIjb\fR(j)+\fIlblks_source\fR(j),j=1,...,\fInproc\fR-1;
\fIje\fR(\fInproc\fR)=\fBSUM\fR(\fIlblks_source\fR);
\fIje\fR(j-1)=\fIje\fR(j)-\fIlblks_source\fR(j),j=\fInproc\fR,...,2.
.fi
.SH NOTES
Transposition with overlapping is equiualent to transposition widthout overlapping and subsequent interprocessor boundary exchange applied to the resultant array \fIarr_dest\fR.
.SH NOTES FOR FORTRAN
All INM ParLib routines in Fortran have an additional argument
.I ierr
at the end of the argument list.
.I ierr
is an integer and has the same meaning as the return value of the routine
in C. In Fortran, INM ParLib routines are subroutines, and are invoked with the
.I call
statement.
All INM ParLib objects (e.g., \fIBExchange\fR, \fITransposition\fR) are \fIINTEGER\fR arrays of size \fIHANDLE_SIZE\fR in Fortran.
The parameter \fIHANDLE_SIZE\fR is defined in 'parlibf.h' which is recommended to be included in Fortran code beforehand.
.SH ERRORS
The routine returns the following error codes:
.RS 3
.TP
.PD 0
.TP 3
.B 0
- No error; the routine completed successfully.
.TP
.B 1
- Number of dimensions \fIndims\fR is less than 2.
.TP
.B 2
- \fIdim_source\fR is out of range [1,\fIndims\fR].
.TP
.B 3
- \fIdim_dest\fR is out of range [1,\fIndims\fR].
.TP
.B 4
- \fIdim_source\fR and \fIdim_dest\fR coincide.
.TP
.B 5
- Nonpositive array dimension.
.TP
.B 6
- Negative overlapping.
.TP
.B 7
- \fIblklen\fR exceeds \fIstride\fR.
.TP
.B 8
- \fIlblks_source\fR(\fIiproc\fR) exceeds \fIblklen\fR(\fIdim_source\fR).
.TP
.B 9
- \fIlblks_dest\fR(\fIiproc\fR) exceeds \fIblklen\fR(\fIdim_dest\fR).
.TP
.B 10
- \fBSUM\fR(\fIlblks_source\fR) exceeds \fIstride\fR(\fIdim_source\fR).
.TP
.B 11
- \fBSUM\fR(\fIlblks_dest\fR) exceeds \fIstride\fR(\fIdim_dest\fR).
.TP
.B 12
- \fIoverlap\fR(1) exceeds \fIlblks_dest\fR(1).
.TP
.B 13
- \fIoverlap\fR(2) exceeds \fIlblks_dest\fR(\fInproc\fR).
.TP
.B 14
- \fIlblks_source\fR is nonpositive.
.TP
.B 15
- \fIlblks_dest\fR is nonpositive.
.SH SEE ALSO
\fBP_Transpose_init\fR(3), \fBP_Transpose_start\fR(3), \fBP_Transpose_end\fR(3), \fBP_Transpose_free\fR(3)
.SH AUTHOR
Val N. Gloukhov, gluhoff@inm.ras.ru