81 parameter( totmem = 3000000 )
83 parameter( intmem = 2048 )
84 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
85 $ lld_, mb_, m_, nb_, n_, rsrc_
86 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
87 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
88 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
91 INTEGER memsiz, ntests, zplxsz
93 parameter( zplxsz = 16,
94 $ memsiz = totmem / zplxsz, ntests = 20,
95 $ padval = ( -9923.0d+0, -9923.0d+0 ),
98 parameter( int_one = 1 )
105 INTEGER bwl, bwu, bw_num, fillin_size, free_ptr, h, hh,
106 $ i, iam, iaseed, ibseed, ictxt, ictxtb,
107 $ ierr_temp, imidpad, info, ipa, ipb, ipostpad,
108 $ iprepad, ipw, ipw_size, ipw_solve,
109 $ ipw_solve_size, ip_driver_w, ip_fillin, j, k,
110 $ kfail, kpass, kskip, ktests, mycol, myrhs_size,
111 $ myrow, n, nb, nbw, ngrids, nmat, nnb, nnbr,
112 $ nnr, nout, np, npcol, nprocs, nprocs_real,
113 $ nprow, nq, nrhs, n_first, n_last, worksiz
115 DOUBLE PRECISION anorm, nops, nops2, sresid, tmflops,
120 INTEGER bwlval( ntests ), bwuval( ntests ), desca( 7 ),
121 $ desca2d( dlen_ ), descb( 7 ), descb2d( dlen_ ),
122 $ ierr( 1 ), nbrval( ntests ), nbval( ntests ),
123 $ nrval( ntests ), nval( ntests ),
124 $ pval( ntests ), qval( ntests )
125 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
126 COMPLEX*16 mem( memsiz )
129 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
130 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
143 INTRINSIC dble,
max,
min, mod
146 DATA kfail, kpass, kskip, ktests / 4*0 /
155 CALL blacs_pinfo( iam, nprocs )
159 CALL pzgbinfo( outfile, nout, trans, nmat, nval, ntests, nbw,
160 $ bwlval, bwuval, ntests, nnb, nbval, ntests, nnr,
161 $ nrval, ntests, nnbr, nbrval, ntests, ngrids, pval,
162 $ ntests, qval, ntests, thresh, mem, iam, nprocs )
164 check = ( thresh.GE.0.0d+0 )
169 WRITE( nout, fmt = * )
170 WRITE( nout, fmt = 9995 )
171 WRITE( nout, fmt = 9994 )
172 WRITE( nout, fmt = * )
185 IF( nprow.LT.1 )
THEN
187 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
189 ELSE IF( npcol.LT.1 )
THEN
191 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
193 ELSE IF( nprow*npcol.GT.nprocs )
THEN
195 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
199 IF( ierr( 1 ).GT.0 )
THEN
201 $
WRITE( nout, fmt = 9997 )
'grid'
208 CALL blacs_get( -1, 0, ictxt )
209 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
214 CALL blacs_get( -1, 0, ictxtb )
215 CALL blacs_gridinit( ictxtb,
'Column-major', npcol, nprow )
220 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
222 IF( myrow.LT.0 .OR. mycol.LT.0 )
THEN
236 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
242 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
245 IF( ierr( 1 ).GT.0 )
THEN
247 $
WRITE( nout, fmt = 9997 )
'size'
253 DO 45 bw_num = 1, nbw
257 bwl = bwlval( bw_num )
260 $
WRITE( nout, fmt = 9999 )
'Lower Band',
'bwl', bwl
264 bwu = bwuval( bw_num )
267 $
WRITE( nout, fmt = 9999 )
'Upper Band',
'bwu', bwu
271 IF( bwl.GT.n-1 )
THEN
277 IF( bwu.GT.n-1 )
THEN
285 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
288 IF( ierr( 1 ).GT.0 )
THEN
299 nb =( (n-(npcol-1)*(bwl+bwu)-1)/npcol + 1 )
301 nb =
max( nb, 2*(bwl+bwu) )
309 IF( nb.GT.intmem )
THEN
312 WRITE( nout,* )
'You have chosen an '
313 $ ,
'NB > INTMEM in the driver.'
314 WRITE(nout, *)
'Please edit the driver '
315 $ ,
'and increase the value of INTMEM'
321 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
324 IF( ierr( 1 ).GT.0 )
THEN
331 np =
numroc( (2*bwl+2*bwu+1), (2*bwl+2*bwu+1),
333 nq =
numroc( n, nb, mycol, 0, npcol )
336 iprepad = ((2*bwl+2*bwu+1)+10)
338 ipostpad = ((2*bwl+2*bwu+1)+10)
347 CALL descinit( desca2d, (2*bwl+2*bwu+1), n,
348 $ (2*bwl+2*bwu+1), nb, 0, 0,
349 $ ictxt,((2*bwl+2*bwu+1)+10), ierr( 1 ) )
358 desca( 6 ) = ((2*bwl+2*bwu+1)+10)
361 ierr_temp = ierr( 1 )
363 ierr( 1 ) =
min( ierr( 1 ), ierr_temp )
367 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
369 IF( ierr( 1 ).LT.0 )
THEN
371 $
WRITE( nout, fmt = 9997 )
'descriptor'
383 free_ptr = free_ptr + iprepad
386 free_ptr = free_ptr + desca2d( lld_ )*
399 $ (nb+bwu)*(bwl+bwu)+6*(bwl+bwu)*(bwl+2*bwu)
403 free_ptr = free_ptr + iprepad
405 free_ptr = free_ptr + fillin_size
418 free_ptr = free_ptr + ipw_size
423 IF( free_ptr.GT.memsiz )
THEN
425 $
WRITE( nout, fmt = 9996 )
426 $
'divide and conquer factorization',
433 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
436 IF( ierr( 1 ).GT.0 )
THEN
438 $
WRITE( nout, fmt = 9997 )
'MEMORY'
444 worksiz =
max( ((2*bwl+2*bwu+1)+10), nb )
452 worksiz =
max( worksiz, desca2d( nb_ ) )
455 worksiz =
max( worksiz,
459 free_ptr = free_ptr + iprepad
460 ip_driver_w = free_ptr
461 free_ptr = free_ptr + worksiz + ipostpad
467 IF( free_ptr.GT.memsiz )
THEN
469 $
WRITE( nout, fmt = 9996 )
'factorization',
470 $ ( free_ptr )*zplxsz
476 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
479 IF( ierr( 1 ).GT.0 )
THEN
481 $
WRITE( nout, fmt = 9997 )
'MEMORY'
486 CALL pzbmatgen( ictxt,
'G',
'N', bwl, bwu, n,
487 $ (2*bwl+2*bwu+1), nb, mem( ipa+bwl+bwu ),
488 $ ((2*bwl+2*bwu+1)+10), 0, 0, iaseed,
489 $ myrow, mycol, nprow, npcol )
491 CALL pzfillpad( ictxt, np, nq, mem( ipa-iprepad ),
492 $ ((2*bwl+2*bwu+1)+10), iprepad, ipostpad,
496 $ mem( ip_driver_w-iprepad ), worksiz,
497 $ iprepad, ipostpad, padval )
503 anorm =
pzlange(
'1', (2*bwl+2*bwu+1),
504 $ n, mem( ipa ), 1, 1,
505 $ desca2d, mem( ip_driver_w ) )
506 CALL pzchekpad( ictxt,
'PZLANGE', np, nq,
507 $ mem( ipa-iprepad ), ((2*bwl+2*bwu+1)+10),
508 $ iprepad, ipostpad, padval )
511 $ mem( ip_driver_w-iprepad ), worksiz,
512 $ iprepad, ipostpad, padval )
517 CALL blacs_barrier( ictxt,
'All' )
523 CALL pzgbtrf( n, bwl, bwu, mem( ipa ), 1, desca, ipiv,
524 $ mem( ip_fillin ), fillin_size, mem( ipw ),
531 WRITE( nout, fmt = * )
'PZGBTRF INFO=', info
542 $ nq, mem( ipa-iprepad ), ((2*bwl+2*bwu+1)+10),
543 $ iprepad, ipostpad, padval )
557 CALL descinit( descb2d, n, nrhs, nb, 1, 0, 0,
558 $ ictxtb, nb+10, ierr( 1 ) )
567 descb( 6 ) = descb2d( lld_ )
572 IF( ipb .GT. 0 )
THEN
576 free_ptr = free_ptr + iprepad
578 free_ptr = free_ptr + nrhs*descb2d( lld_ )
583 ipw_solve_size = nrhs*(nb+2*bwl+4*bwu)
586 free_ptr = free_ptr + ipw_solve_size
589 IF( free_ptr.GT.memsiz )
THEN
591 $
WRITE( nout, fmt = 9996 )
'solve',
592 $ ( free_ptr )*zplxsz
598 CALL igsum2d( ictxt,
'All',
' ', 1, 1,
601 IF( ierr( 1 ).GT.0 )
THEN
603 $
WRITE( nout, fmt = 9997 )
'MEMORY'
608 myrhs_size =
numroc( n, nb, mycol, 0, npcol )
613 $ descb2d( m_ ), descb2d( n_ ),
614 $ descb2d( mb_ ), descb2d( nb_ ),
616 $ descb2d( lld_ ), descb2d( rsrc_ ),
618 $ ibseed, 0, myrhs_size, 0, nrhs, mycol,
619 $ myrow, npcol, nprow )
623 $ mem( ipb-iprepad ),
628 $ mem( ip_driver_w-iprepad ),
634 CALL blacs_barrier( ictxt,
'All')
639 CALL pzgbtrs( trans, n, bwl, bwu, nrhs, mem( ipa ),
640 $ 1, desca, ipiv, mem( ipb ), 1, descb,
641 $ mem( ip_fillin ), fillin_size,
642 $ mem( ipw_solve ), ipw_solve_size,
649 $
WRITE( nout, fmt = * )
'PZGBTRS INFO=', info
661 $ mem( ip_driver_w-iprepad ),
671 $ mem( ipb ), 1, 1, descb2d,
672 $ iaseed, mem( ipa+bwl+bwu ), 1, 1, desca2d,
673 $ ibseed, anorm, sresid,
674 $ mem( ip_driver_w ), worksiz )
677 IF( sresid.GT.thresh )
678 $
WRITE( nout, fmt = 9985 ) sresid
683 IF( ( sresid.LE.thresh ).AND.
684 $ ( (sresid-sresid).EQ.0.0d+0 ) )
THEN
699 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
701 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
706 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
712 nprocs_real = ( n-1 )/nb + 1
713 n_last = mod( n-1, nb ) + 1
718 nops = 2*(dble(n)*dble(bwl)*
720 $ (dble(n)*dble(bwl))
725 $ 2 * (dble(n)*(dble(bwl)+dble((bwl+bwu)))
730 nops = nops * dble(4)
737 nops2 = 2*( (dble(n_first)*
738 $ dble((bwl+bwu))*dble(bwu)))
740 IF ( nprocs_real .GT. 1)
THEN
746 $ 8*( (dble(n_last)*dble((bwl+bwu))
747 $ *dble((bwl+bwu))) )
750 IF ( nprocs_real .GT. 2)
THEN
754 nops2 = nops2 + (nprocs_real-2)*
755 $ 8*( (dble(nb)*dble((bwl+bwu))
756 $ *dble((bwl+bwu))) )
762 $ 2*( nprocs_real-1 ) *
763 $ ( (bwl+bwu)*(bwl+bwu)*(bwl+bwu)/3 )
764 IF( nprocs_real .GT. 1 )
THEN
766 $ 2*( nprocs_real-2 ) *
767 $ (2*(bwl+bwu)*(bwl+bwu)*(bwl+bwu))
780 $ ( dble(bwl)+dble((bwl+bwu)))
782 IF ( nprocs_real .GT. 1 )
THEN
790 $ (dble(n_last)*(dble((bwl+bwu))+
791 $ dble((bwl+bwu))))*dble(nrhs)
794 IF ( nprocs_real .GT. 2 )
THEN
801 $ ( nprocs_real-2)*2*
802 $ ( (dble(nb)*(dble((bwl+bwu))+
803 $ dble((bwl+bwu))))*dble(nrhs) )
809 $ nrhs*( nprocs_real-1)*2*((bwl+bwu)*(bwl+bwu) )
810 IF( nprocs_real .GT. 1 )
THEN
812 $ nrhs*( nprocs_real-2 ) *
813 $ ( 6 * (bwl+bwu)*(bwl+bwu) )
819 nops2 = nops2 * dble(4)
826 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
828 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
833 IF( wtime( 1 )+wtime( 2 ).GT.0.0d+0 )
THEN
835 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
840 IF( wtime( 2 ).GE.0.0d+0 )
841 $
WRITE( nout, fmt = 9993 )
'WALL', trans,
844 $ nb, nrhs, nprow, npcol,
845 $ wtime( 1 ), wtime( 2 ), tmflops,
850 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
852 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
857 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
859 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
864 IF( ctime( 2 ).GE.0.0d+0 )
865 $
WRITE( nout, fmt = 9993 )
'CPU ', trans,
868 $ nb, nrhs, nprow, npcol,
869 $ ctime( 1 ), ctime( 2 ), tmflops,
885 CALL blacs_gridexit( ictxt )
886 CALL blacs_gridexit( ictxtb )
896 ktests = kpass + kfail + kskip
897 WRITE( nout, fmt = * )
898 WRITE( nout, fmt = 9992 ) ktests
900 WRITE( nout, fmt = 9991 ) kpass
901 WRITE( nout, fmt = 9989 ) kfail
903 WRITE( nout, fmt = 9990 ) kpass
905 WRITE( nout, fmt = 9988 ) kskip
906 WRITE( nout, fmt = * )
907 WRITE( nout, fmt = * )
908 WRITE( nout, fmt = 9987 )
909 IF( nout.NE.6 .AND. nout.NE.0 )
915 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
916 $
'; It should be at least 1' )
917 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
919 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
920 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
922 9995
FORMAT(
'TIME TR N BWL BWU NB NRHS P Q L*U Time ',
923 $
'Slv Time MFLOPS MFLOP2 CHECK' )
924 9994
FORMAT(
'---- -- ------ --- --- ---- ----- ---- ---- -------- ',
925 $
'-------- -------- -------- ------' )
926 9993
FORMAT( a4,1x,a1,2x,i6,1x,i3,1x,i3,1x,i4,1x,i5,
927 $ 1x,i4,1x,i4,1x,f9.3,
928 $ f9.4, f9.2, f9.2, 1x, a6 )
929 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
930 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
931 9990
FORMAT( i5,
' tests completed without checking.' )
932 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
933 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
934 9987
FORMAT(
'END OF TESTS.' )
935 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
936 9985
FORMAT(
'||Ax-b||/(||x||*||A||*eps*N) ', f25.7 )
subroutine pzmatgen(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 pzbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine pzchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pzdblaschk(symm, uplo, trans, n, bwl, bwu, nrhs, x, ix, jx, descx, iaseed, a, ia, ja, desca, ibseed, anorm, resid, work, worksiz)
subroutine pzfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pzgbinfo(summry, nout, trans, nmat, nval, ldnval, nbw, bwlval, bwuval, ldbwval, nnb, nbval, ldnbval, nnr, nrval, ldnrval, nnbr, nbrval, ldnbrval, ngrids, pval, ldpval, qval, ldqval, thresh, work, iam, nprocs)
subroutine pzgbtrf(n, bwl, bwu, a, ja, desca, ipiv, af, laf, work, lwork, info)
subroutine pzgbtrs(trans, n, bwl, bwu, nrhs, a, ja, desca, ipiv, b, ib, descb, af, laf, work, lwork, info)
double precision function pzlange(norm, m, n, a, ia, ja, desca, work)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)