68 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
69 $ lld_, mb_, m_, nb_, n_, rsrc_
70 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
71 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
72 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
73 INTEGER dblesz, intgsz, memsiz, ntests,
74 DOUBLE PRECISION padval, zero
75 parameter( dblesz = 8, intgsz = 4, totmem = 2000000,
76 $ memsiz = totmem / dblesz, ntests = 20,
77 $ padval = -9923.0d+0, zero = 0.0d+0 )
84 INTEGER hh, i, iam, iaseed, ibseed, ictxt, imidpad,
85 $ info, ipa, ipa0, ipb, ipb0, ipberr, ipferr,
86 $ iprepad, ipostpad, ipw, ipw2, itemp, j, k,
87 $ kfail, kk, kpass, kskip, ktests, lcm, lcmq,
88 $ liwork, lwork, lw2, mycol, myrhs, myrow, n, nb,
89 $ nbrhs, ngrids, nmat, nnb, nnbr, nnr, nout, np,
90 $ npcol, nprocs, nprow, , nrhs, worksiz
92 DOUBLE PRECISION anorm, anorm1, fresid, nops, rcond,
93 $ sresid, sresid2, tmflops
96 INTEGER desca( dlen_ ), descb( dlen_ ), ierr( 1 ),
97 $ nbrval( ), nbval( ntests ),
98 $ nrval( ntests ), nval( ntests ),
99 $ pval( ntests ), qval( ntests )
100 DOUBLE PRECISION ctime( 2 ), mem( memsiz ), wtime(
121 DATA kfail, kpass, kskip, ktests / 4*0 /
127 CALL blacs_pinfo( iam, nprocs )
130 CALL pdlltinfo( outfile, nout, uplo, nmat, nval, ntests, nnb,
131 $ nbval, ntests, nnr, nrval, ntests, nnbr, nbrval,
132 $ ntests, ngrids, pval, ntests, qval, ntests,
133 $ thresh, est, mem, iam, nprocs )
134 check = ( thresh.GE.0.0e+0 )
139 WRITE( nout, fmt = * )
140 WRITE( nout, fmt = 9995 )
141 WRITE( nout, fmt = 9994 )
142 WRITE( nout, fmt = * )
155 IF( nprow.LT.1 )
THEN
157 $
WRITE( nout, fmt = 9999 )
'GRID', 'nprow
', NPROW
159.LT.
ELSE IF( NPCOL1 ) THEN
161 $ WRITE( NOUT, FMT = 9999 ) 'grid
', 'npcol
', NPCOL
163.GT.
ELSE IF( NPROW*NPCOLNPROCS ) THEN
165 $ WRITE( NOUT, FMT = 9998 ) NPROW*NPCOL, NPROCS
169.GT.
IF( IERR( 1 )0 ) THEN
171 $ WRITE( NOUT, FMT = 9997 ) 'grid
'
178 CALL BLACS_GET( -1, 0, ICTXT )
179 CALL BLACS_GRIDINIT( ICTXT, 'row-major
', NPROW, NPCOL )
180 CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
185.GE..OR..GE.
IF( MYROWNPROW MYCOLNPCOL )
197 $ WRITE( NOUT, FMT = 9999 ) 'matrix
', 'n', n
199 ELSE IF( n.LT.1 )
THEN
201 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
207 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
209 IF( ierr( 1 ).GT.0 )
THEN
211 $
WRITE( nout, fmt = 9997 )
'matrix'
226 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
231 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
233 IF( ierr( 1 ).GT.0 )
THEN
235 $
WRITE( nout, fmt = 9997 )
'NB'
242 np =
numroc( n, nb, myrow, 0, nprow )
243 nq =
numroc( n, nb, mycol, 0, npcol )
245 iprepad =
max( nb, np )
247 ipostpad =
max( nb, nq )
256 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
257 $
max( 1, np )+imidpad, ierr( 1 ) )
261 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
263 IF( ierr( 1 ).LT.0 )
THEN
265 $
WRITE( nout, fmt = 9997 )
'descriptor'
275 ipa0 = ipa + desca( lld_ )*nq + ipostpad + iprepad
276 ipw = ipa0 + desca( lld_ )*nq + ipostpad + iprepad
278 ipw = ipa + desca( lld_ )*nq + ipostpad + iprepad
288 worksiz = np * desca( nb_ )
290 worksiz =
max( worksiz, desca( mb_ ) * desca( nb_ ) )
292 lcm =
ilcm( nprow, npcol )
293 itemp =
max( 2, 2 * nq ) + np
294 IF( nprow.NE.npcol )
THEN
298 worksiz =
max( worksiz, itemp )
299 worksiz = worksiz + ipostpad
310 IF( ipw+worksiz.GT.memsiz )
THEN
312 $
WRITE( nout, fmt = 9996 )
'factorization',
313 $ ( ipw+worksiz )*dblesz
319 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
321 IF( ierr( 1 ).GT.0 )
THEN
323 $
WRITE( nout, fmt = 9997 )
'MEMORY'
330 CALL pdmatgen( ictxt,
'Symm',
'Diag', desca( m_ ),
331 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
332 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
333 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
334 $ myrow, mycol, nprow, npcol )
339 CALL pdfillpad( ictxt, np, nq, mem( ipa-iprepad ),
340 $ desca( lld_ ), iprepad, ipostpad,
342 CALL pdfillpad( ictxt, worksiz-ipostpad, 1,
343 $ mem( ipw-iprepad ), worksiz-ipostpad,
344 $ iprepad, ipostpad, padval )
345 anorm =
pdlansy(
'I', uplo, n, mem( ipa ), 1, 1,
346 $ desca, mem( ipw ) )
347 anorm1 =
pdlansy(
'1', uplo, n, mem( ipa ), 1, 1,
348 $ desca, mem( ipw ) )
349 CALL pdchekpad( ictxt,
'PDLANSY', np, nq,
350 $ mem( ipa-iprepad ), desca( lld_ ),
351 $ iprepad, ipostpad, padval )
353 $ worksiz-ipostpad, 1,
354 $ mem( ipw-iprepad ), worksiz-ipostpad,
355 $ iprepad, ipostpad, padval )
359 CALL pdmatgen( ictxt,
'Symm',
'Diag', desca( m_ ),
360 $ desca( n_ ), desca( mb_ ),
361 $ desca( nb_ ), mem( ipa0 ),
362 $ desca( lld_ ), desca( rsrc_ ),
363 $ desca( csrc_ ), iaseed,
364 $ myrow, mycol, nprow, npcol )
367 $ mem( ipa0-iprepad ), desca( lld_ ),
368 $ iprepad, ipostpad, padval )
372 CALL blacs_barrier( ictxt,
'All' )
378 CALL pdpotrf( uplo, n, mem( ipa ), 1, 1, desca, info )
384 $
WRITE( nout, fmt
'PDPOTRF INFO=', info
394 CALL pdchekpad( ictxt,
'PDPOTRF', np, nq,
395 $ mem( ipa-iprepad ), desca( lld_ ),
396 $ iprepad, ipostpad, padval )
403 lwork =
max( 1, 2*np ) +
max( 1, 2*nq ) +
404 $
max( 2, desca( nb_ )*
405 $
max( 1,
iceil( nprow-1, npcol ) ),
407 $
max( 1,
iceil( npcol-1, nprow ) ) )
409 liwork =
max( 1, np )
410 lw2 =
iceil( liwork*intgsz
413 IF( ipw2+lw2.GT.memsiz )
THEN
415 $
WRITE( nout, fmt = 9996 )
'cond est',
416 $ ( ipw2+lw2 )*dblesz
422 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
425 IF( ierr( 1 ).GT.0 )
THEN
427 $
WRITE( nout, fmt = 9997 )
'MEMORY'
434 $ mem( ipw-iprepad ), lwork,
435 $ iprepad, ipostpad, padval )
437 $ mem( ipw2-iprepad ),
438 $ lw2-ipostpad, iprepad,
444 CALL pdpocon( uplo, n, mem( ipa ), 1, 1, desca,
446 $ mem( ipw2 ), liwork, info )
449 CALL pdchekpad( ictxt,
'PDPOCON', np, nq,
450 $ mem( ipa-iprepad ), desca( lld_ ),
451 $ iprepad, ipostpad, padval )
453 $ lwork, 1, mem( ipw-iprepad ),
454 $ lwork, iprepad, ipostpad,
458 $ mem( ipw2-iprepad ), lw2-ipostpad,
459 $ iprepad, ipostpad, padval )
475 CALL descinit( descb, n, nrhs, nb, nbrhs, 0, 0,
476 $ ictxt,
max( 1, np )+imidpad,
481 myrhs =
numroc( descb( n_ ), descb( nb_ ), mycol,
482 $ descb( csrc_ ), npcol )
486 ipb0 = ipb + descb( lld_ )*myrhs + ipostpad
488 ipferr = ipb0 + descb( lld_ )*myrhs + ipostpad
490 ipberr = myrhs + ipferr + ipostpad + iprepad
491 ipw = myrhs + ipberr + ipostpad + iprepad
493 ipw = ipb + descb( lld_ )*myrhs + ipostpad +
503 worksiz =
max( worksiz-ipostpad,
504 $ nq * nbrhs + np * nbrhs +
505 $
max(
max( nq*nb, 2*nbrhs ),
508 worksiz = ipostpad + worksiz
514 IF( ipw+worksiz.GT.memsiz )
THEN
516 $
WRITE( nout, fmt = 9996 )
'solve',
517 $ ( ipw+worksiz )*dblesz
523 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
526 IF( ierr( 1 ).GT.0 )
THEN
528 $
WRITE( nout, fmt = 9997 )
'MEMORY'
535 CALL pdmatgen( ictxt,
'No',
'No', descb( m_ ),
536 $ descb( n_ ), descb( mb_ ),
537 $ descb( nb_ ), mem( ipb ),
538 $ descb( lld_ ), descb( rsrc_ ),
539 $ descb( csrc_ ), ibseed, 0, np, 0,
540 $ myrhs, myrow, mycol, nprow, npcol )
544 $ mem( ipb-iprepad ),
546 $ iprepad, ipostpad, padval )
549 CALL pdmatgen( ictxt,
'No',
'No', descb( m_ ),
550 $ descb( n_ ), descb( mb_ ),
551 $ descb( nb_ ), mem( ipb0 ),
552 $ descb( lld_ ), descb( rsrc_ ),
553 $ descb( csrc_ ), ibseed, 0, np, 0,
554 $ myrhs, myrow, mycol, nprow,
559 $ mem( ipb0-iprepad ),
560 $ descb( lld_ ), iprepad,
563 $ mem( ipferr-iprepad ), 1,
567 $ mem( ipberr-iprepad ), 1,
573 CALL blacs_barrier( ictxt,
'All' )
578 CALL pdpotrs( uplo, n, nrhs, mem( ipa ), 1, 1,
579 $ desca, mem( ipb ), 1, 1, descb,
588 CALL pdchekpad( ictxt,
'PDPOTRS', np, nq,
589 $ mem( ipa-iprepad ),
591 $ iprepad, ipostpad, padval )
593 $ myrhs, mem( ipb-iprepad ),
594 $ descb( lld_ ), iprepad,
597 CALL pdfillpad( ictxt, worksiz-ipostpad, 1,
598 $ mem( ipw-iprepad ),
599 $ worksiz-ipostpad, iprepad,
604 CALL pdlaschk(
'Symm',
'Diag', n, nrhs,
605 $ mem( ipb ), 1, 1, descb,
606 $ iaseed, 1, 1, desca, ibseed,
607 $ anorm, sresid, mem( ipw ) )
610 $
WRITE( nout, fmt = 9985 ) sresid
616 $ descb( lld_ ), iprepad,
620 $ mem( ipw-iprepad ),
621 $ worksiz-ipostpad, iprepad,
626 IF( ( sresid.LE.thresh ).AND.
636 sresid = sresid - sresid
644 lwork =
max( 1, 3*np )
645 ipw2 = ipw + lwork + ipostpad + iprepad
647 lw2 =
iceil( liwork*intgsz, dblesz ) +
651 IF( ipw2+lw2.GT.memsiz )
THEN
653 $
WRITE( nout, fmt = 9996 )
654 $
'iter ref', ( ipw2+lw2 )*dblesz
660 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
663 IF( ierr( 1 ).GT.0 )
THEN
665 $
WRITE( nout, fmt = 9997 )
673 $ mem( ipw-iprepad ),
674 $ lwork, iprepad, ipostpad,
677 $ 1, mem( ipw2-iprepad ),
686 CALL pdporfs( uplo, n, nrhs, mem( ipa0 ),
687 $ 1, 1, desca, mem( ipa ), 1, 1,
688 $ desca, mem( ipb0 ), 1, 1,
689 $ descb, mem( ipb ), 1, 1, descb,
690 $ mem( ipferr ), mem( ipberr ),
691 $ mem( ipw ), lwork, mem( ipw2 ),
698 $ nq, mem( ipa0-iprepad ),
699 $ desca( lld_ ), iprepad,
702 $ nq, mem( ipa-iprepad ),
703 $ desca( lld_ ), iprepad,
706 $ myrhs, mem( ipb-iprepad ),
707 $ descb( lld_ ), iprepad,
711 $ mem( ipb0-iprepad ),
712 $ descb( lld_ ), iprepad,
716 $ mem( ipferr-iprepad ), 1,
721 $ mem( ipberr-iprepad ), 1,
725 $ 1, mem( ipw-iprepad ),
726 $ lwork, iprepad, ipostpad,
730 $ mem( ipw2-iprepad ),
736 $ 1, mem( ipw-iprepad ),
737 $ worksiz-ipostpad, iprepad,
742 CALL pdlaschk(
'Symm',
'Diag', n, nrhs,
743 $ mem( ipb ), 1, 1, descb,
744 $ iaseed, 1, 1, desca,
745 $ ibseed, anorm, sresid2,
748 IF( iam.EQ.0 .AND. sresid2.GT.thresh )
749 $
WRITE( nout, fmt = 9985 ) sresid2
754 $ myrhs, mem( ipb-iprepad ),
755 $ descb( lld_ ), iprepad,
758 $ worksiz-ipostpad, 1,
759 $ mem( ipw-iprepad ),
768 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
770 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
775 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
779 nops = (dble(n)**3)/3.0d+0 +
780 $ (dble(n)**2)/2.0d+0
784 nops = nops + 2.0d+0*(dble(n)**2)*dble(nrhs)
791 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
793 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
798 IF( wtime( 2 ).GE.0.0d+0 )
799 $
WRITE( nout, fmt = 9993 )
'WALL', uplo, n,
800 $ nb, nrhs, nbrhs, nprow, npcol,
801 $ wtime( 1 ), wtime( 2 ), tmflops,
806 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
808 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
813 IF( ctime( 2 ).GE.0.0d+0 )
814 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo, n,
815 $ nb, nrhs, nbrhs, nprow, npcol,
816 $ ctime( 1 ), ctime( 2 ), tmflops,
823 IF( check .AND. sresid.GT.thresh )
THEN
827 CALL pdpotrrv( uplo, n, mem( ipa ), 1, 1, desca,
829 CALL pdlafchk(
'Symm',
'Diag', n, n, mem( ipa ), 1, 1,
830 $ desca, iaseed, anorm, fresid,
835 CALL pdchekpad( ictxt,
'PDPOTRRV', np, nq,
836 $ mem( ipa-iprepad ), desca( lld_ ),
837 $ iprepad, ipostpad, padval )
839 $ WORKSIZ-IPOSTPAD, 1,
840 $ MEM( IPW-IPREPAD ), WORKSIZ-IPOSTPAD,
841 $ IPREPAD, IPOSTPAD, PADVAL )
844 IF( LSAME( UPLO, 'l
' ) ) THEN
845 WRITE( NOUT, FMT = 9986 ) 'l*l
''', FRESID
847 WRITE( NOUT, FMT = 9986 ) 'u
''*u
', FRESID
854 CALL BLACS_GRIDEXIT( ICTXT )
861 KTESTS = KPASS + KFAIL + KSKIP
862 WRITE( NOUT, FMT = * )
863 WRITE( NOUT, FMT = 9992 ) KTESTS
865 WRITE( NOUT, FMT = 9991 ) KPASS
866 WRITE( NOUT, FMT = 9989 ) KFAIL
868 WRITE( NOUT, FMT = 9990 ) KPASS
870 WRITE( NOUT, FMT = 9988 ) KSKIP
871 WRITE( NOUT, FMT = * )
872 WRITE( NOUT, FMT = * )
873 WRITE( NOUT, FMT = 9987 )
874.NE..AND..NE.
IF( NOUT6 NOUT0 )
880 9999 FORMAT( 'illegal
', A6, ':
', A5, ' =
', I3,
881 $ '; it should be at least 1
' )
882 9998 FORMAT( 'illegal grid: nprow*npcol =
', I4, '. it can be at most
',
884 9997 FORMAT( 'bad
', A6, ' parameters: going on to next test case.
' )
885 9996 FORMAT( 'unable to perform ', a,
': need TOTMEM of at least',
887 9995
FORMAT(
'TIME UPLO N NB NRHS NBRHS P Q LLt Time ',
888 $
'Slv Time MFLOPS CHECK' )
889 9994
FORMAT(
'---- ---- ----- --- ---- ----- ---- ---- -------- ',
890 $
'-------- -------- ------' )
891 9993
FORMAT( a4, 4x, a1, 1x, i5, 1x, i3, 1x, i4, 1x, i5, 1x, i4, 1x,
893 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
894 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
895 9990
FORMAT( i5,
' tests completed without checking.' )
896 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
897 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
898 9987
FORMAT(
'END OF TESTS.' )
899 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
900 9985
FORMAT(
'||Ax-b||/(||x||*||A||*eps*N) ', f25.7 )
subroutine pdlafchk(aform, diag, m, n, a, ia, ja, desca, iaseed, anorm, fresid, work)
subroutine pdmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
logical function lsame(ca, cb)
LSAME
integer function iceil(inum, idenom)
integer function ilcm(m, n)
subroutine blacs_gridinit(cntxt, c, nprow, npcol)
subroutine pdpotrs(uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)
subroutine pdpotrf(uplo, n, a, ia, ja, desca, info)
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 pdchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pdfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pdgetrrv(m, n, a, ia, ja, desca, ipiv, work)
double precision function pdlansy(norm, uplo, n, a, ia, ja, desca, work)
subroutine pdlaschk(symm, diag, n, nrhs, x, ix, jx, descx, iaseed, ia, ja, desca, ibseed, anorm, resid, work)
subroutine pdlltinfo(summry, nout, uplo, nmat, nval, ldnval, nnb, nbval, ldnbval, nnr, nrval, ldnrval, nnbr, nbrval, ldnbrval, ngrids, pval, ldpval, qval, ldqval, thresh, est, work, iam, nprocs)
subroutine pdpocon(uplo, n, a, ia, ja, desca, anorm, rcond, work, lwork, iwork, liwork, info)
subroutine pdporfs(uplo, n, nrhs, a, ia, ja, desca, af, iaf, jaf, descaf, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, iwork, liwork, info)
subroutine pdpotrrv(uplo, n, a, ia, ja, desca, work)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)