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