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
.TH P_BExchange 3 "10/19/2001" " " "ParLib 1.1"
.SH NAME
P_BExchange \- Performs blocking boundary exchange
.SH SYNOPSIS
.nf
\fB#include "parlib.h"\fR
\fBint P_BExchange(\fR void *arr, int ndims, int *stride, int *blklen,
int bdim, int overlap[2], MPI_Datatype datatype,
MPI_Comm comm, int period \fB)\fR
.fi
.SH INPUT PARAMETERS
.PD 0
.TP
.B arr
- address of the local part of communicated array (choice)
.PD 1
.PD 0
.TP
.B ndims
- number of dimensions of the array (positive integer)
.PD 1
.PD 0
.TP
.B stride
- dimensions of the array (array of
.I ndims
positive integers)
.PD 1
.PD 0
.TP
.B blklen
- sizes of communicated blocks (array of \fIndims\fR positive integers)
.PD 1
.PD 0
.TP
.B bdim
- decomposed dimension of the array \fIarr\fR (integer from the range [1,\fIndims\fR])
.PD 1
.PD 0
.TP
.B overlap
- thickness of boundaries (array of 2 nonnegative integers)
.PD 1
.PD 0
.TP
.B datatype
- datatype of each array element (MPI handle)
.PD 1
.PD 0
.TP
.B comm
- communicator (MPI handle)
.PD 1
.PD 0
.TP
.B period
- logical variable specifying weather the boundary exchange is periodic (true) or not (false)
.SH DESCRIPTION
The routine exchanges interprocessor boundaries of array \fIarr\fR, whose dimension \fIbdim\fR is distributed among \fInproc\fR processors of the group defined by communicator \fIcomm\fR.
We will use Matlab notations for indexes of array \fIarr\fR specifying only the index corresponding to dimension \fIbdim\fR while assuming implicitly the others to be \fI1:blklen(idim)\fR, where \fIidim\fR is the dimension number.
The exchange is performed as follows.
If the processor \fIiproc\fR is not the first processor of the group, it sends \fIarr(1:overlap(1))\fR to processor \fIiproc-1\fR.
Similarly, if it is not the last one, it sends \fIarr(blklen(bdim)-overlap(2)+1:blklen(bdim))\fR to processor \fIiproc+1\fR.
If \fIperiod\fR is true, then the first processor also sends \fIarr(1:overlap(1))\fR to the last one and the last sends \fIarr(blklen(bdim)-overlap(2)+1:blklen(bdim))\fR to the first processor.
.SH NOTES FOR FORTRAN
All INM ParLib routines in Fortran have an additional argument \fIierr\fR
at the end of the argument list.
\fIierr\fR 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 \fIcall\fR 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 COUTION
Pointer \fIarr\fR should contain the address of the local part of the array that does not include the adjacent halo regions dedicated for the boundaries which have to be received from the neighbors.
.SH ERRORS
The routine returns the following error codes:
.RS 3
.TP
.PD 0
.TP
.B 0
- No error; the routine completed successfully.
.PD 1
.PD 0
.TP
.B 1
- Nonpositive number of dimensions.
.PD 1
.PD 0
.TP
.B 2
- Dimension
.I bdim
is out of range [1,\fIndims\fR].
.PD 1
.PD 0
.TP
.B 3
- Negative boundary thickness.
.PD 1
.PD 0
.TP
.B 4
- Nonpositive array dimension.
.PD 1
.PD 0
.TP
.B 5
- Boundary thickness exceeds the block size for dimension
.I
bdim
.SH SEE ALSO
\fBP_BExchange_init\fR(3), \fBP_BExchange_start\fR(3), \fBP_BExchange_end\fR(3), \fBP_BExchange_free\fR(3)
.SH AUTHOR
Val N. Gloukhov, gluhoff@inm.ras.ru