ScaLAPACK 2.1
2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_CargFtoC.c
Go to the documentation of this file.
1
/* ---------------------------------------------------------------------
2
*
3
* -- PBLAS auxiliary routine (version 2.0) --
4
* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5
* and University of California, Berkeley.
6
* April 1, 1998
7
*
8
* ---------------------------------------------------------------------
9
*/
10
/*
11
* Include files
12
*/
13
#include "../pblas.h"
14
#include "../PBpblas.h"
15
#include "../PBtools.h"
16
#include "../PBblacs.h"
17
#include "../PBblas.h"
18
19
#ifdef __STDC__
20
void
PB_CargFtoC
(
int
IF,
int
JF,
int
* DESCIN,
int
* IC,
int
* JC,
21
int
* DESCOUT )
22
#else
23
void
PB_CargFtoC
( IF, JF, DESCIN, IC, JC, DESCOUT )
24
/*
25
* .. Scalar Arguments ..
26
*/
27
int
IF, JF, * IC, * JC;
28
/*
29
* .. Array Arguments ..
30
*/
31
int
* DESCIN, * DESCOUT;
32
#endif
33
{
34
/*
35
* Purpose
36
* =======
37
*
38
* PB_CargFtoC converts a descriptor DESCIN of type BLOCK_CYCLIC_2D
39
* or BLOCK_CYCLIC_INB_2D into a descriptor DESCOUT of type
40
* BLOCK_CYCLIC_INB_2D.
41
*
42
* Notes
43
* =====
44
*
45
* A description vector is associated with each 2D block-cyclicly dis-
46
* tributed matrix. This vector stores the information required to
47
* establish the mapping between a matrix entry and its corresponding
48
* process and memory location.
49
*
50
* In the following comments, the character _ should be read as
51
* "of the distributed matrix". Let A be a generic term for any 2D
52
* block cyclicly distributed matrix. Its description vector is DESCA:
53
*
54
* NOTATION STORED IN EXPLANATION
55
* ---------------- --------------- -----------------------------------
56
* DTYPE_A (global) DESCA( DTYPE1_ ) The descriptor type.
57
* CTXT_A (global) DESCA( CTXT1_ ) The BLACS context handle indicating
58
* the NPROW x NPCOL BLACS process
59
* grid A is distributed over. The
60
* context itself is global, but the
61
* handle (the integer value) may
62
* vary.
63
* M_A (global) DESCA( M1_ ) The number of rows in the distri-
64
* buted matrix A, M_A >= 0.
65
* N_A (global) DESCA( N1_ ) The number of columns in the dis-
66
* tributed matrix A, N_A >= 0.
67
* MB_A (global) DESCA( MB1_ ) The blocking factor used to distri-
68
* bute the rows of A, MB_A > 0.
69
* NB_A (global) DESCA( NB1_ ) The blocking factor used to distri-
70
* bute the columns of A, NB_A > 0.
71
* RSRC_A (global) DESCA( RSRC1_ ) The process row over which the
72
* first row of the matrix A is dis-
73
* tributed, NPROW > RSRC_A >= 0.
74
* CSRC_A (global) DESCA( CSRC1_ ) The process column over which the
75
* first column of A is distributed.
76
* NPCOL > CSRC_A >= 0.
77
* LLD_A (local) DESCA( LLD1_ ) The leading dimension of the local
78
* array storing the local blocks of
79
* the distributed matrix A,
80
* IF( Lc( 1, N_A ) > 0 )
81
* LLD_A >= MAX( 1, Lr( 1, M_A ) )
82
* ELSE
83
* LLD_A >= 1.
84
*
85
* Let K be the number of rows of a matrix A starting at the global in-
86
* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
87
* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
88
* receive if these K rows were distributed over NPROW processes. If K
89
* is the number of columns of a matrix A starting at the global index
90
* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
91
* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
92
* these K columns were distributed over NPCOL processes.
93
*
94
* The values of Lr() and Lc() may be determined via a call to the func-
95
* tion PB_Cnumroc:
96
* Lr( IA, K ) = PB_Cnumroc( K, IA, MB_A, MB_A, MYROW, RSRC_A, NPROW )
97
* Lc( JA, K ) = PB_Cnumroc( K, JA, NB_A, NB_A, MYCOL, CSRC_A, NPCOL )
98
*
99
* A description vector is associated with each 2D block-cyclicly dis-
100
* tributed matrix. This vector stores the information required to
101
* establish the mapping between a matrix entry and its corresponding
102
* process and memory location.
103
*
104
* In the following comments, the character _ should be read as
105
* "of the distributed matrix". Let A be a generic term for any 2D
106
* block cyclicly distributed matrix. Its description vector is DESC_A:
107
*
108
* NOTATION STORED IN EXPLANATION
109
* ---------------- --------------- ------------------------------------
110
* DTYPE_A (global) DESCA[ DTYPE_ ] The descriptor type.
111
* CTXT_A (global) DESCA[ CTXT_ ] The BLACS context handle, indicating
112
* the NPROW x NPCOL BLACS process grid
113
* A is distributed over. The context
114
* itself is global, but the handle
115
* (the integer value) may vary.
116
* M_A (global) DESCA[ M_ ] The number of rows in the distribu-
117
* ted matrix A, M_A >= 0.
118
* N_A (global) DESCA[ N_ ] The number of columns in the distri-
119
* buted matrix A, N_A >= 0.
120
* IMB_A (global) DESCA[ IMB_ ] The number of rows of the upper left
121
* block of the matrix A, IMB_A > 0.
122
* INB_A (global) DESCA[ INB_ ] The number of columns of the upper
123
* left block of the matrix A,
124
* INB_A > 0.
125
* MB_A (global) DESCA[ MB_ ] The blocking factor used to distri-
126
* bute the last M_A-IMB_A rows of A,
127
* MB_A > 0.
128
* NB_A (global) DESCA[ NB_ ] The blocking factor used to distri-
129
* bute the last N_A-INB_A columns of
130
* A, NB_A > 0.
131
* RSRC_A (global) DESCA[ RSRC_ ] The process row over which the first
132
* row of the matrix A is distributed,
133
* NPROW > RSRC_A >= 0.
134
* CSRC_A (global) DESCA[ CSRC_ ] The process column over which the
135
* first column of A is distributed.
136
* NPCOL > CSRC_A >= 0.
137
* LLD_A (local) DESCA[ LLD_ ] The leading dimension of the local
138
* array storing the local blocks of
139
* the distributed matrix A,
140
* IF( Lc( 1, N_A ) > 0 )
141
* LLD_A >= MAX( 1, Lr( 1, M_A ) )
142
* ELSE
143
* LLD_A >= 1.
144
*
145
* Let K be the number of rows of a matrix A starting at the global in-
146
* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
147
* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
148
* receive if these K rows were distributed over NPROW processes. If K
149
* is the number of columns of a matrix A starting at the global index
150
* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
151
* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
152
* these K columns were distributed over NPCOL processes.
153
*
154
* The values of Lr() and Lc() may be determined via a call to the func-
155
* tion PB_Cnumroc:
156
* Lr( IA, K ) = PB_Cnumroc( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
157
* Lc( JA, K ) = PB_Cnumroc( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
158
*
159
* Arguments
160
* =========
161
*
162
* IF (global input) INTEGER
163
* On entry, IF specifies the global row Fortran index of the
164
* distributed subarray described by DESCIN. IF must be at least
165
* one.
166
*
167
* JF (global input) INTEGER
168
* On entry, JF specifies the global column Fortran index of
169
* the distributed subarray described by DESCIN. JF must be at
170
* least one.
171
*
172
* DESCIN (global and local input) INTEGER array
173
* On entry, DESCIN is an array of dimension DLEN1_ or DLEN_ as
174
* specified by its first entry DESCIN( DTYPE_ ). DESCIN is the
175
* source array descriptor of type BLOCK_CYCLIC_2D or of type
176
* BLOCK_CYCLIC_2D_INB.
177
*
178
* IC (global output) INTEGER
179
* On exit, IC specifies the global row C index of the distribu-
180
* ted subarray described by DESCOUT. IC = IF - 1, i.e IC is at
181
* least zero.
182
*
183
* JC (global output) INTEGER
184
* On entry, JC specifies the global column Fortran index of
185
* the distributed subarray described by DESCOUT. JC = JF - 1,
186
* i.e JC is at least zero.
187
*
188
* DESCOUT (global and local output) INTEGER array
189
* On entry, DESCOUT is an array of dimension DLEN_. DESCOUT is
190
* the target array descriptor of type BLOCK_CYCLIC_2D_INB.
191
*
192
* -- Written on April 1, 1998 by
193
* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
194
*
195
* ---------------------------------------------------------------------
196
*/
197
/* ..
198
* .. Executable Statements ..
199
*
200
*/
201
*IC = IF - 1;
202
*JC = JF - 1;
203
204
if
( DESCIN[
DTYPE_
] ==
BLOCK_CYCLIC_2D
)
205
{
206
DESCOUT[
DTYPE_
] =
BLOCK_CYCLIC_2D_INB
;
207
DESCOUT[
M_
] = DESCIN[
M1_
];
208
DESCOUT[
N_
] = DESCIN[
N1_
];
209
DESCOUT[
IMB_
] = DESCIN[
MB1_
];
210
DESCOUT[
INB_
] = DESCIN[
NB1_
];
211
DESCOUT[
MB_
] = DESCIN[
MB1_
];
212
DESCOUT[
NB_
] = DESCIN[
NB1_
];
213
DESCOUT[
RSRC_
] = DESCIN[
RSRC1_
];
214
DESCOUT[
CSRC_
] = DESCIN[
CSRC1_
];
215
DESCOUT[
CTXT_
] = DESCIN[
CTXT1_
];
216
DESCOUT[
LLD_
] = DESCIN[
LLD1_
];
217
}
218
else
if
( DESCIN[
DTYPE_
] ==
BLOCK_CYCLIC_2D_INB
)
219
{
220
DESCOUT[
DTYPE_
] =
BLOCK_CYCLIC_2D_INB
;
221
DESCOUT[
M_
] = DESCIN[
M_
];
222
DESCOUT[
N_
] = DESCIN[
N_
];
223
DESCOUT[
IMB_
] = DESCIN[
IMB_
];
224
DESCOUT[
INB_
] = DESCIN[
INB_
];
225
DESCOUT[
MB_
] = DESCIN[
MB_
];
226
DESCOUT[
NB_
] = DESCIN[
NB_
];
227
DESCOUT[
RSRC_
] = DESCIN[
RSRC_
];
228
DESCOUT[
CSRC_
] = DESCIN[
CSRC_
];
229
DESCOUT[
CTXT_
] = DESCIN[
CTXT_
];
230
DESCOUT[
LLD_
] = DESCIN[
LLD_
];
231
}
232
else
233
{
234
DESCOUT[
DTYPE_
] = DESCIN[0];
235
DESCOUT[
CTXT_
] = DESCIN[1];
236
DESCOUT[
M_
] = 0;
237
DESCOUT[
N_
] = 0;
238
DESCOUT[
IMB_
] = 1;
239
DESCOUT[
INB_
] = 1;
240
DESCOUT[
MB_
] = 1;
241
DESCOUT[
NB_
] = 1;
242
DESCOUT[
RSRC_
] = 0;
243
DESCOUT[
CSRC_
] = 0;
244
DESCOUT[
LLD_
] = 1;
245
}
246
/*
247
* End of PB_CargFtoC
248
*/
249
}
M_
#define M_
Definition:
PBtools.h:39
MB_
#define MB_
Definition:
PBtools.h:43
CTXT1_
#define CTXT1_
Definition:
PBtools.h:23
NB_
#define NB_
Definition:
PBtools.h:44
CSRC_
#define CSRC_
Definition:
PBtools.h:46
MB1_
#define MB1_
Definition:
PBtools.h:26
PB_CargFtoC
void PB_CargFtoC(int IF, int JF, int *DESCIN, int *IC, int *JC, int *DESCOUT)
Definition:
PB_CargFtoC.c:23
CSRC1_
#define CSRC1_
Definition:
PBtools.h:29
RSRC1_
#define RSRC1_
Definition:
PBtools.h:28
LLD_
#define LLD_
Definition:
PBtools.h:47
BLOCK_CYCLIC_2D_INB
#define BLOCK_CYCLIC_2D_INB
Definition:
PBtools.h:35
IMB_
#define IMB_
Definition:
PBtools.h:41
RSRC_
#define RSRC_
Definition:
PBtools.h:45
DTYPE_
#define DTYPE_
Definition:
PBtools.h:37
N_
#define N_
Definition:
PBtools.h:40
INB_
#define INB_
Definition:
PBtools.h:42
NB1_
#define NB1_
Definition:
PBtools.h:27
BLOCK_CYCLIC_2D
#define BLOCK_CYCLIC_2D
Definition:
PBtools.h:20
M1_
#define M1_
Definition:
PBtools.h:24
CTXT_
#define CTXT_
Definition:
PBtools.h:38
LLD1_
#define LLD1_
Definition:
PBtools.h:30
N1_
#define N1_
Definition:
PBtools.h:25
PBLAS
SRC
PTOOLS
PB_CargFtoC.c
Generated by
1.8.16