60 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
61 $ lld_, mb_, m_, nb_, n_, rsrc_
62 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
63 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
64 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
65 INTEGER realsz, totmem, memsiz, ntests
67 parameter( realsz = 4, totmem = 2000000,
68 $ memsiz = totmem / realsz, ntests = 20,
69 $ padval = -9923.0e+0 )
76 INTEGER i, iam, iaseed, ictxt, imidpad, info, ipa, ipd,
77 $ ipe, ipostpad, iprepad, ipt, ipw, itemp, j, k,
78 $ kfail, kpass, kskip, ktests, lcm, lwork, mycol,
79 $ myrow, n, nb, ndiag, ngrids, nmat, nnb, noffd,
80 $ nout, np, npcol, nprocs, nprow, nq, worksiz,
82 REAL anorm, fresid, thresh
83 DOUBLE PRECISION nops, tmflops
86 INTEGER desca( dlen_ ), ierr( 1 ), nbval( ntests ),
87 $ nval( ntests ), pval( ntests ), qval( ntests )
89 DOUBLE PRECISION ctime( 1 ), wtime( 1 )
92 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
93 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
109 DATA ktests, kpass, kfail, kskip / 4*0 /
113 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
117 CALL blacs_pinfo( iam, nprocs )
119 CALL pstrdinfo( outfile, nout, uplo, nmat, nval, ntests, nnb,
120 $ nbval, ntests, ngrids, pval, ntests, qval, ntests,
121 $ thresh, mem, iam, nprocs )
122 check = ( thresh.GE.0.0e+0 )
127 WRITE( nout, fmt = * )
128 WRITE( nout, fmt = 9995 )
129 WRITE( nout, fmt = 9994 )
130 WRITE( nout, fmt = * )
143 IF( nprow.LT.1 )
THEN
145 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
147 ELSE IF( npcol.LT.1 )
THEN
149 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
151 ELSE IF( nprow*npcol.GT.nprocs )
THEN
153 $
WRITE( nout, fmt = 9998 )nprow*npcol, nprocs
157 IF( ierr( 1 ).GT.0 )
THEN
159 $
WRITE( nout, fmt = 9997 )
'grid'
166 CALL blacs_get( -1, 0, ictxt )
167 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
168 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
172 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
184 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
190 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
192 IF( ierr( 1 ).GT.0 )
THEN
194 $
WRITE( nout, fmt = 9997 )
'matrix'
211 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
216 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
218 IF( ierr( 1 ).GT.0 )
THEN
220 $
WRITE( nout, fmt = 9997 )
'NB'
227 np =
numroc( n, nb, myrow, 0, nprow )
228 nq =
numroc( n, nb, mycol, 0, npcol )
230 iprepad =
max( nb, np )
232 ipostpad =
max( nb, nq )
241 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
242 $
max( 1, np )+imidpad, ierr( 1 ) )
246 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
248 IF( ierr( 1 ).LT.0 )
THEN
250 $
WRITE( nout, fmt = 9997 )
'descriptor'
259 IF(
lsame( uplo,
'U' ) )
THEN
262 noffd =
numroc( n-1, nb, mycol, 0, npcol )
266 ipd = ipa + desca( lld_ )*nq + ipostpad + iprepad
267 ipe = ipd + ndiag + ipostpad + iprepad
268 ipt = ipe + noffd + ipostpad + iprepad
269 ipw = ipt + nq + ipostpad + iprepad
274 lwork =
max( nb*( np+1 ), 3*nb )
275 worktrd = lwork + ipostpad
282 IF( nprow.NE.npcol )
THEN
283 lcm =
ilcm( nprow, npcol )
284 itemp = nb*
iceil(
iceil( np, nb ), lcm / nprow ) +
287 itemp =
max( itemp, 2*( nb+np )*nb )
288 worksiz =
max( lwork, itemp ) + ipostpad
294 IF( ipw+worksiz.GT.memsiz )
THEN
296 $
WRITE( nout, fmt = 9996 )
'Tridiagonal reduction',
297 $ ( ipw+worksiz )*realsz
303 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
305 IF( ierr( 1 ).GT.0 )
THEN
307 $
WRITE( nout, fmt = 9997 )
'MEMORY'
314 CALL psmatgen( ictxt,
'Symm',
'N', desca( m_ ),
315 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
316 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
317 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
318 $ myrow, mycol, nprow, npcol )
323 CALL psfillpad( ictxt, np, nq, mem( ipa-iprepad ),
324 $ desca( lld_ ), iprepad, ipostpad,
326 CALL psfillpad( ictxt, ndiag, 1, mem( ipd-iprepad ),
327 $ ndiag, iprepad, ipostpad, padval )
328 CALL psfillpad( ictxt, noffd, 1, mem( ipe-iprepad ),
329 $ noffd, iprepad, ipostpad, padval )
330 CALL psfillpad( ictxt, nq, 1, mem( ipt-iprepad ), nq,
331 $ iprepad, ipostpad, padval )
332 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
333 $ mem( ipw-iprepad ), worksiz-ipostpad,
334 $ iprepad, ipostpad, padval )
335 anorm =
pslansy(
'I', uplo, n, mem( ipa ), 1, 1,
336 $ desca, mem( ipw ) )
337 CALL pschekpad( ictxt,
'PSLANSY', np, nq,
338 $ mem( ipa-iprepad ), desca( lld_ ),
339 $ iprepad, ipostpad, padval )
340 CALL pschekpad( ictxt,
'PSLANSY', worksiz-ipostpad, 1,
341 $ mem( ipw-iprepad ), worksiz-ipostpad,
342 $ iprepad, ipostpad, padval )
343 CALL psfillpad( ictxt, worktrd-ipostpad, 1,
344 $ mem( ipw-iprepad ), worktrd-ipostpad,
345 $ iprepad, ipostpad, padval )
349 CALL blacs_barrier( ictxt,
'All' )
354 CALL pssytrd( uplo, n, mem( ipa ), 1, 1, desca,
355 $ mem( ipd ), mem( ipe ), mem( ipt ),
356 $ mem( ipw ), lwork, info )
364 CALL pschekpad( ictxt,
'PSSYTRD', np, nq,
365 $ mem( ipa-iprepad ), desca( lld_ ),
366 $ iprepad, ipostpad, padval )
367 CALL pschekpad( ictxt,
'PSSYTRD', ndiag, 1,
368 $ mem( ipd-iprepad ), ndiag, iprepad,
370 CALL pschekpad( ictxt,
'PSSYTRD', noffd, 1,
371 $ mem( ipe-iprepad ), noffd, iprepad,
374 $ mem( ipt-iprepad ), nq, iprepad,
376 CALL pschekpad( ictxt,
'PSSYTRD', worktrd-ipostpad, 1,
377 $ mem( ipw-iprepad ), worktrd-ipostpad,
378 $ iprepad, ipostpad, padval )
379 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
380 $ mem( ipw-iprepad ), worksiz-ipostpad,
381 $ iprepad, ipostpad, padval )
385 CALL pssytdrv( uplo, n, mem( ipa ), 1, 1, desca,
386 $ mem( ipd ), mem( ipe ), mem( ipt ),
387 $ mem( ipw ), ierr( 1 ) )
388 CALL pslafchk(
'Symm',
'No', n, n, mem( ipa ), 1, 1,
389 $ desca, iaseed, anorm, fresid,
394 CALL pschekpad( ictxt,
'PSSYTDRV', np, nq,
395 $ mem( ipa-iprepad ), desca( lld_ ),
396 $ iprepad, ipostpad, padval )
397 CALL pschekpad( ictxt,
'PSSYTDRV', ndiag, 1,
398 $ mem( ipd-iprepad ), ndiag, iprepad,
400 CALL pschekpad( ictxt,
'PSSYTDRV', noffd, 1,
401 $ mem( ipe-iprepad ), noffd, iprepad,
403 CALL pschekpad( ictxt,
'PSSYTDRV', worksiz-ipostpad,
404 $ 1, mem( ipw-iprepad ),
405 $ worksiz-ipostpad, iprepad, ipostpad,
410 IF( fresid.LE.thresh .AND. fresid-fresid.EQ.
411 $ 0.0e+0 .AND. ierr( 1 ).EQ.0 )
THEN
415 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
416 $
WRITE( nout, fmt = 9986 )fresid
421 IF( myrow.EQ.0 .AND. mycol.EQ.0 .AND. ierr( 1 ).NE.0 )
422 $
WRITE( nout, fmt = * )
'D or E copies incorrect ...'
428 fresid = fresid - fresid
434 CALL slcombine( ictxt,
'All',
'>',
'W', 1, 1, wtime )
435 CALL slcombine( ictxt,
'All',
'>',
'C', 1, 1, ctime )
439 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
445 nops = ( 4.0d+0 / 3.0d+0 )*nops**3
450 IF( wtime( 1 ).GT.0.0d+0 )
THEN
451 tmflops = nops / wtime( 1 )
455 IF( wtime( 1 ).GE.0.0d+0 )
456 $
WRITE( nout, fmt = 9993 )
'WALL', uplo, n, nb,
457 $ nprow, npcol, wtime( 1 ), tmflops, fresid, passed
461 IF( ctime( 1 ).GT.0.0d+0 )
THEN
462 tmflops = nops / ctime( 1 )
466 IF( ctime( 1 ).GE.0.0d+0 )
467 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo, n, nb,
468 $ nprow, npcol, ctime( 1 ), tmflops, fresid, passed
473 CALL blacs_gridexit( ictxt )
476 CALL psttrdtester( iam, nprocs, check, nout, thresh, nval, nmat,
477 $ mem, totmem, kpass, kfail, kskip )
482 ktests = kpass + kfail + kskip
483 WRITE( nout, fmt = * )
484 WRITE( nout, fmt = 9992 )ktests
486 WRITE( nout, fmt = 9991 )kpass
487 WRITE( nout, fmt = 9989 )kfail
489 WRITE( nout, fmt = 9990 )kpass
491 WRITE( nout, fmt = 9988 )kskip
492 WRITE( nout, fmt = * )
493 WRITE( nout, fmt = * )
494 WRITE( nout, fmt = 9987 )
495 IF( nout.NE.6 .AND. nout.NE.0 )
501 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
502 $
'; It should be at least 1' )
503 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
505 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
506 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
508 9995
FORMAT(
'TIME UPLO N NB P Q TRD Time ',
509 $
' MFLOPS Residual CHECK' )
510 9994
FORMAT(
'---- ---- ------ --- ----- ----- --------- ',
511 $
'----------- -------- ------' )
512 9993
FORMAT( a4, 1x, a4, 1x, i6, 1x, i3, 1x, i5, 1x, i5, 1x, f9.2, 1x,
513 $ f11.2, 1x, f8.2, 1x, a6 )
514 9992
FORMAT(
'Finished', i4,
' tests, with the following results:' )
515 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
516 9990
FORMAT( i5,
' tests completed without checking.' )
517 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
518 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
519 9987
FORMAT(
'END OF TESTS.' )
520 9986
FORMAT(
'||A - Q*T*Q''|| / (||A|| * N * eps) = ', g25.7 )