61 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
62 $ lld_, mb_, m_, nb_, n_, rsrc_
63 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
64 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
65 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
66 INTEGER memsiz, ntests, realsz, totmem
68 parameter( realsz = 4, totmem = 2000000,
69 $ memsiz = totmem / realsz, ntests = 20,
70 $ padval = -9923.0e+0 )
76 INTEGER i, iam, iaseed, ictxt, ihi, ihip, ihlp, ihlq,
77 $ ilcol, ilo, ilrow, info, inlq, imidpad, ipa,
78 $ ipt, ipw, ipostpad, iprepad, itemp, j, k,
79 $ kfail, kpass, kskip, ktests, lcm, lcmq, loff,
80 $ lwork, mycol, myrow, n, nb, ngrids, nmat, nnb,
81 $ nprocs, nout, np, npcol, nprow, nq, workhrd,
83 REAL anorm, fresid, thresh
84 DOUBLE PRECISION nops, tmflops
87 INTEGER desca( dlen_ ), ierr( 1 ), nbval( ntests ),
88 $ nval( ntests ), nvhi( ntests ), nvlo( ntests ),
89 $ pval( ntests ), qval( ntests )
91 DOUBLE PRECISION ctime( 1 ), wtime( 1 )
94 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
95 $ blacs_gridexit, blacs_gridinit, blacs_gridinfo,
110 DATA ktests, kpass, kfail, kskip / 4*0 /
116 CALL blacs_pinfo( iam, nprocs )
118 CALL pshrdinfo( outfile, nout, nmat, nval, nvlo, nvhi, ntests,
119 $ nnb, nbval, ntests, ngrids, pval, ntests, qval,
120 $ ntests, thresh, mem, iam, nprocs )
121 check = ( thresh.GE.0.0e+0 )
126 WRITE( nout, fmt = * )
127 WRITE( nout, fmt = 9995 )
128 WRITE( nout, fmt = 9994 )
129 WRITE( nout, fmt = * )
142 IF( nprow.LT.1 )
THEN
144 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
146 ELSE IF( npcol.LT.1 )
THEN
148 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
150 ELSE IF( nprow*npcol.GT.nprocs )
THEN
152 $
WRITE( nout, fmt = 9998 )nprow*npcol, nprocs
156 IF( ierr( 1 ).GT.0 )
THEN
158 $
WRITE( nout, fmt = 9997 )
'grid'
165 CALL blacs_get( -1, 0, ictxt )
166 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
167 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
171 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
185 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
191 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
193 IF( ierr( 1 ).GT.0 )
THEN
195 $
WRITE( nout, fmt = 9997 )
'matrix'
209 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
214 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
216 IF( ierr( 1 ).GT.0 )
THEN
218 $
WRITE( nout, fmt = 9997 )
'NB'
223 np =
numroc( n, nb, myrow, 0, nprow )
224 nq =
numroc( n, nb, mycol, 0, npcol )
226 iprepad =
max( nb, np )
228 ipostpad =
max( nb, nq )
237 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
238 $
max( 1, np ) + imidpad, info )
242 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
244 IF( ierr( 1 ).LT.0 )
THEN
246 $
WRITE( nout, fmt = 9997 )
'descriptor'
255 ipt = ipa + desca( lld_ )*nq + ipostpad + iprepad
256 ipw = ipt + nq + ipostpad + iprepad
261 ihip =
numroc( ihi, nb, myrow, desca( rsrc_ ), nprow )
262 loff = mod( ilo-1, nb )
263 ilrow =
indxg2p( ilo, nb, myrow, desca( rsrc_ ), nprow )
264 ilcol =
indxg2p( ilo, nb, mycol, desca( csrc_ ), npcol )
265 ihlp =
numroc( ihi-ilo+loff+1, nb, myrow, ilrow, nprow )
266 inlq =
numroc( n-ilo+loff+1, nb, mycol, ilcol, npcol )
267 lwork = nb*( nb +
max( ihip+1, ihlp+inlq ) )
268 workhrd = lwork + ipostpad
274 lcm =
ilcm( nprow, npcol )
276 ihlq =
numroc( ihi-ilo+loff+1, nb, mycol, ilcol,
278 itemp = nb*
max( ihlp+inlq, ihlq+
max( ihip,
280 $ npcol ), nb, 0, 0, lcmq ) ) )
281 worksiz =
max( nb*nb + nb*ihlp + itemp, nb * np ) +
288 IF( ipw+worksiz.GT.memsiz )
THEN
290 $
WRITE( nout, fmt = 9996 )
'Hessenberg reduction',
291 $ ( ipw+worksiz )*realsz
297 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
299 IF( ierr( 1 ).GT.0 )
THEN
301 $
WRITE( nout, fmt = 9997 )
'MEMORY'
308 CALL psmatgen( ictxt,
'No',
'No', desca( m_ ),
309 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
310 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
312 $ iaseed, 0, np, 0, nq, myrow, mycol,
318 CALL psfillpad( ictxt, np, nq, mem( ipa-iprepad ),
319 $ desca( lld_ ), iprepad, ipostpad,
321 CALL psfillpad( ictxt, nq, 1, mem( ipt-iprepad ),
322 $ nq, iprepad, ipostpad, padval )
323 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
324 $ mem( ipw-iprepad ), worksiz-ipostpad,
325 $ iprepad, ipostpad, padval )
326 anorm =
pslange(
'I', n, n, mem( ipa ), 1, 1, desca,
328 CALL pschekpad( ictxt,
'PSLANGE', np, nq,
329 $ mem( ipa-iprepad ), desca( lld_ ),
330 $ iprepad, ipostpad, padval )
332 $ worksiz-ipostpad, 1,
333 $ mem( ipw-iprepad ), worksiz-ipostpad,
334 $ iprepad, ipostpad, padval )
335 CALL psfillpad( ictxt, workhrd-ipostpad, 1,
336 $ mem( ipw-iprepad ), workhrd-ipostpad,
337 $ iprepad, ipostpad, padval )
341 CALL blacs_barrier( ictxt,
'All' )
346 CALL psgehrd( n, ilo, ihi, mem( ipa ), 1, 1, desca,
347 $ mem( ipt ), mem( ipw ), lwork, info )
354 CALL pschekpad( ictxt,
'PSGEHRD', np, nq,
355 $ mem( ipa-iprepad ), desca( lld_ ),
356 $ iprepad, ipostpad, padval )
358 $ mem( ipt-iprepad ), nq, iprepad,
360 CALL pschekpad( ictxt,
'PSGEHRD', workhrd-ipostpad,
361 $ 1, mem( ipw-iprepad ),
362 $ workhrd-ipostpad, iprepad,
364 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
365 $ mem( ipw-iprepad ), worksiz-ipostpad,
366 $ iprepad, ipostpad, padval )
370 CALL psgehdrv( n, ilo, ihi, mem( ipa ), 1, 1, desca,
371 $ mem( ipt ), mem( ipw ) )
372 CALL pslafchk(
'No',
'No', n, n, mem( ipa ), 1, 1,
373 $ desca, iaseed, anorm, fresid,
378 CALL pschekpad( ictxt,
'PSGEHDRV', np, nq,
379 $ mem( ipa-iprepad ), desca( lld_ ),
380 $ iprepad, ipostpad, padval )
381 CALL pschekpad( ictxt,
'PSGEHDRV', nq, 1,
382 $ mem( ipt-iprepad ), nq, iprepad,
385 $ worksiz-ipostpad, 1,
386 $ mem( ipw-iprepad ), worksiz-ipostpad,
387 $ iprepad, ipostpad, padval )
391 IF( fresid.LE.thresh .AND. fresid-fresid.EQ.0.0e+0 )
396 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
397 $
WRITE( nout, fmt = 9986 ) fresid
406 fresid = fresid - fresid
412 CALL slcombine( ictxt,
'All',
'>',
'W', 1, 1, wtime )
413 CALL slcombine( ictxt,
'All',
'>',
'C', 1, 1, ctime )
417 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
423 nops = dble( ihi-ilo )
425 $ ( 2.0d0*dble( ihi ) + (4.0d0/3.0d0)*nops )
430 IF( wtime( 1 ).GT.0.0d+0 )
THEN
431 tmflops = nops / wtime( 1 )
435 IF( wtime( 1 ).GE.0.0d+0 )
436 $
WRITE( nout, fmt = 9993 )
'WALL', n, ilo, ihi, nb,
437 $ nprow, npcol, wtime( 1 ), tmflops, fresid,
442 IF( ctime( 1 ).GT.0.0d+0 )
THEN
443 tmflops = nops / ctime( 1 )
447 IF( ctime( 1 ).GE.0.0d+0 )
448 $
WRITE( nout, fmt = 9993 )
'CPU ', n, ilo, ihi, nb,
449 $ nprow, npcol, ctime( 1 ), tmflops, fresid,
455 CALL blacs_gridexit( ictxt )
461 ktests = kpass + kfail + kskip
462 WRITE( nout, fmt = * )
463 WRITE( nout, fmt = 9992 ) ktests
465 WRITE( nout, fmt = 9991 ) kpass
466 WRITE( nout, fmt = 9989 ) kfail
468 WRITE( nout, fmt = 9990 ) kpass
470 WRITE( nout, fmt = 9988 ) kskip
471 WRITE( nout, fmt = * )
472 WRITE( nout, fmt = * )
473 WRITE( nout, fmt = 9987 )
474 IF( nout.NE.6 .AND. nout.NE.0 )
480 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
481 $
'; It should be at least 1' )
482 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
484 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
485 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
487 9995
FORMAT(
'TIME N ILO IHI NB P Q HRD Time ',
488 $
' MFLOPS Residual CHECK' )
489 9994
FORMAT(
'---- ------ ------ ------ --- ----- ----- --------- ',
490 $
'----------- -------- ------' )
491 9993
FORMAT( a4, 1x, i6, 1x, i6, 1x, i6, 1x, i3, 1x, i5, 1x, i5, 1x,
492 $ f9.2, 1x, f11.2, 1x, f8.2, 1x, a6 )
493 9992
FORMAT(
'Finished', i4,
' tests, with the following results:' )
494 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
495 9990
FORMAT( i5,
' tests completed without checking.' )
496 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
497 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
498 9987
FORMAT(
'END OF TESTS.' )
499 9986
FORMAT(
'||A - Q*H*Q''|| / (||A|| * N * eps) = ', g25.7 )
subroutine pslafchk(aform, diag, m, n, a, ia, ja, desca, iaseed, anorm, fresid, work)
subroutine psmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
subroutine descinit(desc, m, n, mb, nb, irsrc, icsrc, ictxt, lld, info)
integer function ilcm(m, n)
integer function indxg2p(indxglob, nb, iproc, isrcproc, nprocs)
integer function numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pschekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine psfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine psgehdrv(n, ilo, ihi, a, ia, ja, desca, tau, work)
subroutine psgehrd(n, ilo, ihi, a, ia, ja, desca, tau, work, lwork, info)
subroutine pshrdinfo(summry, nout, nmat, nval, nvlo, nvhi, ldnval, nnb, nbval, ldnbval, ngrids, pval, ldpval, qval, ldqval, thresh, work, iam, nprocs)
real function pslange(norm, m, n, a, ia, ja, desca, work)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)