4
5
6
7
8
9
10
11 CHARACTER*( * ) SUMMRY
12 INTEGER IAM, LDNBVAL, LDNVAL, LDPVAL, LDQVAL, NGRIDS,
13 $ NMAT, NNB, NOUT, NPROCS
14 REAL THRESH
15
16
17 INTEGER NBVAL( LDNBVAL ), NVAL( LDNVAL ),
18 $ PVAL( LDPVAL ), QVAL( LDQVAL ), WORK( * )
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 INTEGER NIN
106 parameter( nin = 11 )
107
108
109 CHARACTER*79 USRINFO
110 INTEGER I, ICTXT
111 DOUBLE PRECISION EPS
112
113
114 EXTERNAL blacs_abort, blacs_get, blacs_gridexit,
115 $ blacs_gridinit, blacs_setup,
icopy, igebr2d,
116 $ igebs2d, sgebr2d, sgebs2d
117
118
119 DOUBLE PRECISION PDLAMCH
121
122
124
125
126
127
128
129
130 IF( iam.EQ.0 ) THEN
131
132
133
134 OPEN( nin, file = 'NEP.dat', status = 'OLD' )
135 READ( nin, fmt = * )summry
136 summry = ' '
137
138
139
140 READ( nin, fmt = 9999 )usrinfo
141
142
143
144 READ( nin, fmt = * )summry
145 READ( nin, fmt = * )nout
146 IF( nout.NE.0 .AND. nout.NE.6 )
147 $ OPEN( nout, file = summry, status = 'UNKNOWN' )
148
149
150
151
152
153 READ( nin, fmt = * )nmat
154 IF( nmat.LT.1 .OR. nmat.GT.ldnval ) THEN
155 WRITE( nout, fmt = 9994 )'N', ldnval
156 GO TO 30
157 END IF
158 READ( nin, fmt = * )( nval( i ), i = 1, nmat )
159
160
161
162 READ( nin, fmt = * )nnb
163 IF( nnb.GT.ldnbval ) THEN
164 WRITE( nout, fmt = 9994 )'NB', ldnbval
165 GO TO 30
166 END IF
167 READ( nin, fmt = * )( nbval( i ), i = 1, nnb )
168
169 DO 10 i = 1, nnb
170 IF( nbval( i ).LT.6 ) THEN
171 WRITE( nout, fmt = 9992 )nbval( i )
172 GO TO 30
173 END IF
174 10 CONTINUE
175
176
177
178 READ( nin, fmt = * )ngrids
179 IF( ngrids.LT.1 .OR. ngrids.GT.ldpval ) THEN
180 WRITE( nout, fmt = 9994 )'Grids', ldpval
181 GO TO 30
182 ELSE IF( ngrids.GT.ldqval ) THEN
183 WRITE( nout, fmt = 9994 )'Grids', ldqval
184 GO TO 30
185 END IF
186
187
188
189 READ( nin, fmt = * )( pval( i ), i = 1, ngrids )
190 READ( nin, fmt = * )( qval( i ), i = 1, ngrids )
191
192
193
194 READ( nin, fmt = * )thresh
195
196
197
198 CLOSE ( nin )
199
200
201
202
203 IF( nprocs.LT.1 ) THEN
204 nprocs = 0
205 DO 20 i = 1, ngrids
206 nprocs =
max( nprocs, pval( i )*qval( i ) )
207 20 CONTINUE
208 CALL blacs_setup( iam, nprocs )
209 END IF
210
211
212
213
214 CALL blacs_get( -1, 0, ictxt )
215 CALL blacs_gridinit( ictxt, 'Row-major', 1, nprocs )
216
217
218
220
221
222
223 CALL sgebs2d( ictxt, 'All', ' ', 1, 1, thresh, 1 )
224
225 work( 1 ) = nmat
226 work( 2 ) = nnb
227 work( 3 ) = ngrids
228 CALL igebs2d( ictxt, 'All', ' ', 3, 1, work, 3 )
229
230 i = 1
231 CALL icopy( nmat, nval, 1, work( i ), 1 )
232 i = i + nmat
233 CALL icopy( nnb, nbval, 1, work( i ), 1 )
234 i = i + nnb
235 CALL icopy( ngrids, pval, 1, work( i ), 1 )
236 i = i + ngrids
237 CALL icopy( ngrids, qval, 1, work( i ), 1 )
238 i = i + ngrids - 1
239 CALL igebs2d( ictxt, 'All', ' ', i, 1, work, i )
240
241
242
243 WRITE( nout, fmt = 9999 )
244 $ 'ScaLAPACK QSQ^T by Schur Decomposition.'
245 WRITE( nout, fmt = 9999 )usrinfo
246 WRITE( nout, fmt = * )
247 WRITE( nout, fmt = 9999 )'Tests of the parallel ' //
248 $ 'real double precision Schur decomposition.'
249 WRITE( nout, fmt = 9999 )'The following scaled residual ' //
250 $ 'checks will be computed:'
251 WRITE( nout, fmt = 9999 )
252 $ ' Residual = ||H-QSQ^T|| / ' //
253 $ '(||H|| * eps * N )'
254 WRITE( nout, fmt = 9999 )
255 $ ' Orthogonality residual = ||I - Q^TQ|| / ' // '( eps * N )'
256 WRITE( nout, fmt = 9999 )'The matrix A is randomly ' //
257 $ 'generated for each test.'
258 WRITE( nout, fmt = * )
259 WRITE( nout, fmt = 9999 )'An explanation of the input/output '
260 $ // 'parameters follows:'
261 WRITE( nout, fmt = 9999 )
262 $ 'TIME : Indicates whether WALL or ' //
263 $ 'CPU time was used.'
264
265 WRITE( nout, fmt = 9999 )
266 $ 'N : The number of columns in the ' // 'matrix A.'
267 WRITE( nout, fmt = 9999 )
268 $ 'NB : The size of the square blocks the' //
269 $ ' matrix A is split into.'
270 WRITE( nout, fmt = 9999 )
271 $ 'P : The number of process rows.'
272 WRITE( nout, fmt = 9999 )
273 $ 'Q : The number of process columns.'
274 WRITE( nout, fmt = 9999 )
275 $ 'THRESH : If a residual value is less than' //
276 $ ' THRESH, CHECK is flagged as PASSED'
277 WRITE( nout, fmt = 9999 )
278 $ 'NEP time : Time in seconds to decompose the ' // ' matrix'
279 WRITE( nout, fmt = 9999 )'MFLOPS : Rate of execution '
280 WRITE( nout, fmt = * )
281 WRITE( nout, fmt = 9999 )
282 $ 'The following parameter values will be used:'
283 WRITE( nout, fmt = 9996 )'N ',
284 $ ( nval( i ), i = 1,
min( nmat, 10 ) )
285 IF( nmat.GT.10 )
286 $ WRITE( nout, fmt = 9997 )( nval( i ), i = 11, nmat )
287 WRITE( nout, fmt = 9996 )'NB ',
288 $ ( nbval( i ), i = 1,
min( nnb, 10 ) )
289 IF( nnb.GT.10 )
290 $ WRITE( nout, fmt = 9997 )( nbval( i ), i = 11, nnb )
291 WRITE( nout, fmt = 9996 )'P ',
292 $ ( pval( i ), i = 1,
min( ngrids, 10 ) )
293 IF( ngrids.GT.10 )
294 $ WRITE( nout, fmt = 9997 )( pval( i ), i = 11, ngrids )
295 WRITE( nout, fmt = 9996 )'Q ',
296 $ ( qval( i ), i = 1,
min( ngrids, 10 ) )
297 IF( ngrids.GT.10 )
298 $ WRITE( nout, fmt = 9997 )( qval( i ), i = 11, ngrids )
299 WRITE( nout, fmt = * )
300 WRITE( nout, fmt = 9995 )eps
301 WRITE( nout, fmt = 9998 )thresh
302
303 ELSE
304
305
306
307 IF( nprocs.LT.1 )
308 $ CALL blacs_setup( iam, nprocs )
309
310
311
312
313 CALL blacs_get( -1, 0, ictxt )
314 CALL blacs_gridinit( ictxt, 'Row-major', 1, nprocs )
315
316
317
319
320 CALL sgebr2d( ictxt, 'All', ' ', 1, 1, thresh, 1, 0, 0 )
321 CALL igebr2d( ictxt, 'All', ' ', 3, 1, work, 3, 0, 0 )
322 nmat = work( 1 )
323 nnb = work( 2 )
324 ngrids = work( 3 )
325
326 i = nmat + nnb + 2*ngrids
327 CALL igebr2d( ictxt, 'All', ' ', i, 1, work, i, 0, 0 )
328 i = 1
329 CALL icopy( nmat, work( i ), 1, nval, 1 )
330 i = i + nmat
331 CALL icopy( nnb, work( i ), 1, nbval, 1 )
332 i = i + nnb
333 CALL icopy( ngrids, work( i ), 1, pval, 1 )
334 i = i + ngrids
335 CALL icopy( ngrids, work( i ), 1, qval, 1 )
336
337 END IF
338
339 CALL blacs_gridexit( ictxt )
340
341 RETURN
342
343 30 CONTINUE
344 WRITE( nout, fmt = 9993 )
345 CLOSE ( nin )
346 IF( nout.NE.6 .AND. nout.NE.0 )
347 $ CLOSE ( nout )
348 CALL blacs_abort( ictxt, 1 )
349
350 stop
351
352 9999 FORMAT( a )
353 9998 FORMAT( 'Routines pass computational tests if scaled residual ',
354 $ 'is less than ', g12.5 )
355 9997 FORMAT( ' ', 10i6 )
356 9996 FORMAT( 2x, a5, ' : ', 10i6 )
357 9995 FORMAT( 'Relative machine precision (eps) is taken to be ',
358 $ e18.6 )
359 9994 FORMAT( ' Number of values of ', 5a,
360 $ ' is less than 1 or greater ', 'than ', i2 )
361 9993 FORMAT( ' Illegal input in file ', 40a, '. Aborting run.' )
362 9992 FORMAT( ' Blocking size too small at ', i2, ' must be >=6.' )
363
364
365
subroutine icopy(n, sx, incx, sy, incy)
double precision function pdlamch(ictxt, cmach)