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 )
107 EXTERNAL blacs_barrier, blacs_exit, blacs_gridexit,
108 $ blacs_gridinfo, blacs_gridinit,
descinit,
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 )
183 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
184 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
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', 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 ), 1,
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 ),
712 $ descb( lld_ ), 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 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
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 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
798 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
803 IF( wtime( 2 ).GE.0.0d+0 )
804 $
WRITE( nout, fmt = 9993 )
'WALL', uplo, n,
805 $ nb, nrhs, nbrhs, nprow, npcol,
806 $ wtime( 1 ), wtime( 2 ), tmflops,
811 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
813 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
818 IF( ctime( 2 ).GE.0.0d+0 )
819 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo, n,
820 $ nb, nrhs, nbrhs, nprow, npcol,
821 $ ctime( 1 ), ctime( 2 ), tmflops,
828 IF( check .AND. sresid.GT.thresh )
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 IF( nout.NE.6 .AND. nout.NE.0 )
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)
subroutine descinit(desc, m, n, mb, nb, irsrc, icsrc, ictxt, lld, info)
integer function iceil(inum, idenom)
integer function ilcm(m, n)
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)
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 pcpotrf(uplo, n, a, ia, ja, desca, info)
subroutine pcpotrrv(uplo, n, a, ia, ja, desca, work)
subroutine pcpotrs(uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)