62 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
63 $ lld_, mb_, m_, nb_, n_, rsrc_
64 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
66 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
67 INTEGER memsiz, ntests, totmem, zplxsz
69 parameter( totmem = 2000000, zplxsz = 16,
70 $ memsiz = totmem / zplxsz, ntests = 20,
71 $ padval = ( -9923.0d+0, -9923.0d+0 ) )
77 INTEGER i, iam, iaseed, ictxt, ihi, ihip, ihlp, ihlq,
78 $ ilcol, ilo, ilrow, info, inlq, imidpad, ipa,
79 $ ipt, ipw, ipostpad, iprepad, itemp, j, k,
80 $ kfail, kpass, kskip, ktests, lcm, lcmq, loff,
81 $ lwork, mycol, myrow, n, nb, ngrids, nmat, nnb,
82 $ nprocs, nout, np, npcol, nprow, nq, workhrd,
85 DOUBLE PRECISION anorm, fresid, nops, tmflops
88 INTEGER desca( dlen_ ), ierr( 1 ), nbval( ntests ),
89 $ nval( ntests ), nvhi( ntests ), nvlo( ntests ),
90 $ pval( ntests ), qval( ntests )
91 DOUBLE PRECISION ctime( 1 ), wtime( 1 )
92 COMPLEX*16 mem( memsiz )
95 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
111 DATA ktests, kpass, kfail, kskip / 4*0 /
117 CALL blacs_pinfo( iam, nprocs )
119 CALL pzhrdinfo( outfile, nout, nmat, nval, nvlo, nvhi, ntests,
120 $ nnb, nbval, ntests, ngrids, pval, ntests, qval,
121 $ ntests, 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 )
172 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
186 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
192 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
194 IF( ierr( 1 ).GT.0 )
THEN
196 $
WRITE( nout, fmt = 9997 )
'matrix'
210 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
215 CALL igsum2d( ictxt
'All'' '
217 IF( ierr( 1 ).GT.0 )
THEN
219 $
WRITE( nout, fmt = 9997 )
'NB'
224 np =
numroc( n, nb, myrow, 0, nprow )
225 nq =
numroc( n, nb, mycol, 0, npcol )
227 iprepad =
max( nb, np )
229 ipostpad =
max( nb, nq )
238 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
243 CALL igsum2d( ictxt
'All',
' ', 1, 1, ierr, 1, -1, 0 )
245 IF( ierr( 1 ).LT.0 )
THEN
247 $
WRITE( nout, fmt = 9997 )
'descriptor'
256 ipt = ipa + desca( lld_ )*nq + ipostpad + iprepad
257 ipw = ipt + nq + ipostpad + iprepad
262 ihip =
numroc( ihi, nb, myrow
263 loff = mod( ilo-1, nb )
264 ilrow =
indxg2p( ilo, nb, myrow, desca( rsrc_ ), nprow )
265 ilcol =
indxg2p( ilo, nb, mycol, desca( csrc_ ), npcol )
266 ihlp =
numroc( ihi-ilo+loff+1, nb, myrow, ilrow
267 inlq =
numroc( n-ilo+loff+1, nb, mycol, ilcol, npcol )
268 lwork = nb*( nb +
max( ihip+1, ihlp+inlq ) )
269 workhrd = lwork + ipostpad
275 lcm =
ilcm( nprow, npcol )
277 ihlq =
numroc( ihi-ilo+loff+1, nb, mycol, ilcol,
279 itemp = nb*
max( ihlp+inlq, ihlq+
max( ihip,
281 $ npcol ), nb, 0, 0, lcmq ) ) )
282 worksiz =
max( nb*nb + nb*ihlp + itemp, nb * np ) +
289 IF( ipw+worksiz.GT.memsiz )
THEN
291 $
WRITE( nout, fmt = 9996 )
'Hessenberg reduction',
292 $ ( ipw+worksiz )*zplxsz
298 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
302 $
WRITE( nout, fmt = 9997 )
'MEMORY'
309 CALL pzmatgen( ictxt,
'No',
'No', desca( m_ ),
310 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
311 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
313 $ iaseed, 0, np, 0, nq, myrow, mycol,
319 CALL pzfillpad( ictxt, np, nq, mem( ipa-iprepad ),
320 $ desca( lld_ ), iprepad, ipostpad,
322 CALL pzfillpad( ictxt, nq, 1, mem( ipt-iprepad ),
323 $ nq, iprepad, ipostpad, padval )
324 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
325 $ mem( ipw-iprepad ), worksiz-ipostpad,
326 $ iprepad, ipostpad, padval )
327 anorm =
pzlange(
'I', n, n, mem( ipa ), 1, 1, desca,
329 CALL pzchekpad( ictxt,
'PZLANGE', np, nq,
330 $ mem( ipa-iprepad ), desca( lld_ ),
331 $ iprepad, ipostpad, padval )
333 $ worksiz-ipostpad, 1,
334 $ mem( ipw-iprepad ), worksiz-ipostpad,
335 $ iprepad, ipostpad, padval )
336 CALL pzfillpad( ictxt, workhrd-ipostpad, 1,
337 $ mem( ipw-iprepad ), workhrd-ipostpad,
338 $ iprepad, ipostpad, padval )
342 CALL blacs_barrier( ictxt,
'All' )
347 CALL pzgehrd( n, ilo, ihi, mem( ipa ), 1, 1, desca,
348 $ mem( ipt ), mem( ipw ), lwork, info )
355 CALL pzchekpad( ictxt,
'PZGEHRD', np, nq,
356 $ mem( ipa-iprepad ), desca( lld_ ),
357 $ iprepad, ipostpad, padval )
359 $ mem( ipt-iprepad ), nq, iprepad,
361 CALL pzchekpad( ictxt,
'PZGEHRD', workhrd-ipostpad,
362 $ 1, mem( ipw-iprepad ),
363 $ workhrd-ipostpad, iprepad,
365 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
366 $ mem( ipw-iprepad ), worksiz-ipostpad,
367 $ iprepad, ipostpad, padval )
371 CALL pzgehdrv( n, ilo, ihi, mem( ipa ), 1, 1, desca,
372 $ mem( ipt ), mem( ipw )
374 $ desca, iaseed, anorm, fresid,
379 CALL pzchekpad( ictxt,
'PZGEHDRV', np, nq,
380 $ mem( ipa-iprepad ), desca( lld_ ),
381 $ iprepad, ipostpad, padval )
382 CALL pzchekpad( ictxt,
'PZGEHDRV', nq, 1,
383 $ mem( ipt-iprepad ), nq, iprepad,
386 $ worksiz-ipostpad, 1,
387 $ mem( ipw-iprepad ), worksiz-ipostpad,
388 $ iprepad, ipostpad, padval )
392 IF( fresid.LE.thresh .AND. fresid-fresid.EQ.0.0d+0
397 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
398 $
WRITE( nout, fmt = 9986 ) fresid
407 fresid = fresid - fresid
413 CALL slcombine( ictxt,
'All',
'>',
'W', 1, 1, wtime )
414 CALL slcombine( ictxt,
'All',
'>',
'C', 1, 1, ctime )
418 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
424 nops = dble( ihi-ilo )
426 $ ( 8.0d0*dble( ihi ) + (16.0d0/3.0d0)*nops )
431 IF( wtime( 1 ).GT.0.0d+0 )
THEN
432 tmflops = nops / wtime( 1 )
436 IF( wtime( 1 ).GE.0.0d+0 )
437 $
WRITE( nout, fmt = 9993 )
'WALL', n, ilo, ihi, nb,
438 $ nprow, npcol, wtime( 1 ), tmflops, fresid,
443 IF( ctime( 1 ).GT.0.0d+0 )
THEN
444 tmflops = nops / ctime( 1 )
448 IF( ctime( 1 ).GE.0.0d+0 )
449 $
WRITE( nout, fmt = 9993 )
'CPU ', n, ilo, ihi, nb,
450 $ nprow, npcol, ctime( 1 ), tmflops, fresid,
462 ktests = kpass + kfail + kskip
463 WRITE( nout, fmt = * )
464 WRITE( nout, fmt = 9992 ) ktests
466 WRITE( nout, fmt = 9991 ) kpass
467 WRITE( nout, fmt = 9989 ) kfail
469 WRITE( nout, fmt = 9990 ) kpass
471 WRITE( nout, fmt = 9988 ) kskip
472 WRITE( nout, fmt = * )
473 WRITE( nout, fmt = * )
474 WRITE( nout, fmt = 9987 )
475 IF( nout.NE.6 .AND. nout.NE.0 )
481 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
482 $
'; It should be at least 1' )
483 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
485 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
486 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
488 9995
FORMAT(
'TIME N ILO IHI NB P Q HRD Time ',
489 $
' MFLOPS Residual CHECK' )
490 9994
FORMAT(
'---- ------ ------ ------ --- ----- ----- --------- ',
491 $
'----------- -------- ------' )
492 9993
FORMAT( a4, 1x, i6, 1x, i6, 1x, i6, 1x, i3, 1x, i5, 1x, i5, 1x,
493 $ f9.2, 1x, f11.2, 1x, f8.2, 1x, a6 )
494 9992
FORMAT(
'Finished', i4,
' tests, with the following results:' )
495 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
496 9990
FORMAT( i5,
' tests completed without checking.' )
497 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
498 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
499 9987
FORMAT(
'END OF TESTS.' )
500 9986
FORMAT(
'||A - Q*H*Q''|| / (||A|| * N * eps) = ', g25.7 )
subroutine pzlafchk(aform, diag, m, n, a, ia, ja, desca, iaseed, anorm, fresid, work)
subroutine pzmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
integer function ilcm(m, n)
subroutine blacs_gridinit(cntxt, c, nprow, npcol)
integer function indxg2p(indxglob, nb, iproc, isrcproc, nprocs)
double precision function pzlange(norm, m, n, a, ia, ja, desca, work)
subroutine descinit(desc, m, n, mb, nb, irsrc, icsrc, ictxt, lld, info)
subroutine blacs_gridexit(cntxt)
subroutine blacs_gridinfo(cntxt, nprow, npcol, myrow, mycol)
integer function numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pzchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pzfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pzgehdrv(n, ilo, ihi, a, ia, ja, desca, tau, work)
subroutine pzgehrd(n, ilo, ihi, a, ia, ja, desca, tau, work, lwork, info)
subroutine pzhrdinfo(summry, nout, nmat, nval, nvlo, nvhi, ldnval, nnb, nbval, ldnbval, ngrids, pval, ldpval, qval, ldqval, thresh, work, iam, nprocs)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)