74 parameter( totmem = 3000000 )
75 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
76 $ lld_, mb_, m_, nb_, n_, rsrc_
77 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
78 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
79 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
82 INTEGER dblesz, memsiz, ntests
83 DOUBLE PRECISION padval
84 parameter( dblesz = 8,
85 $ memsiz = totmem / dblesz, ntests = 20,
86 $ padval = -9923.0d+0, zero = 0.0d+0 )
88 parameter( int_one = 1 )
95 INTEGER bw, bw_num, fillin_size, free_ptr, h, hh, i,
96 $ iam, iaseed, ibseed, ictxt, ictxtb, ierr_temp,
97 $ imidpad, info, int_temp, ipa, ipb, ipostpad,
98 $ iprepad, ipw, ipw_size, ipw_solve,
99 $ ipw_solve_size, ip_driver_w, ip_fillin, j, k,
100 $ kfail, kpass, kskip, ktests, mycol, myrhs_size,
101 $ myrow, n, nb, nbw, ngrids, nmat, nnb, nnbr,
102 $ nnr, nout, np, npcol, nprocs, nprocs_real,
103 $ nprow, nq, nrhs, n_first, n_last, worksiz
105 DOUBLE PRECISION anorm, nops, nops2, sresid, tmflops,
109 INTEGER bwval( ntests ), desca( 7 ), desca2d( dlen_ ),
110 $ descb( 7 ), descb2d( dlen_ ), ierr( 1 ),
111 $ nbrval( ntests ), nbval( ntests ),
112 $ nrval( ntests ), nval( ntests ),
113 $ pval( ntests ), qval( ntests )
114 DOUBLE PRECISION ctime( 2 ), mem( memsiz ), wtime( 2 )
117 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
118 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
131 INTRINSIC dble,
max,
min, mod
134 DATA kfail, kpass, kskip, ktests / 4*0 /
143 CALL blacs_pinfo( iam, nprocs )
147 CALL pdptinfo( outfile, nout, uplo, nmat, nval, ntests, nbw,
148 $ bwval, ntests, nnb, nbval, ntests, nnr, nrval,
149 $ ntests, nnbr, nbrval, ntests, ngrids, pval, ntests,
150 $ qval, ntests, thresh, mem, iam, nprocs )
152 check = ( thresh.GE.0.0d+0 )
157 WRITE( nout, fmt = * )
158 WRITE( nout, fmt = 9995 )
159 WRITE( nout, fmt = 9994 )
160 WRITE( nout, fmt = * )
173 IF( nprow.LT.1 )
THEN
175 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
177 ELSE IF( npcol.LT.1 )
THEN
179 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
181 ELSE IF( nprow*npcol.GT.nprocs )
THEN
183 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
187 IF( ierr( 1 ).GT.0 )
THEN
189 $
WRITE( nout, fmt = 9997 )
'grid'
196 CALL blacs_get( -1, 0, ictxt )
197 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
202 CALL blacs_get( -1, 0, ictxtb )
203 CALL blacs_gridinit( ictxtb,
'Column-major', npcol, nprow )
208 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
210 IF( myrow.LT.0 .OR. mycol.LT.0 )
THEN
224 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
230 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
233 IF( ierr( 1 ).GT.0 )
THEN
235 $
WRITE( nout, fmt = 9997 )
'size'
241 DO 45 bw_num = 1, nbw
248 $
WRITE( nout, fmt = 9999 )
'Band',
'bw', bw
258 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
261 IF( ierr( 1 ).GT.0 )
THEN
272 nb =( (n-(npcol-1)*int_one-1)/npcol + 1 )
274 nb =
max( nb, 2*int_one )
281 IF( nb.LT.
min( 2*int_one, n ) )
THEN
287 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
290 IF( ierr( 1 ).GT.0 )
THEN
299 nq =
numroc( n, nb, mycol, 0, npcol )
315 $ ictxtb, nb+10, ierr( 1 ) )
324 desca( 6 ) = ((2)+10)
327 ierr_temp = ierr( 1 )
329 ierr( 1 ) =
min( ierr( 1 ), ierr_temp )
333 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
335 IF( ierr( 1 ).LT.0 )
THEN
337 $
WRITE( nout, fmt = 9997 )
'descriptor'
349 free_ptr = free_ptr + iprepad
352 free_ptr = free_ptr + (nb+10)*(2)
368 free_ptr = free_ptr + iprepad
370 free_ptr = free_ptr + fillin_size
383 free_ptr = free_ptr + ipw_size
388 IF( free_ptr.GT.memsiz )
THEN
390 $
WRITE( nout, fmt = 9996 )
391 $
'divide and conquer factorization',
398 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
401 IF( ierr( 1 ).GT.0 )
THEN
403 $
WRITE( nout, fmt = 9997 )
'MEMORY'
409 worksiz =
max( ((2)+10), nb )
417 worksiz =
max( worksiz, desca2d( nb_ ) )
420 worksiz =
max( worksiz,
424 free_ptr = free_ptr + iprepad
425 ip_driver_w = free_ptr
426 free_ptr = free_ptr + worksiz + ipostpad
432 IF( free_ptr.GT.memsiz )
THEN
434 $
WRITE( nout, fmt = 9996 )
'factorization',
435 $ ( free_ptr )*dblesz
441 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
444 IF( ierr( 1 ).GT.0 )
THEN
446 $
WRITE( nout, fmt = 9997 )
'MEMORY'
451 CALL pdbmatgen( ictxt, uplo,
'T', bw, bw, n, (2), nb,
452 $ mem( ipa ), nb+10, 0, 0, iaseed, myrow,
453 $ mycol, nprow, npcol )
454 CALL pdfillpad( ictxt, nq, np, mem( ipa-iprepad ),
455 $ nb+10, iprepad, ipostpad,
459 $ mem( ip_driver_w-iprepad ), worksiz,
460 $ iprepad, ipostpad, padval )
467 $ (2), mem( ipa ), 1, 1,
468 $ desca2d, mem( ip_driver_w ) )
469 CALL pdchekpad( ictxt,
'PDLANGE', nq, np,
470 $ mem( ipa-iprepad ), nb+10,
471 $ iprepad, ipostpad, padval )
474 $ mem( ip_driver_w-iprepad ), worksiz,
475 $ iprepad, ipostpad, padval )
478 IF(
lsame( uplo,
'L' ) )
THEN
481 int_temp = desca2d( lld_ )
486 CALL blacs_barrier( ictxt,
'All' )
492 CALL pdpttrf( n, mem( ipa+int_temp ),
493 $ mem( ipa+1*( nb+10-int_temp ) ), 1, desca,
494 $ mem( ip_fillin ), fillin_size, mem( ipw ),
501 WRITE( nout, fmt = * )
'PDPTTRF INFO=', info
512 $ np, mem( ipa-iprepad ), nb+10,
513 $ iprepad, ipostpad, padval )
527 CALL descinit( descb2d, n, nrhs, nb, 1, 0, 0,
528 $ ictxtb, nb+10, ierr( 1 ) )
537 descb( 6 ) = descb2d( lld_ )
542 IF( ipb .GT. 0 )
THEN
546 free_ptr = free_ptr + iprepad
548 free_ptr = free_ptr + nrhs*descb2d( lld_ )
553 ipw_solve_size = (10+2*
min(100,nrhs))*npcol+4*nrhs
556 free_ptr = free_ptr + ipw_solve_size
559 IF( free_ptr.GT.memsiz )
THEN
561 $
WRITE( nout, fmt = 9996 )
'solve',
562 $ ( free_ptr )*dblesz
568 CALL igsum2d( ictxt,
'All',
' ', 1, 1,
571 IF( ierr( 1 ).GT.0 )
THEN
573 $
WRITE( nout, fmt = 9997 )
'MEMORY'
578 myrhs_size =
numroc( n, nb, mycol, 0, npcol )
583 $ descb2d( m_ ), descb2d( n_ ),
584 $ descb2d( mb_ ), descb2d( nb_ ),
586 $ descb2d( lld_ ), descb2d( rsrc_ ),
588 $ ibseed, 0, myrhs_size, 0, nrhs, mycol,
589 $ myrow, npcol, nprow )
593 $ mem( ipb-iprepad ),
598 $ mem( ip_driver_w-iprepad ),
604 CALL blacs_barrier( ictxt,
'All')
609 CALL pdpttrs( n, nrhs, mem( ipa+int_temp ),
610 $ mem( ipa+1*( nb+10-int_temp ) ), 1,
611 $ desca, mem( ipb ), 1, descb,
612 $ mem( ip_fillin ), fillin_size,
613 $ mem( ipw_solve ), ipw_solve_size,
620 $
WRITE( nout, fmt = * )
'PDPTTRS INFO=', info
632 $ mem( ip_driver_w-iprepad ),
645 $ ictxt, (2), ierr( 1 ) )
647 $ mem( ipb ), 1, 1, descb2d,
648 $ iaseed, mem( ipa ), 1, 1, desca2d,
649 $ ibseed, anorm, sresid,
650 $ mem( ip_driver_w ), worksiz )
653 IF( sresid.GT.thresh )
654 $
WRITE( nout, fmt = 9985 ) sresid
659 IF( ( sresid.LE.thresh ).AND.
660 $ ( (sresid-sresid).EQ.0.0d+0 ) )
THEN
675 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
677 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
682 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
688 nprocs_real = ( n-1 )/nb + 1
689 n_last = mod( n-1, nb ) + 1
692 nops = nops + dble(bw)*( -2.d0 / 3.d0+dble(bw)*
693 $ ( -1.d0+dble(bw)*( -1.d0 / 3.d0 ) ) ) +
694 $ dble(n)*( 1.d0+dble(bw)*( 3.d0 /
695 $ 2.d0+dble(bw)*( 1.d0 / 2.d0 ) ) )
696 nops = nops + dble(bw)*( -1.d0 / 6.d0+dble(bw)
697 $ *( -1.d0 /2.d0+dble(bw)
698 $ *( -1.d0 / 3.d0 ) ) ) +
699 $ dble(n)*( dble(bw) /
700 $ 2.d0*( 1.d0+dble(bw) ) )
703 $ dble(nrhs)*( ( 2*dble(n)-dble(bw) )*
704 $ ( dble(bw)+1.d0 ) )+ dble(nrhs)*
705 $ ( dble(bw)*( 2*dble(n)-
706 $ ( dble(bw)+1.d0 ) ) )
713 nops2 = ( (dble(n_first))* dble(bw)**2 )
715 IF ( nprocs_real .GT. 1)
THEN
720 $ 4*( (dble(n_last)*dble(bw)**2) )
723 IF ( nprocs_real .GT. 2)
THEN
727 nops2 = nops2 + (nprocs_real-2)*
728 $ 4*( (dble(nb)*dble(bw)**2) )
734 $ ( nprocs_real-1 ) * ( bw*bw*bw/3 )
735 IF( nprocs_real .GT. 1 )
THEN
737 $ ( nprocs_real-2 ) * ( 2 * bw*bw*bw )
744 $ ( 4.0d+0*(dble(n_first)*dble(bw))*dble(nrhs) )
746 IF ( nprocs_real .GT. 1 )
THEN
751 $ 2*( 4.0d+0*(dble(n_last)*dble(bw))*dble(nrhs) )
754 IF ( nprocs_real .GT. 2 )
THEN
759 $ ( nprocs_real-2)*2*
760 $ ( 4.0d+0*(dble(nb)*dble(bw))*dble(nrhs) )
766 $ nrhs*( nprocs_real-1 ) * ( bw*bw )
767 IF( nprocs_real .GT. 1 )
THEN
769 $ nrhs*( nprocs_real-2 ) * ( 3 * bw*bw )
778 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
780 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
785 IF( wtime( 1 )+wtime( 2 ).GT.0.0d+0 )
THEN
787 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
792 IF( wtime( 2 ).GE.0.0d+0 )
793 $
WRITE( nout, fmt = 9993 )
'WALL', uplo,
796 $ nb, nrhs, nprow, npcol,
797 $ wtime( 1 ), wtime( 2 ), tmflops,
802 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
804 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
809 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
811 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
816 IF( ctime( 2 ).GE.0.0d+0 )
817 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo,
820 $ nb, nrhs, nprow, npcol,
821 $ ctime( 1 ), ctime( 2 ), tmflops,
837 CALL blacs_gridexit( ictxt )
838 CALL blacs_gridexit( ictxtb )
848 ktests = kpass + kfail + kskip
849 WRITE( nout, fmt = * )
850 WRITE( nout, fmt = 9992 ) ktests
852 WRITE( nout, fmt = 9991 ) kpass
853 WRITE( nout, fmt = 9989 ) kfail
855 WRITE( nout, fmt = 9990 ) kpass
857 WRITE( nout, fmt = 9988 ) kskip
858 WRITE( nout, fmt = * )
859 WRITE( nout, fmt = * )
860 WRITE( nout, fmt = 9987 )
861 IF( nout.NE.6 .AND. nout.NE.0 )
867 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
868 $
'; It should be at least 1' )
869 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
871 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
872 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
874 9995
FORMAT(
'TIME UL N BW NB NRHS P Q L*U Time ',
875 $
'Slv Time MFLOPS MFLOP2 CHECK' )
876 9994
FORMAT(
'---- -- ------ --- ---- ----- -- ---- -------- ',
877 $
'-------- ------ ------ ------' )
878 9993
FORMAT( a4, 2x, a1, 1x, i6, 1x, i3, 1x, i4, 1x,
880 $ i4, 1x, f8.3, f9.4, f9.2, f9.2, 1x, a6 )
881 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
882 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
883 9990
FORMAT( i5,
' tests completed without checking.' )
884 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
885 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
886 9987
FORMAT(
'END OF TESTS.' )
887 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
888 9985
FORMAT(
'||Ax-b||/(||x||*||A||*eps*N) ', f25.7 )
subroutine pdmatgen(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 numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pdbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine pdchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pdfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
double precision function pdlange(norm, m, n, a, ia, ja, desca, work)
subroutine pdptinfo(summry, nout, uplo, nmat, nval, ldnval, nbw, bwval, ldbwval, nnb, nbval, ldnbval, nnr, nrval, ldnrval, nnbr, nbrval, ldnbrval, ngrids, pval, ldpval, qval, ldqval, thresh, work, iam, nprocs)
subroutine pdptlaschk(symm, uplo, n, bwl, bwu, nrhs, x, ix, jx, descx, iaseed, a, ia, ja, desca, ibseed, anorm, resid, work, worksiz)
subroutine pdpttrf(n, d, e, ja, desca, af, laf, work, lwork, info)
subroutine pdpttrs(n, nrhs, d, e, ja, desca, b, ib, descb, af, laf, work, lwork, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)