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 intgsz, memsiz, ntests, realsz, totmem
75 parameter( intgsz = 4, realsz = 4, totmem = 2000000,
76 $ memsiz = totmem / realsz, ntests = 20,
77 $ padval = -9923.0e+0, zero = 0.0e+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, nq, nrhs, worksiz
91 REAL anorm, anorm1, fresid, rcond, sresid, sresid2,
93 DOUBLE PRECISION nops, tmflops
96 INTEGER desca( dlen_ ), descb( dlen_ ), ierr( 1 ),
97 $ nbrval( ntests ), nbval( ntests ),
98 $ nrval( ntests ), nval( ntests ),
99 $ pval( ntests ), qval( ntests )
101 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
104 EXTERNAL blacs_barrier, blacs_exit, blacs_gridexit,
105 $ blacs_gridinfo, blacs_gridinit,
descinit,
122 DATA kfail, kpass, kskip, ktests / 4*0 /
128 CALL blacs_pinfo( iam, nprocs )
131 CALL pslltinfo( outfile, nout, uplo, nmat, nval, ntests, nnb,
132 $ nbval, ntests, nnr, nrval, ntests, nnbr, nbrval,
133 $ ntests, ngrids, pval, ntests, qval, ntests,
134 $ thresh, est, mem, iam, nprocs )
135 check = ( thresh.GE.0.0e+0 )
140 WRITE( nout, fmt = * )
141 WRITE( nout, fmt = 9995 )
142 WRITE( nout, fmt = 9994 )
143 WRITE( nout, fmt = * )
156 IF( nprow.LT.1 )
THEN
158 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
160 ELSE IF( npcol.LT.1 )
THEN
162 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
164 ELSE IF( nprow*npcol.GT.nprocs )
THEN
166 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
170 IF( ierr( 1 ).GT.0 )
THEN
172 $
WRITE( nout, fmt = 9997 )
'grid'
179 CALL blacs_get( -1, 0, ictxt )
180 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
181 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
186 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
198 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
200 ELSE IF( n.LT.1 )
THEN
202 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
208 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
210 IF( ierr( 1 ).GT.0 )
THEN
212 $
WRITE( nout, fmt = 9997 )
'matrix'
227 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
232 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
234 IF( ierr( 1 ).GT.0 )
THEN
236 $
WRITE( nout, fmt = 9997 )
'NB'
243 np =
numroc( n, nb, myrow, 0, nprow )
244 nq =
numroc( n, nb, mycol, 0, npcol )
246 iprepad =
max( nb, np )
248 ipostpad =
max( nb, nq )
257 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
258 $
max( 1, np )+imidpad, ierr( 1 ) )
262 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
264 IF( ierr( 1 ).LT.0 )
THEN
266 $
WRITE( nout, fmt = 9997 )
'descriptor'
276 ipa0 = ipa + desca( lld_ )*nq + ipostpad + iprepad
277 ipw = ipa0 + desca( lld_ )*nq + ipostpad + iprepad
279 ipw = ipa + desca( lld_ )*nq + ipostpad + iprepad
289 worksiz = np * desca( nb_ )
291 worksiz =
max( worksiz, desca( mb_ ) * desca( nb_ ) )
293 lcm =
ilcm( nprow, npcol )
294 itemp =
max( 2, 2 * nq ) + np
295 IF( nprow.NE.npcol )
THEN
299 worksiz =
max( worksiz, itemp )
300 worksiz = worksiz + ipostpad
311 IF( ipw+worksiz.GT.memsiz )
THEN
313 $
WRITE( nout, fmt = 9996 )
'factorization',
314 $ ( ipw+worksiz )*realsz
320 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
322 IF( ierr( 1 ).GT.0 )
THEN
324 $
WRITE( nout, fmt = 9997 )
'MEMORY'
331 CALL psmatgen( ictxt,
'Symm',
'Diag', desca( m_ ),
332 $ desca( n_ ), desca( mb_ ), desca( nb_ ),
333 $ mem( ipa ), desca( lld_ ), desca( rsrc_ ),
334 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
335 $ myrow, mycol, nprow, npcol )
340 CALL psfillpad( ictxt, np, nq, mem( ipa-iprepad ),
341 $ desca( lld_ ), iprepad, ipostpad,
343 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
344 $ mem( ipw-iprepad ), worksiz-ipostpad,
345 $ iprepad, ipostpad, padval )
346 anorm =
pslansy(
'I', uplo, n, mem( ipa ), 1, 1,
347 $ desca, mem( ipw ) )
348 anorm1 =
pslansy(
'1', uplo, n, mem( ipa ), 1, 1,
349 $ desca, mem( ipw ) )
350 CALL pschekpad( ictxt,
'PSLANSY', np, nq,
351 $ mem( ipa-iprepad ), desca( lld_ ),
352 $ iprepad, ipostpad, padval )
354 $ worksiz-ipostpad, 1,
355 $ mem( ipw-iprepad ), worksiz-ipostpad,
356 $ iprepad, ipostpad, padval )
360 CALL psmatgen( ictxt,
'Symm',
'Diag', desca( m_ ),
361 $ desca( n_ ), desca( mb_ ),
362 $ desca( nb_ ), mem( ipa0 ),
363 $ desca( lld_ ), desca( rsrc_ ),
364 $ desca( csrc_ ), iaseed, 0, np, 0, nq,
365 $ myrow, mycol, nprow, npcol )
368 $ mem( ipa0-iprepad ), desca( lld_ ),
369 $ iprepad, ipostpad, padval )
373 CALL blacs_barrier( ictxt,
'All' )
379 CALL pspotrf( uplo, n, mem( ipa ), 1, 1, desca, info )
385 $
WRITE( nout, fmt = * )
'PSPOTRF INFO=', info
395 CALL pschekpad( ictxt,
'PSPOTRF', np, nq,
396 $ mem( ipa-iprepad ), desca( lld_ ),
397 $ iprepad, ipostpad, padval )
404 lwork =
max( 1, 2*np ) +
max( 1, 2*nq ) +
405 $
max( 2, desca( nb_ )*
406 $
max( 1,
iceil( nprow-1, npcol ) ),
408 $
max( 1,
iceil( npcol-1, nprow ) ) )
409 ipw2 = ipw + lwork + ipostpad + iprepad
410 liwork =
max( 1, np )
411 lw2 =
iceil( liwork*intgsz, realsz ) + ipostpad
414 IF( ipw2+lw2.GT.memsiz )
THEN
416 $
WRITE( nout, fmt = 9996 )
'cond est',
417 $ ( ipw2+lw2 )*realsz
423 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
426 IF( ierr( 1 ).GT.0 )
THEN
428 $
WRITE( nout, fmt = 9997 )
'MEMORY'
435 $ mem( ipw-iprepad ), lwork,
436 $ iprepad, ipostpad, padval )
438 $ mem( ipw2-iprepad ),
439 $ lw2-ipostpad, iprepad,
445 CALL pspocon( uplo, n, mem( ipa ), 1, 1, desca,
446 $ anorm1, rcond, mem( ipw ), lwork,
447 $ mem( ipw2 ), liwork, info )
450 CALL pschekpad( ictxt,
'PSPOCON', np, nq,
451 $ mem( ipa-iprepad ), desca( lld_ ),
452 $ iprepad, ipostpad, padval )
454 $ lwork, 1, mem( ipw-iprepad ),
455 $ lwork, iprepad, ipostpad,
459 $ mem( ipw2-iprepad ), lw2-ipostpad,
460 $ iprepad, ipostpad, padval )
476 CALL descinit( descb, n, nrhs, nb, nbrhs, 0, 0,
477 $ ictxt,
max( 1, np )+imidpad,
482 myrhs =
numroc( descb( n_ ), descb( nb_ ), mycol,
483 $ descb( csrc_ ), npcol )
487 ipb0 = ipb + descb( lld_ )*myrhs + ipostpad +
489 ipferr = ipb0 + descb( lld_ )*myrhs + ipostpad
491 ipberr = myrhs + ipferr + ipostpad + iprepad
492 ipw = myrhs + ipberr + ipostpad + iprepad
494 ipw = ipb + descb( lld_ )*myrhs + ipostpad +
504 worksiz =
max( worksiz-ipostpad,
505 $ nq * nbrhs + np * nbrhs +
506 $
max(
max( nq*nb, 2*nbrhs ),
509 worksiz = ipostpad + worksiz
515 IF( ipw+worksiz.GT.memsiz )
THEN
517 $
WRITE( nout, fmt = 9996 )
'solve',
518 $ ( ipw+worksiz )*realsz
524 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
527 IF( ierr( 1 ).GT.0 )
THEN
529 $
WRITE( nout, fmt = 9997 )
'MEMORY'
536 CALL psmatgen( ictxt,
'No',
'No', descb( m_ ),
537 $ descb( n_ ), descb( mb_ ),
538 $ descb( nb_ ), mem( ipb ),
539 $ descb( lld_ ), descb( rsrc_ ),
540 $ descb( csrc_ ), ibseed, 0, np, 0,
541 $ myrhs, myrow, mycol, nprow, npcol )
545 $ mem( ipb-iprepad ),
547 $ iprepad, ipostpad, padval )
550 CALL psmatgen( ictxt,
'No',
'No', descb( m_ ),
551 $ descb( n_ ), descb( mb_ ),
552 $ descb( nb_ ), mem( ipb0 ),
553 $ descb( lld_ ), descb( rsrc_ ),
554 $ descb( csrc_ ), ibseed, 0, np, 0,
555 $ myrhs, myrow, mycol, nprow,
560 $ mem( ipb0-iprepad ),
561 $ descb( lld_ ), iprepad,
564 $ mem( ipferr-iprepad ), 1,
568 $ mem( ipberr-iprepad ), 1,
574 CALL blacs_barrier( ictxt,
'All' )
579 CALL pspotrs( uplo, n, nrhs, mem( ipa ), 1, 1,
580 $ desca, mem( ipb ), 1, 1, descb,
589 CALL pschekpad( ictxt,
'PSPOTRS', np, nq,
590 $ mem( ipa-iprepad ),
592 $ iprepad, ipostpad, padval )
594 $ myrhs, mem( ipb-iprepad ),
595 $ descb( lld_ ), iprepad,
598 CALL psfillpad( ictxt, worksiz-ipostpad, 1,
599 $ mem( ipw-iprepad ),
600 $ worksiz-ipostpad, iprepad,
605 CALL pslaschk(
'Symm',
'Diag', n, nrhs,
606 $ mem( ipb ), 1, 1, descb,
607 $ iaseed, 1, 1, desca, ibseed,
608 $ anorm, sresid, mem( ipw ) )
610 IF( iam.EQ.0 .AND. sresid.GT.thresh )
611 $
WRITE( nout, fmt = 9985 ) sresid
616 $ myrhs, mem( ipb-iprepad ),
617 $ descb( lld_ ), iprepad,
620 $ worksiz-ipostpad, 1,
621 $ mem( ipw-iprepad ),
622 $ worksiz-ipostpad, iprepad,
627 IF( ( sresid.LE.thresh ).AND.
628 $ ( (sresid-sresid).EQ.0.0e+0 ) )
THEN
637 sresid = sresid - sresid
645 lwork =
max( 1, 3*np )
646 ipw2 = ipw + lwork + ipostpad + iprepad
647 liwork =
max( 1, np )
648 lw2 =
iceil( liwork*intgsz, realsz ) +
652 IF( ipw2+lw2.GT.memsiz )
THEN
654 $
WRITE( nout, fmt = 9996 )
655 $
'iter ref', ( ipw2+lw2 )*realsz
661 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
664 IF( ierr( 1 ).GT.0 )
THEN
666 $
WRITE( nout, fmt = 9997 )
674 $ mem( ipw-iprepad ),
675 $ lwork, iprepad, ipostpad,
678 $ 1, mem( ipw2-iprepad ),
687 CALL psporfs( uplo, n, nrhs, mem( ipa0 ),
688 $ 1, 1, desca, mem( ipa ), 1, 1,
689 $ desca, mem( ipb0 ), 1, 1,
690 $ descb, mem( ipb ), 1, 1, descb,
691 $ mem( ipferr ), mem( ipberr ),
692 $ mem( ipw ), lwork, mem( ipw2 ),
699 $ nq, mem( ipa0-iprepad ),
700 $ desca( lld_ ), iprepad,
703 $ nq, mem( ipa-iprepad ),
704 $ desca( lld_ ), iprepad,
707 $ myrhs, mem( ipb-iprepad ),
708 $ descb( lld_ ), iprepad,
712 $ mem( ipb0-iprepad ),
713 $ descb( lld_ ), iprepad,
717 $ mem( ipferr-iprepad ), 1,
722 $ mem( ipberr-iprepad ), 1,
726 $ 1, mem( ipw-iprepad ),
727 $ lwork, iprepad, ipostpad,
731 $ mem( ipw2-iprepad ),
737 $ 1, mem( ipw-iprepad ),
738 $ worksiz-ipostpad, iprepad,
743 CALL pslaschk(
'Symm',
'Diag', n, nrhs,
744 $ mem( ipb ), 1, 1, descb,
745 $ iaseed, 1, 1, desca,
746 $ ibseed, anorm, sresid2,
749 IF( iam.EQ.0 .AND. sresid2.GT.thresh )
750 $
WRITE( nout, fmt = 9985 ) sresid2
755 $ myrhs, mem( ipb-iprepad ),
756 $ descb( lld_ ), iprepad,
759 $ worksiz-ipostpad, 1,
760 $ mem( ipw-iprepad ),
769 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
771 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
776 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
780 nops = (dble(n)**3)/3.0d+0 +
781 $ (dble(n)**2)/2.0d+0
785 nops = nops + 2.0d+0*(dble(n)**2)*dble(nrhs)
792 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
794 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
799 IF( wtime( 2 ).GE.0.0d+0 )
800 $
WRITE( nout, fmt = 9993 )
'WALL', uplo, n,
801 $ nb, nrhs, nbrhs, nprow, npcol,
802 $ wtime( 1 ), wtime( 2 ), tmflops,
807 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
809 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
814 IF( ctime( 2 ).GE.0.0d+0 )
815 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo, n,
816 $ nb, nrhs, nbrhs, nprow, npcol,
817 $ ctime( 1 ), ctime( 2 ), tmflops,
824 IF( check .AND. sresid.GT.thresh )
THEN
828 CALL pspotrrv( uplo, n, mem( ipa ), 1, 1, desca,
830 CALL pslafchk(
'Symm',
'Diag', n, n, mem( ipa ), 1, 1,
831 $ desca, iaseed, anorm, fresid,
836 CALL pschekpad( ictxt,
'PSPOTRRV', np, nq,
837 $ mem( ipa-iprepad ), desca( lld_ ),
838 $ iprepad, ipostpad, padval )
840 $ worksiz-ipostpad, 1,
841 $ mem( ipw-iprepad ), worksiz-ipostpad,
842 $ iprepad, ipostpad, padval )
845 IF(
lsame( uplo,
'L' ) )
THEN
846 WRITE( nout, fmt = 9986 )
'L*L''', fresid
848 WRITE( nout, fmt = 9986 )
'U''*U', fresid
855 CALL blacs_gridexit( ictxt )
862 ktests = kpass + kfail + kskip
863 WRITE( nout, fmt = * )
864 WRITE( nout, fmt = 9992 ) ktests
866 WRITE( nout, fmt = 9991 ) kpass
867 WRITE( nout, fmt = 9989 ) kfail
869 WRITE( nout, fmt = 9990 ) kpass
871 WRITE( nout, fmt = 9988 ) kskip
872 WRITE( nout, fmt = * )
873 WRITE( nout, fmt = * )
874 WRITE( nout, fmt = 9987 )
875 IF( nout.NE.6 .AND. nout.NE.0 )
881 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
882 $
'; It should be at least 1' )
883 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
885 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
886 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
888 9995
FORMAT(
'TIME UPLO N NB NRHS NBRHS P Q LLt Time ',
889 $
'Slv Time MFLOPS CHECK' )
890 9994
FORMAT(
'---- ---- ----- --- ---- ----- ---- ---- -------- ',
891 $
'-------- -------- ------' )
892 9993
FORMAT( a4, 4x, a1, 1x, i5, 1x, i3, 1x, i4, 1x, i5, 1x, i4, 1x,
893 $ i4, 1x, f8.2, 1x, f8.2, 1x, f8.2, 1x, a6 )
894 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
895 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
896 9990
FORMAT( i5,
' tests completed without checking.' )
897 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
898 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
899 9987
FORMAT(
'END OF TESTS.' )
900 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
901 9985
FORMAT(
'||Ax-b||/(||x||*||A||*eps*N) ', f25.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 iceil(inum, idenom)
integer function ilcm(m, n)
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)
real function pslansy(norm, uplo, n, a, ia, ja, desca, work)
subroutine pslaschk(symm, diag, n, nrhs, x, ix, jx, descx, iaseed, ia, ja, desca, ibseed, anorm, resid, work)
subroutine pslltinfo(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 pspocon(uplo, n, a, ia, ja, desca, anorm, rcond, work, lwork, iwork, liwork, info)
subroutine psporfs(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 pspotrf(uplo, n, a, ia, ja, desca, info)
subroutine pspotrrv(uplo, n, a, ia, ja, desca, work)
subroutine pspotrs(uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)