3
4
5
6
7
8
9
10 INTEGER ICSRC, ICTXT, INFO, IRSRC, LLD, M, MB, N, NB
11
12
13 INTEGER DESC( * )
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 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
129 $ LLD_, MB_, M_, NB_, N_, RSRC_
130 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
131 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
132 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
133
134
135 INTEGER MYCOL, MYROW, NPCOL, NPROW
136
137
138 EXTERNAL blacs_gridinfo,
pxerbla
139
140
141 INTEGER NUMROC
143
144
146
147
148
149
150
151 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
152
153 info = 0
154 IF( m.LT.0 ) THEN
155 info = -2
156 ELSE IF( n.LT.0 ) THEN
157 info = -3
158 ELSE IF( mb.LT.1 ) THEN
159 info = -4
160 ELSE IF( nb.LT.1 ) THEN
161 info = -5
162 ELSE IF( irsrc.LT.0 .OR. irsrc.GE.nprow ) THEN
163 info = -6
164 ELSE IF( icsrc.LT.0 .OR. icsrc.GE.npcol ) THEN
165 info = -7
166 ELSE IF( nprow.EQ.-1 ) THEN
167 info = -8
168 ELSE IF( lld.LT.
max( 1,
numroc( m, mb, myrow, irsrc,
169 $ nprow ) ) ) THEN
170 info = -9
171 END IF
172
173 IF( info.NE.0 )
174 $
CALL pxerbla( ictxt,
'DESCINIT', -info )
175
176 desc( dtype_ ) = block_cyclic_2d
177 desc( m_ ) =
max( 0, m )
178 desc( n_ ) =
max( 0, n )
179 desc( mb_ ) =
max( 1, mb )
180 desc( nb_ ) =
max( 1, nb )
181 desc( rsrc_ ) =
max( 0,
min( irsrc, nprow-1 ) )
182 desc( csrc_ ) =
max( 0,
min( icsrc, npcol-1 ) )
183 desc( ctxt_ ) = ictxt
184 desc( lld_ ) =
max( lld,
max( 1,
numroc( desc( m_ ), desc( mb_ ),
185 $ myrow, desc( rsrc_ ), nprow ) ) )
186
187 RETURN
188
189
190
integer function numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pxerbla(ictxt, srname, info)