6
7
8
9
10
11
12
13
14
15 CHARACTER UPLO
16 CHARACTER*(*) SUMMRY
17 INTEGER IAM,
18 $ LDBWVAL, LDNBRVAL, LDNBVAL, LDNRVAL, LDNVAL,
19 $ LDPVAL, LDQVAL, NGRIDS, NMAT, NNB, NNBR, NBW,
20 $ NPROCS, NNR, NOUT
21 REAL THRESH
22
23
24 INTEGER NBRVAL( LDNBRVAL ), NBVAL( LDNBVAL ),
25 $ NRVAL( LDNRVAL ), NVAL( LDNVAL ),
26 $ BWVAL( LDBWVAL),
27 $ PVAL( LDPVAL ), QVAL(LDQVAL), WORK( * )
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 INTEGER NIN
154 parameter( nin = 11 )
155
156
157 INTEGER I, ICTXT
158 CHARACTER*79 USRINFO
159 REAL EPS
160
161
162 EXTERNAL blacs_abort, blacs_get, blacs_gridexit,
163 $ blacs_gridinit, blacs_setup,
icopy, igebr2d,
164 $ igebs2d, sgebr2d, sgebs2d
165
166
167 LOGICAL LSAME
168 REAL PSLAMCH
170
171
173
174
175
176
177
178
179 IF( iam.EQ.0 ) THEN
180
181
182
183 OPEN( nin, file = 'BLLT.dat', status = 'OLD' )
184 READ( nin, fmt = * ) summry
185 summry = ' '
186
187
188
189 READ( nin, fmt = 9999 ) usrinfo
190
191
192
193 READ( nin, fmt = * ) summry
194 READ( nin, fmt = * ) nout
195 IF( nout.NE.0 .AND. nout.NE.6 )
196 $ OPEN( nout, file = summry, status = 'UNKNOWN' )
197
198
199
200
201
202 READ( nin, fmt = * ) uplo
203
204
205
206
207 READ( nin, fmt = * ) nmat
208 IF( nmat.LT.1 .OR. nmat.GT.ldnval ) THEN
209 WRITE( nout, fmt = 9994 ) 'N', ldnval
210 GO TO 20
211 END IF
212 READ( nin, fmt = * ) ( nval( i ), i = 1, nmat )
213
214
215
216 READ( nin, fmt = * ) nbw
217 nbw = 1
218 IF( nbw.LT.1 .OR. nbw.GT.ldbwval ) THEN
219 WRITE( nout, fmt = 9994 ) 'BW', ldbwval
220 GO TO 20
221 END IF
222 READ( nin, fmt = * ) ( bwval( i ), i = 1, nbw )
223
224
225
226 READ( nin, fmt = * ) nnb
227 IF( nnb.LT.1 .OR. nnb.GT.ldnbval ) THEN
228 WRITE( nout, fmt = 9994 ) 'NB', ldnbval
229 GO TO 20
230 END IF
231 READ( nin, fmt = * ) ( nbval( i ), i = 1, nnb )
232
233
234
235 READ( nin, fmt = * ) nnr
236 IF( nnr.LT.1 .OR. nnr.GT.ldnrval ) THEN
237 WRITE( nout, fmt = 9994 ) 'NRHS', ldnrval
238 GO TO 20
239 END IF
240 READ( nin, fmt = * ) ( nrval( i ), i = 1, nnr )
241
242
243
244 READ( nin, fmt = * ) nnbr
245 IF( nnbr.LT.1 .OR. nnbr.GT.ldnbrval ) THEN
246 WRITE( nout, fmt = 9994 ) 'NBRHS', ldnbrval
247 GO TO 20
248 END IF
249 READ( nin, fmt = * ) ( nbrval( i ), i = 1, nnbr )
250
251
252
253 READ( nin, fmt = * ) ngrids
254 IF( ngrids.LT.1 .OR. ngrids.GT.ldpval ) THEN
255 WRITE( nout, fmt = 9994 ) 'Grids', ldpval
256 GO TO 20
257 ELSE IF( ngrids.GT.ldqval ) THEN
258 WRITE( nout, fmt = 9994 ) 'Grids', ldqval
259 GO TO 20
260 END IF
261
262
263 DO 8738 i = 1, ngrids
264 pval( i ) = 1
265 8738 CONTINUE
266
267
268
269 READ( nin, fmt = * ) ( qval( i ), i = 1, ngrids )
270
271
272
273 READ( nin, fmt = * ) thresh
274
275
276
277 CLOSE( nin )
278
279
280
281
282 IF( nprocs.LT.1 ) THEN
283 nprocs = 0
284 DO 10 i = 1, ngrids
285 nprocs =
max( nprocs, pval( i )*qval( i ) )
286 10 CONTINUE
287 CALL blacs_setup( iam, nprocs )
288 END IF
289
290
291
292
293 CALL blacs_get( -1, 0, ictxt )
294 CALL blacs_gridinit( ictxt, 'Row-major', 1, nprocs )
295
296
297
299
300
301
302 CALL sgebs2d( ictxt, 'All', ' ', 1, 1, thresh, 1 )
303 i = 1
304 work( i ) = nmat
305 i = i+1
306 work( i ) = nbw
307 i = i+1
308 work( i ) = nnb
309 i = i+1
310 work( i ) = nnr
311 i = i+1
312 work( i ) = nnbr
313 i = i+1
314 work( i ) = ngrids
315 i = i+1
316 IF(
lsame( uplo,
'L' ) )
THEN
317 work( i ) = 1
318 ELSE
319 work( i ) = 2
320 END IF
321 i = i+1
322
323 CALL igebs2d( ictxt, 'All', ' ', 1, 1, i-1, 1 )
324
325 CALL igebs2d( ictxt, 'All', ' ', i-1, 1, work, i-1 )
326
327 i = 1
328 CALL icopy( nmat, nval, 1, work( i ), 1 )
329 i = i + nmat
330 CALL icopy( nbw, bwval, 1, work( i ), 1 )
331 i = i + nbw
332 CALL icopy( nnb, nbval, 1, work( i ), 1 )
333 i = i + nnb
334 CALL icopy( nnr, nrval, 1, work( i ), 1 )
335 i = i + nnr
336 CALL icopy( nnbr, nbrval, 1, work( i ), 1 )
337 i = i + nnbr
338 CALL icopy( ngrids, pval, 1, work( i ), 1 )
339 i = i + ngrids
340 CALL icopy( ngrids, qval, 1, work( i ), 1 )
341 i = i + ngrids
342 CALL igebs2d( ictxt, 'All', ' ', i-1, 1, work, i-1 )
343
344
345
346 WRITE( nout, fmt = 9999 )
347 $ 'SCALAPACK banded linear systems.'
348 WRITE( nout, fmt = 9999 ) usrinfo
349 WRITE( nout, fmt = * )
350 WRITE( nout, fmt = 9999 )
351 $ 'Tests of the parallel '//
352 $ 'complex single precision band matrix solve '
353 WRITE( nout, fmt = 9999 )
354 $ 'The following scaled residual '//
355 $ 'checks will be computed:'
356 WRITE( nout, fmt = 9999 )
357 $ ' Solve residual = ||Ax - b|| / '//
358 $ '(||x|| * ||A|| * eps * N)'
359 IF(
lsame( uplo,
'L' ) )
THEN
360 WRITE( nout, fmt = 9999 )
361 $ ' Factorization residual = ||A - LL''|| /'//
362 $ ' (||A|| * eps * N)'
363 ELSE
364 WRITE( nout, fmt = 9999 )
365 $ ' Factorization residual = ||A - U''U|| /'//
366 $ ' (||A|| * eps * N)'
367 END IF
368 WRITE( nout, fmt = 9999 )
369 $ 'The matrix A is randomly '//
370 $ 'generated for each test.'
371 WRITE( nout, fmt = * )
372 WRITE( nout, fmt = 9999 )
373 $ 'An explanation of the input/output '//
374 $ 'parameters follows:'
375 WRITE( nout, fmt = 9999 )
376 $ 'TIME : Indicates whether WALL or '//
377 $ 'CPU time was used.'
378
379 WRITE( nout, fmt = 9999 )
380 $ 'UPLO : Whether data represents ''Upper'//
381 $ ''' or ''Lower'' triangular portion of array A.'
382 WRITE( nout, fmt = 9999 )
383 $ 'TRANS : Whether solve is to be done with'//
384 $ ' ''Transpose'' of matrix A (T,C) or not (N).'
385 WRITE( nout, fmt = 9999 )
386 $ 'N : The number of rows and columns '//
387 $ 'in the matrix A.'
388 WRITE( nout, fmt = 9999 )
389 $ 'bw : The number of diagonals '//
390 $ 'in the matrix A.'
391 WRITE( nout, fmt = 9999 )
392 $ 'NB : The size of the column panels the'//
393 $ ' matrix A is split into. [-1 for default]'
394 WRITE( nout, fmt = 9999 )
395 $ 'NRHS : The total number of RHS to solve'//
396 $ ' for.'
397 WRITE( nout, fmt = 9999 )
398 $ 'NBRHS : The number of RHS to be put on '//
399 $ 'a column of processes before going'
400 WRITE( nout, fmt = 9999 )
401 $ ' on to the next column of processes.'
402 WRITE( nout, fmt = 9999 )
403 $ 'P : The number of process rows.'
404 WRITE( nout, fmt = 9999 )
405 $ 'Q : The number of process columns.'
406 WRITE( nout, fmt = 9999 )
407 $ 'THRESH : If a residual value is less than'//
408 $ ' THRESH, CHECK is flagged as PASSED'
409 WRITE( nout, fmt = 9999 )
410 $ 'Fact time: Time in seconds to factor the'//
411 $ ' matrix'
412 WRITE( nout, fmt = 9999 )
413 $ 'Sol Time: Time in seconds to solve the'//
414 $ ' system.'
415 WRITE( nout, fmt = 9999 )
416 $ 'MFLOPS : Rate of execution for factor '//
417 $ 'and solve using sequential operation count.'
418 WRITE( nout, fmt = 9999 )
419 $ 'MFLOP2 : Rough estimate of speed '//
420 $ 'using actual op count (accurate big P,N).'
421 WRITE( nout, fmt = * )
422 WRITE( nout, fmt = 9999 )
423 $ 'The following parameter values will be used:'
424 WRITE( nout, fmt = 9999 )
425 $ ' UPLO : '//uplo
426 WRITE( nout, fmt = 9996 )
427 $
'N ', ( nval(i), i = 1,
min(nmat, 10) )
428 IF( nmat.GT.10 )
429 $ WRITE( nout, fmt = 9997 ) ( nval(i), i = 11, nmat )
430 WRITE( nout, fmt = 9996 )
431 $
'bw ', ( bwval(i), i = 1,
min(nbw, 10) )
432 IF( nbw.GT.10 )
433 $ WRITE( nout, fmt = 9997 ) ( bwval(i), i = 11, nbw )
434 WRITE( nout, fmt = 9996 )
435 $
'NB ', ( nbval(i), i = 1,
min(nnb, 10) )
436 IF( nnb.GT.10 )
437 $ WRITE( nout, fmt = 9997 ) ( nbval(i), i = 11, nnb )
438 WRITE( nout, fmt = 9996 )
439 $
'NRHS ', ( nrval(i), i = 1,
min(nnr, 10) )
440 IF( nnr.GT.10 )
441 $ WRITE( nout, fmt = 9997 ) ( nrval(i), i = 11, nnr )
442 WRITE( nout, fmt = 9996 )
443 $
'NBRHS', ( nbrval(i), i = 1,
min(nnbr, 10) )
444 IF( nnbr.GT.10 )
445 $ WRITE( nout, fmt = 9997 ) ( nbrval(i), i = 11, nnbr )
446 WRITE( nout, fmt = 9996 )
447 $
'P ', ( pval(i), i = 1,
min(ngrids, 10) )
448 IF( ngrids.GT.10 )
449 $ WRITE( nout, fmt = 9997) ( pval(i), i = 11, ngrids )
450 WRITE( nout, fmt = 9996 )
451 $
'Q ', ( qval(i), i = 1,
min(ngrids, 10) )
452 IF( ngrids.GT.10 )
453 $ WRITE( nout, fmt = 9997 ) ( qval(i), i = 11, ngrids )
454 WRITE( nout, fmt = * )
455 WRITE( nout, fmt = 9995 ) eps
456 WRITE( nout, fmt = 9998 ) thresh
457
458 ELSE
459
460
461
462 IF( nprocs.LT.1 )
463 $ CALL blacs_setup( iam, nprocs )
464
465
466
467
468 CALL blacs_get( -1, 0, ictxt )
469 CALL blacs_gridinit( ictxt, 'Row-major', 1, nprocs )
470
471
472
474
475 CALL sgebr2d( ictxt, 'All', ' ', 1, 1, thresh, 1, 0, 0 )
476 CALL igebr2d( ictxt, 'All', ' ', 1, 1, i, 1, 0, 0 )
477 CALL igebr2d( ictxt, 'All', ' ', i, 1, work, i, 0, 0 )
478 i = 1
479 nmat = work( i )
480 i = i+1
481 nbw = work( i )
482 i = i+1
483 nnb = work( i )
484 i = i+1
485 nnr = work( i )
486 i = i+1
487 nnbr = work( i )
488 i = i+1
489 ngrids = work( i )
490 i = i+1
491 IF( work( i ) .EQ. 1 ) THEN
492 uplo = 'L'
493 ELSE
494 uplo = 'U'
495 END IF
496 i = i+1
497
498 i = nmat + nbw + nnb + nnr + nnbr + 2*ngrids
499
500 CALL igebr2d( ictxt, 'All', ' ', 1, i, work, 1, 0, 0 )
501 i = 1
502 CALL icopy( nmat, work( i ), 1, nval, 1 )
503 i = i + nmat
504 CALL icopy( nbw, work( i ), 1, bwval, 1 )
505 i = i + nbw
506 CALL icopy( nnb, work( i ), 1, nbval, 1 )
507 i = i + nnb
508 CALL icopy( nnr, work( i ), 1, nrval, 1 )
509 i = i + nnr
510 CALL icopy( nnbr, work( i ), 1, nbrval, 1 )
511 i = i + nnbr
512 CALL icopy( ngrids, work( i ), 1, pval, 1 )
513 i = i + ngrids
514 CALL icopy( ngrids, work( i ), 1, qval, 1 )
515
516 END IF
517
518 CALL blacs_gridexit( ictxt )
519
520 RETURN
521
522 20 WRITE( nout, fmt = 9993 )
523 CLOSE( nin )
524 IF( nout.NE.6 .AND. nout.NE.0 )
525 $ CLOSE( nout )
526
527 CALL blacs_abort( ictxt, 1 )
528 stop
529
530 9999 FORMAT( a )
531 9998 FORMAT( 'Routines pass computational tests if scaled residual ',
532 $ 'is less than ', g12.5 )
533 9997 FORMAT( ' ', 10i6 )
534 9996 FORMAT( 2x, a5, ': ', 10i6 )
535 9995 FORMAT( 'Relative machine precision (eps) is taken to be ',
536 $ e18.6 )
537 9994 FORMAT( ' Number of values of ',5a, ' is less than 1 or greater ',
538 $ 'than ', i2 )
539 9993 FORMAT( ' Illegal input in file ',40a,'. Aborting run.' )
540
541
542
subroutine icopy(n, sx, incx, sy, incy)
real function pslamch(ictxt, cmach)