69 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
70 $ lld_, mb_, m_, nb_, n_, rsrc_
71 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
72 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
73 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
74 INTEGER cplxsz, memsiz, ntests, realsz, totmem
77 parameter( cplxsz = 8, realsz = 4, totmem = 2000000,
78 $ memsiz = totmem / cplxsz, ntests = 20,
79 $ padval = ( -9923.0e+0, -9923.0e+0 ),
87 INTEGER hh, i, iam, iaseed, ibseed, ictxt, imidpad,
88 $ info, ipa, ipa0, ipb, ipb0, ipberr, ipferr,
89 $ iprepad, ipostpad, ipw, ipw2, itemp, j, k,
90 $ kfail, kk, kpass, kskip, ktests, lcm, lcmq,
91 $ lrwork, lwork, lw2, mycol, myrhs, myrow, n, nb,
92 $ nbrhs, ngrids, nmat, nnb, nnbr, nnr, nout, np,
93 $ npcol, nprocs, nprow, nq, nrhs, worksiz
94 REAL anorm, anorm1, fresid, rcond, sresid, sresid2,
96 DOUBLE PRECISION nops, tmflops
99 INTEGER desca( dlen_ ), descb( dlen_ ), ierr( 1 ),
100 $ nbrval( ntests ), nbval( ntests ),
101 $ nrval( ntests ), nval( ntests ),
102 $ pval( ntests ), qval( ntests )
103 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
104 COMPLEX mem( memsiz )
125 DATA kfail, kpass, kskip, ktests / 4*0 /
131 CALL blacs_pinfo( iam, nprocs )
134 CALL pclltinfo( outfile, nout, uplo, nmat, nval, ntests, nnb,
135 $ nbval, ntests, nnr, nrval, ntests, nnbr, nbrval,
136 $ ntests, ngrids, pval, ntests, qval, ntests,
137 $ thresh, est, mem, iam, nprocs )
138 check = ( thresh.GE.0.0e+0 )
143 WRITE( nout, fmt = * )
144 WRITE( nout, fmt = 9995 )
145 WRITE( nout, fmt = 9994 )
146 WRITE( nout, fmt = * )
159 IF( nprow.LT.1 )
THEN
161 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
163 ELSE IF( npcol.LT.1 )
THEN
165 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
167 ELSE IF( nprow*npcol.GT.nprocs )
THEN
169 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
173 IF( ierr( 1 ).GT.0 )
THEN
175 $
WRITE( nout, fmt = 9997 )
'grid'
182 CALL blacs_get( -1, 0, ictxt )
189 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
201 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
203 ELSE IF( n.LT.1 )
THEN
205 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N'
211 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
213 IF( ierr( 1 ).GT.0 )
THEN
215 $
WRITE( nout, fmt = 9997 )
'matrix'
230 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
235 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
237 IF( ierr( 1 ).GT.0 )
THEN
239 $
WRITE( nout, fmt = 9997 )
'NB'
246 np =
numroc( n, nb, myrow, 0, nprow )
247 nq =
numroc( n, nb, mycol, 0, npcol )
249 iprepad =
max( nb, np )
251 ipostpad =
max( nb, nq )
260 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
261 $
max( 1, np )+imidpad, ierr( 1 ) )
265 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
267 IF( ierr( 1 ).LT.0 )
THEN
269 $
WRITE( nout, fmt = 9997 )
'descriptor'
279 ipa0 = ipa + desca( lld_ )*nq + ipostpad + iprepad
280 ipw = ipa0 + desca( lld_ )*nq + ipostpad + iprepad
282 ipw = ipa + desca( lld_ )*nq + ipostpad + iprepad
292 worksiz = np * desca( nb_ )
294 worksiz =
max( worksiz, desca( mb_ ) * desca( nb_ ) )
296 lcm =
ilcm( nprow, npcol )
297 itemp =
max( 2, 2 * nq ) + np
298 IF( nprow.NE.npcol )
THEN
302 worksiz =
max( worksiz,
303 $
iceil( realsz * itemp, cplxsz ) )
304 worksiz = worksiz + ipostpad
315 IF( ipw+worksiz.GT.memsiz )
THEN
317 $
WRITE( nout, fmt = 9996 )
'factorization',
318 $ ( ipw+worksiz )*cplxsz
324 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
326 IF( ierr( 1 ).GT.0 )
THEN
328 $
WRITE( nout, fmt = 9997 )
'MEMORY'
335 CALL pcmatgen( ictxt,
'Herm',
'Diag', desca( m_ ),
336 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
337 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
338 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
339 $ myrow, mycol, nprow, npcol )
344 CALL pcfillpad( ictxt, np, nq, mem( ipa-iprepad ),
345 $ desca( lld_ ), iprepad, ipostpad,
347 CALL pcfillpad( ictxt, worksiz-ipostpad, 1,
348 $ mem( ipw-iprepad ), worksiz-ipostpad,
349 $ iprepad, ipostpad, padval )
350 anorm =
pclanhe(
'I', uplo, n, mem( ipa ), 1, 1,
351 $ desca, mem( ipw ) )
352 anorm1 =
pclanhe(
'1', uplo, n, mem( ipa ), 1, 1,
353 $ desca, mem( ipw ) )
354 CALL pcchekpad( ictxt,
'PCLANHE', np, nq,
355 $ mem( ipa-iprepad ), desca( lld_ ),
356 $ iprepad, ipostpad, padval )
357 CALL pcchekpad( ictxt,
'PCLANHE', worksiz-ipostpad,
358 $ 1, mem( ipw-iprepad ),
359 $ worksiz-ipostpad, iprepad, ipostpad,
364 CALL pcmatgen( ictxt,
'Herm',
'Diag', desca( m_ ),
365 $ desca( n_ ), desca( mb_ ),
366 $ desca( nb_ ), mem( ipa0 ),
367 $ desca( lld_ ), desca( rsrc_ ),
368 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
369 $ myrow, mycol, nprow, npcol )
372 $ mem( ipa0-iprepad ), desca( lld_ ),
373 $ iprepad, ipostpad, padval )
377 CALL blacs_barrier( ictxt,
'All' )
383 CALL pcpotrf( uplo, n, mem( ipa ), 1, 1, desca, info )
389 $
WRITE( nout, fmt = * )
'PCPOTRF INFO=', info
399 CALL pcchekpad( ictxt,
'PCPOTRF', np, nq,
400 $ mem( ipa-iprepad ), desca( lld_ ),
401 $ iprepad, ipostpad, padval )
408 lwork =
max( 1, 2*np ) +
409 $
max( 2, desca( nb_ )*
410 $
max( 1,
iceil( nprow-1, npcol ) ),
412 $
max( 1,
iceil( npcol-1, nprow ) ) )
413 ipw2 = ipw + lwork + ipostpad + iprepad
414 lrwork =
max( 1, 2*nq )
415 lw2 =
iceil( lrwork*realsz, cplxsz ) + ipostpad
418 IF( ipw2+lw2.GT.memsiz )
THEN
420 $
WRITE( nout, fmt = 9996 )
'cond est',
421 $ ( ipw2+lw2 )*cplxsz
427 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
430 IF( ierr( 1 ).GT.0 )
THEN
432 $
WRITE( nout, fmt = 9997 )
'MEMORY'
439 $ mem( ipw-iprepad ), lwork,
440 $ iprepad, ipostpad, padval )
442 $ mem( ipw2-iprepad ),
443 $ lw2-ipostpad, iprepad,
449 CALL pcpocon( uplo, n, mem( ipa ), 1, 1, desca,
450 $ anorm1, rcond, mem( ipw ), lwork,
451 $ mem( ipw2 ), lrwork, info )
454 CALL pcchekpad( ictxt,
'PCPOCON', np, nq,
455 $ mem( ipa-iprepad ), desca( lld_ ),
456 $ iprepad, ipostpad, padval )
458 $ lwork, 1, mem( ipw-iprepad ),
459 $ lwork, iprepad, ipostpad,
463 $ mem( ipw2-iprepad ), lw2-ipostpad,
464 $ iprepad, ipostpad, padval )
480 CALL descinit( descb, n, nrhs, nb, nbrhs, 0, 0,
481 $ ictxt,
max( 1, np )+imidpad,
486 myrhs =
numroc( descb( n_ ), descb( nb_ ), mycol,
487 $ descb( csrc_ ), npcol )
491 ipb0 = ipb + descb( lld_ )*myrhs + ipostpad +
493 ipferr = ipb0 + descb( lld_ )*myrhs + ipostpad
495 ipberr = myrhs + ipferr + ipostpad + iprepad
496 ipw = myrhs + ipberr + ipostpad + iprepad
498 ipw = ipb + descb( lld_ )*myrhs + ipostpad +
508 worksiz =
max( worksiz-ipostpad,
509 $ nq * nbrhs + np * nbrhs +
510 $
max(
max( nq*nb, 2*nbrhs ),
513 worksiz = ipostpad + worksiz
519 IF( ipw+worksiz.GT.memsiz )
THEN
521 $
WRITE( nout, fmt = 9996 )
'solve',
522 $ ( ipw+worksiz )*cplxsz
528 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
531 IF( ierr( 1 ).GT.0 )
THEN
533 $
WRITE( nout, fmt = 9997 )
'MEMORY'
540 CALL pcmatgen( ictxt,
'No',
'No', descb( m_ ),
541 $ descb( n_ ), descb( mb_ ),
542 $ descb( nb_ ), mem( ipb ),
543 $ descb( lld_ ), descb( rsrc_ ),
544 $ descb( csrc_ ), ibseed, 0, np, 0,
545 $ myrhs, myrow, mycol, nprow, npcol )
549 $ mem( ipb-iprepad ),
551 $ iprepad, ipostpad, padval )
554 CALL pcmatgen( ictxt,
'No',
'No', descb( m_ ),
555 $ descb( n_ ), descb( mb_ ),
556 $ descb( nb_ ), mem( ipb0 ),
557 $ descb( lld_ ), descb( rsrc_ ),
558 $ descb( csrc_ ), ibseed, 0, np, 0,
559 $ myrhs, myrow, mycol, nprow,
564 $ mem( ipb0-iprepad ),
565 $ descb( lld_ ), iprepad,
568 $ mem( ipferr-iprepad ), 1,
572 $ mem( ipberr-iprepad
578 CALL blacs_barrier( ictxt,
'All' )
583 CALL pcpotrs( uplo, n, nrhs, mem( ipa ), 1, 1,
584 $ desca, mem( ipb ), 1, 1, descb,
593 CALL pcchekpad( ictxt,
'PCPOTRS', np, nq,
594 $ mem( ipa-iprepad ),
596 $ iprepad, ipostpad, padval )
598 $ myrhs, mem( ipb-iprepad ),
599 $ descb( lld_ ), iprepad,
602 CALL pcfillpad( ictxt, worksiz-ipostpad, 1,
603 $ mem( ipw-iprepad ),
604 $ worksiz-ipostpad, iprepad,
609 CALL pclaschk(
'Herm',
'Diag', n, nrhs,
610 $ mem( ipb ), 1, 1, descb,
611 $ iaseed, 1, 1, desca, ibseed,
612 $ anorm, sresid, mem( ipw ) )
614 IF( iam.EQ.0 .AND. sresid.GT.thresh )
615 $
WRITE( nout, fmt = 9985 ) sresid
620 $ myrhs, mem( ipb-iprepad ),
621 $ descb( lld_ ), iprepad,
624 $ worksiz-ipostpad, 1,
625 $ mem( ipw-iprepad ),
626 $ worksiz-ipostpad, iprepad,
631 IF( ( sresid.LE.thresh ).AND.
632 $ ( (sresid-sresid).EQ.0.0e+0 ) )
THEN
641 sresid = sresid - sresid
649 lwork =
max( 1, 2*np )
650 ipw2 = ipw + lwork + ipostpad + iprepad
651 lrwork =
max( 1, np )
652 lw2 =
iceil( lrwork*realsz, cplxsz ) +
656 IF( ipw2+lw2.GT.memsiz )
THEN
658 $
WRITE( nout, fmt = 9996 )
659 $
'iter ref', ( ipw2+lw2 )*cplxsz
665 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
668 IF( ierr( 1 ).GT.0 )
THEN
670 $
WRITE( nout, fmt = 9997 )
678 $ mem( ipw-iprepad ),
679 $ lwork, iprepad, ipostpad,
682 $ 1, mem( ipw2-iprepad ),
691 CALL pcporfs( uplo, n, nrhs, mem( ipa0 ),
692 $ 1, 1, desca, mem( ipa ), 1, 1,
693 $ desca, mem( ipb0 ), 1, 1,
694 $ descb, mem( ipb ), 1, 1, descb,
695 $ mem( ipferr ), mem( ipberr ),
696 $ mem( ipw ), lwork, mem( ipw2 ),
703 $ nq, mem( ipa0-iprepad ),
704 $ desca( lld_ ), iprepad,
707 $ nq, mem( ipa-iprepad ),
708 $ desca( lld_ ), iprepad,
711 $ myrhs, mem( ipb-iprepad ),
716 $ mem( ipb0-iprepad ),
717 $ descb( lld_ ), iprepad,
721 $ mem( ipferr-iprepad ), 1,
726 $ mem( ipberr-iprepad ), 1,
730 $ 1, mem( ipw-iprepad
731 $ lwork, iprepad, ipostpad,
735 $ mem( ipw2-iprepad ),
741 $ 1, mem( ipw-iprepad ),
742 $ worksiz-ipostpad, iprepad,
747 CALL pclaschk(
'Herm',
'Diag', n, nrhs,
748 $ mem( ipb ), 1, 1, descb,
749 $ iaseed, 1, 1, desca,
750 $ ibseed, anorm, sresid2,
753 IF( iam.EQ.0 .AND. sresid2.GT.thresh )
754 $
WRITE( nout, fmt = 9985 ) sresid2
759 $ myrhs, mem( ipb-iprepad ),
760 $ descb( lld_ ), iprepad,
763 $ worksiz-ipostpad, 1,
764 $ mem( ipw-iprepad ),
773 CALL slcombine( ictxt, 'all
', '>
', 'w
', 2, 1,
775 CALL SLCOMBINE( ICTXT, 'all
', '>
', 'c
', 2, 1,
780.EQ..AND..EQ.
IF( MYROW0 MYCOL0 ) THEN
784 NOPS = 4.0D+0*(DBLE(N)**3)/3.0D+0 +
785 $ 3.0D+0*(DBLE(N)**2)
789 NOPS = NOPS + 8.0D+0*(DBLE(N)**2)*DBLE(NRHS)
796.GT.
IF( WTIME( 1 ) + WTIME( 2 ) 0.0D+0 ) THEN
798 $ ( ( WTIME( 1 )+WTIME( 2 ) ) * 1.0D+6 )
803.GE.
IF( WTIME( 2 )0.0D+0 )
804 $ WRITE( NOUT, FMT = 9993 ) 'wall
', UPLO, N,
805 $ NB, NRHS, NBRHS, NPROW, NPCOL,
806 $ WTIME( 1 ), WTIME( 2 ), TMFLOPS,
811.GT.
IF( CTIME( 1 )+CTIME( 2 )0.0D+0 ) THEN
813 $ ( ( CTIME( 1 )+CTIME( 2 ) ) * 1.0D+6 )
818.GE.
IF( CTIME( 2 )0.0D+0 )
819 $ WRITE( NOUT, FMT = 9993 ) 'cpu
', UPLO, N,
820 $ NB, NRHS, NBRHS, NPROW, NPCOL,
821 $ CTIME( 1 ), CTIME( 2 ), TMFLOPS,
828.AND..GT.
IF( CHECK SRESIDTHRESH ) THEN
832 CALL PCPOTRRV( UPLO, N, MEM( IPA ), 1, 1, DESCA,
834 CALL PCLAFCHK( 'symm
', 'diag
', N, N, MEM( IPA ), 1, 1,
835 $ DESCA, IASEED, ANORM, FRESID,
840 CALL PCCHEKPAD( ICTXT, 'pcpotrrv', NP, NQ,
841 $ MEM( IPA-IPREPAD ), DESCA( LLD_ ),
842 $ IPREPAD, IPOSTPAD, PADVAL )
844 $ WORKSIZ-IPOSTPAD, 1,
845 $ MEM( IPW-IPREPAD ), WORKSIZ-IPOSTPAD,
846 $ IPREPAD, IPOSTPAD, PADVAL )
849 IF( LSAME( UPLO, 'l
' ) ) THEN
850 WRITE( NOUT, FMT = 9986 ) 'l*l
''', FRESID
852 WRITE( NOUT, FMT = 9986 ) 'u
''*u
', FRESID
859 CALL BLACS_GRIDEXIT( ICTXT )
866 KTESTS = KPASS + KFAIL + KSKIP
867 WRITE( NOUT, FMT = * )
868 WRITE( NOUT, FMT = 9992 ) KTESTS
870 WRITE( NOUT, FMT = 9991 ) KPASS
871 WRITE( NOUT, FMT = 9989 ) KFAIL
873 WRITE( NOUT, FMT = 9990 ) KPASS
875 WRITE( NOUT, FMT = 9988 ) KSKIP
876 WRITE( NOUT, FMT = * )
877 WRITE( NOUT, FMT = * )
878 WRITE( NOUT, FMT = 9987 )
879.NE..AND..NE.
IF( NOUT6 NOUT0 )
885 9999 FORMAT( 'illegal
', A6, ':
', A5, ' =
', I3,
886 $ '; it should be at least 1
' )
887 9998 FORMAT( 'illegal grid: nprow*npcol =
', I4, '. it can be at most
',
889 9997 FORMAT( 'bad
', A6, ' parameters: going on to next test case.
' )
890 9996 FORMAT( 'unable to perform
', A, ': need totmem of at least
',
892 9995 FORMAT( 'time uplo n nb nrhs nbrhs p q llt time
',
893 $ 'slv time mflops check
' )
894 9994 FORMAT( '---- ---- ----- --- ---- ----- ---- ---- --------
',
895 $ '-------- -------- ------
' )
896 9993 FORMAT( A4, 4X, A1, 1X, I5, 1X, I3, 1X, I4, 1X, I5, 1X, I4, 1X,
897 $ I4, 1X, F8.2, 1X, F8.2, 1X, F8.2, 1X, A6 )
898 9992 FORMAT( 'finished
', I6, ' tests, with
the following results:
' )
899 9991 FORMAT( I5, ' tests completed and passed residual checks.
' )
900 9990 FORMAT( I5, ' tests completed without checking.
' )
901 9989 FORMAT( I5, ' tests completed and failed residual checks.
' )
902 9988 FORMAT( I5, ' tests skipped because of illegal input values.
' )
903 9987 FORMAT( 'END OF TESTS.
' )
904 9986 FORMAT( '||A -
', A4, '|| / (||A|| * N * eps) =
', G25.7 )
905 9985 FORMAT( '||Ax-b||/(||x||*||A||*eps*N)
', F25.7 )
subroutine pclafchk(aform, diag, m, n, a, ia, ja, desca, iaseed, anorm, fresid, work)
subroutine pcmatgen(ictxt, aform, diag, m, n, mb, nb, a, lda, iarow, iacol, iseed, iroff, irnum, icoff, icnum, myrow, mycol, nprow, npcol)
end diagonal values have been computed in the(sparse) matrix id.SOL
logical function lsame(ca, cb)
LSAME
integer function iceil(inum, idenom)
integer function ilcm(m, n)
subroutine blacs_gridinit(cntxt, c, nprow, npcol)
subroutine pcpotrf(uplo, n, a, ia, ja, desca, info)
subroutine pcpotrs(uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, 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 pcchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pcfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pcgetrrv(m, n, a, ia, ja, desca, ipiv, work)
real function pclanhe(norm, uplo, n, a, ia, ja, desca, work)
subroutine pclaschk(symm, diag, n, nrhs, x, ix, jx, descx, iaseed, ia, ja, desca, ibseed, anorm, resid, work)
subroutine pclltinfo(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 pcpocon(uplo, n, a, ia, ja, desca, anorm, rcond, work, lwork, rwork, lrwork, info)
subroutine pcporfs(uplo, n, nrhs, a, ia, ja, desca, af, iaf, jaf, descaf, b, ib, jb, descb, x, ix, jx, descx, ferr, berr, work, lwork, rwork, lrwork, info)
subroutine pcpotrrv(uplo, n, a, ia, ja, desca, work)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)