75 parameter( totmem = 3000000 )
76 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
77 $ lld_, mb_, m_, nb_, n_, rsrc_
78 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
79 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
80 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
83 INTEGER memsiz, ntests, zplxsz
85 parameter( zplxsz = 16,
86 $ memsiz = totmem / zplxsz, ntests = 20,
87 $ padval = ( -9923.0d+0, -9923.0d+0 ),
90 parameter( int_one = 1 )
97 INTEGER bw, bw_num, fillin_size, free_ptr, h, hh, i,
98 $ iam, iaseed, ibseed, ictxt, ictxtb, ierr_temp,
99 $ imidpad, info, ipa, ipb, ipostpad, iprepad,
100 $ ipw, ipw_size, ipw_solve, ipw_solve_size,
101 $ ip_driver_w, ip_fillin, j, k, kfail, kpass,
102 $ kskip, ktests, mycol, myrhs_size, myrow, n, nb,
103 $ nbw, ngrids, nmat, nnb, nnbr, nnr, nout, np,
104 $ npcol, nprocs, nprocs_real, nprow, nq, nrhs,
105 $ n_first, n_last, worksiz
107 DOUBLE PRECISION anorm, nops, nops2, sresid, tmflops,
111 INTEGER bwval( ntests ), desca( 7 ), desca2d( dlen_ ),
112 $ descb( 7 ), descb2d( dlen_ ), ierr( 1 ),
113 $ nbrval( ntests ), nbval( ntests ),
114 $ nrval( ntests ), nval( ntests ),
115 $ pval( ntests ), qval( ntests )
116 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
117 COMPLEX*16 mem( memsiz )
120 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
121 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
134 INTRINSIC dble,
max,
min, mod
137 DATA kfail, kpass, kskip, ktests / 4*0 /
146 CALL blacs_pinfo( iam, nprocs )
150 CALL pzpbinfo( outfile, nout, uplo, nmat, nval, ntests, nbw,
151 $ bwval, ntests, nnb, nbval, ntests, nnr, nrval,
152 $ ntests, nnbr, nbrval, ntests, ngrids, pval, ntests,
153 $ qval, ntests, thresh, mem, iam, nprocs )
155 check = ( thresh.GE.0.0d+0 )
160 WRITE( nout, fmt = * )
161 WRITE( nout, fmt = 9995 )
162 WRITE( nout, fmt = 9994 )
163 WRITE( nout, fmt = * )
176 IF( nprow.LT.1 )
THEN
178 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
180 ELSE IF( npcol.LT.1 )
THEN
182 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
184 ELSE IF( nprow*npcol.GT.nprocs )
THEN
186 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
190 IF( ierr( 1 ).GT.0 )
THEN
192 $
WRITE( nout, fmt = 9997 )
'grid'
199 CALL blacs_get( -1, 0, ictxt )
200 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
205 CALL blacs_get( -1, 0, ictxtb )
206 CALL blacs_gridinit( ictxtb,
'Column-major', npcol, nprow )
211 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
213 IF( myrow.LT.0 .OR. mycol.LT.0 )
THEN
227 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
233 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
236 IF( ierr( 1 ).GT.0 )
THEN
238 $
WRITE( nout, fmt = 9997 )
'size'
244 DO 45 bw_num = 1, nbw
251 $
WRITE( nout, fmt = 9999 )
'Band',
'bw', bw
261 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
264 IF( ierr( 1 ).GT.0 )
THEN
275 nb =( (n-(npcol-1)*bw-1)/npcol + 1 )
284 IF( nb.LT.
min( 2*bw, n ) )
THEN
290 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
293 IF( ierr( 1 ).GT.0 )
THEN
300 np =
numroc( (bw+1), (bw+1),
302 nq =
numroc( n, nb, mycol, 0, npcol )
305 iprepad = ((bw+1)+10)
307 ipostpad = ((bw+1)+10)
318 $ ictxt,((bw+1)+10), ierr( 1 ) )
327 desca( 6 ) = ((bw+1)+10)
330 ierr_temp = ierr( 1 )
332 ierr( 1 ) =
min( ierr( 1 ), ierr_temp )
336 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
338 IF( ierr( 1 ).LT.0 )
THEN
340 $
WRITE( nout, fmt = 9997 )
'descriptor'
352 free_ptr = free_ptr + iprepad
355 free_ptr = free_ptr + desca2d( lld_ )*
372 free_ptr = free_ptr + iprepad
374 free_ptr = free_ptr + fillin_size
387 free_ptr = free_ptr + ipw_size
392 IF( free_ptr.GT.memsiz )
THEN
394 $
WRITE( nout, fmt = 9996 )
395 $
'divide and conquer factorization',
402 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
405 IF( ierr( 1 ).GT.0 )
THEN
407 $
WRITE( nout, fmt = 9997 )
'MEMORY'
413 worksiz =
max( ((bw+1)+10), nb )
421 worksiz =
max( worksiz, desca2d( nb_ ) )
424 worksiz =
max( worksiz,
425 $
max(5,
max(bw*(bw+2),nb))+2*nb )
428 free_ptr = free_ptr + iprepad
429 ip_driver_w = free_ptr
430 free_ptr = free_ptr + worksiz + ipostpad
436 IF( free_ptr.GT.memsiz )
THEN
438 $
WRITE( nout, fmt = 9996 )
'factorization',
439 $ ( free_ptr )*zplxsz
445 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
448 IF( ierr( 1 ).GT.0 )
THEN
450 $
WRITE( nout, fmt = 9997 )
'MEMORY'
455 CALL pzbmatgen( ictxt, uplo,
'B', bw, bw, n, (bw+1), nb,
456 $ mem( ipa ), ((bw+1)+10), 0, 0, iaseed,
457 $ myrow, mycol, nprow, npcol )
459 CALL pzfillpad( ictxt, np, nq, mem( ipa-iprepad ),
460 $ ((bw+1)+10), iprepad, ipostpad,
464 $ mem( ip_driver_w-iprepad ), worksiz,
465 $ iprepad, ipostpad, padval )
472 $ n, mem( ipa ), 1, 1,
473 $ desca2d, mem( ip_driver_w ) )
474 CALL pzchekpad( ictxt,
'PZLANGE', np, nq,
475 $ mem( ipa-iprepad ), ((bw+1)+10),
476 $ iprepad, ipostpad, padval )
479 $ mem( ip_driver_w-iprepad ), worksiz,
480 $ iprepad, ipostpad, padval )
485 CALL blacs_barrier( ictxt,
'All' )
491 CALL pzpbtrf( uplo, n, bw, mem( ipa ), 1, desca,
492 $ mem( ip_fillin ), fillin_size, mem( ipw ),
499 WRITE( nout, fmt = * )
'PZPBTRF INFO=', info
510 $ nq, mem( ipa-iprepad ), ((bw+1)+10),
511 $ iprepad, ipostpad, padval )
525 CALL descinit( descb2d, n, nrhs, nb, 1, 0, 0,
526 $ ictxtb, nb+10, ierr( 1 ) )
535 descb( 6 ) = descb2d( lld_ )
540 IF( ipb .GT. 0 )
THEN
544 free_ptr = free_ptr + iprepad
546 free_ptr = free_ptr + nrhs*descb2d( lld_ )
551 ipw_solve_size = (bw*nrhs)
554 free_ptr = free_ptr + ipw_solve_size
557 IF( free_ptr.GT.memsiz )
THEN
559 $
WRITE( nout, fmt = 9996 )
'solve',
560 $ ( free_ptr )*zplxsz
566 CALL igsum2d( ictxt,
'All',
' ', 1, 1,
569 IF( ierr( 1 ).GT.0 )
THEN
571 $
WRITE( nout, fmt = 9997 )
'MEMORY'
576 myrhs_size =
numroc( n, nb, mycol, 0, npcol )
581 $ descb2d( m_ ), descb2d( n_ ),
582 $ descb2d( mb_ ), descb2d( nb_ ),
584 $ descb2d( lld_ ), descb2d( rsrc_ ),
586 $ ibseed, 0, myrhs_size, 0, nrhs, mycol,
587 $ myrow, npcol, nprow )
591 $ mem( ipb-iprepad ),
596 $ mem( ip_driver_w-iprepad ),
602 CALL blacs_barrier( ictxt,
'All')
607 CALL pzpbtrs( uplo, n, bw, nrhs, mem( ipa ), 1,
608 $ desca, mem( ipb ), 1, descb,
609 $ mem( ip_fillin ), fillin_size,
610 $ mem( ipw_solve ), ipw_solve_size,
617 $
WRITE( nout, fmt = * )
'PZPBTRS INFO=', info
629 $ mem( ip_driver_w-iprepad ),
638 $ mem( ipb ), 1, 1, descb2d,
639 $ iaseed, mem( ipa ), 1, 1, desca2d,
640 $ ibseed, anorm, sresid,
641 $ mem( ip_driver_w ), worksiz )
644 IF( sresid.GT.thresh )
645 $
WRITE( nout, fmt = 9985 ) sresid
650 IF( ( sresid.LE.thresh ).AND.
651 $ ( (sresid-sresid).EQ.0.0d+0 ) )
THEN
666 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
668 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
673 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
679 nprocs_real = ( n-1 )/nb + 1
680 n_last = mod( n-1, nb ) + 1
683 nops = nops + dble(bw)*( -2.d0 / 3.d0+dble(bw)*
684 $ ( -1.d0+dble(bw)*( -1.d0 / 3.d0 ) ) ) +
685 $ dble(n)*( 1.d0+dble(bw)*( 3.d0 /
686 $ 2.d0+dble(bw)*( 1.d0 / 2.d0 ) ) )
687 nops = nops + dble(bw)*( -1.d0 / 6.d0+dble(bw)
688 $ *( -1.d0 /2.d0+dble(bw)
689 $ *( -1.d0 / 3.d0 ) ) ) +
690 $ dble(n)*( dble(bw) /
691 $ 2.d0*( 1.d0+dble(bw) ) )
694 $ dble(nrhs)*( ( 2*dble(n)-dble(bw) )*
695 $ ( dble(bw)+1.d0 ) )+ dble(nrhs)*
696 $ ( dble(bw)*( 2*dble(n)-
697 $ ( dble(bw)+1.d0 ) ) )
704 nops2 = ( (dble(n_first))* dble(bw)**2 )
706 IF ( nprocs_real .GT. 1)
THEN
711 $ 4*( (dble(n_last)*dble(bw)**2) )
714 IF ( nprocs_real .GT. 2)
THEN
718 nops2 = nops2 + (nprocs_real-2)*
719 $ 4*( (dble(nb)*dble(bw)**2) )
725 $ ( nprocs_real-1 ) * ( bw*bw*bw/3 )
726 IF( nprocs_real .GT. 1 )
THEN
728 $ ( nprocs_real-2 ) * ( 2 * bw*bw*bw )
735 $ ( 4.0d+0*(dble(n_first)*dble(bw))*dble(nrhs) )
737 IF ( nprocs_real .GT. 1 )
THEN
742 $ 2*( 4.0d+0*(dble(n_last)*dble(bw))*dble(nrhs) )
745 IF ( nprocs_real .GT. 2 )
THEN
750 $ ( nprocs_real-2)*2*
751 $ ( 4.0d+0*(dble(nb)*dble(bw))*dble(nrhs) )
757 $ nrhs*( nprocs_real-1 ) * ( bw*bw )
758 IF( nprocs_real .GT. 1 )
THEN
760 $ nrhs*( nprocs_real-2 ) * ( 3 * bw*bw )
766 nops2 = nops2 * dble(4)
773 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
775 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
780 IF( wtime( 1 )+wtime( 2 ).GT.0.0d+0 )
THEN
782 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
787 IF( wtime( 2 ).GE.0.0d+0 )
788 $
WRITE( nout, fmt = 9993 )
'WALL', uplo,
791 $ nb, nrhs, nprow, npcol,
792 $ wtime( 1 ), wtime( 2 ), tmflops,
797 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
799 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
804 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
806 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
811 IF( ctime( 2 ).GE.0.0d+0 )
812 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo,
815 $ nb, nrhs, nprow, npcol,
816 $ ctime( 1 ), ctime( 2 ), tmflops,
832 CALL blacs_gridexit( ictxt )
833 CALL blacs_gridexit( ictxtb )
843 ktests = kpass + kfail + kskip
844 WRITE( nout, fmt = * )
845 WRITE( nout, fmt = 9992 ) ktests
847 WRITE( nout, fmt = 9991 ) kpass
848 WRITE( nout, fmt = 9989 ) kfail
850 WRITE( nout, fmt = 9990 ) kpass
852 WRITE( nout, fmt = 9988 ) kskip
853 WRITE( nout, fmt = * )
854 WRITE( nout, fmt = * )
855 WRITE( nout, fmt = 9987 )
856 IF( nout.NE.6 .AND. nout.NE.0 )
862 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
863 $
'; It should be at least 1' )
864 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
866 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
867 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
869 9995
FORMAT(
'TIME UL N BW NB NRHS P Q L*U Time ',
870 $
'Slv Time MFLOPS MFLOP2 CHECK' )
871 9994
FORMAT(
'---- -- ------ --- ---- ----- -- ---- -------- ',
872 $
'-------- ------ ------ ------' )
873 9993
FORMAT( a4, 2x, a1, 1x, i6, 1x, i3, 1x, i4, 1x,
875 $ i4, 1x, f8.3, f9.4, f9.2, f9.2, 1x, a6 )
876 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
877 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
878 9990
FORMAT( i5,
' tests completed without checking.' )
879 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
880 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
881 9987
FORMAT(
'END OF TESTS.' )
882 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
883 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 pzfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
double precision function pzlange(norm, m, n, a, ia, ja, desca, work)
subroutine pzpbinfo(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 pzpblaschk(symm, uplo, n, bwl, bwu, nrhs, x, ix, jx, descx, iaseed, a, ia, ja, desca, ibseed, anorm, resid, work, worksiz)
subroutine pzpbtrf(uplo, n, bw, a, ja, desca, af, laf, work, lwork, info)
subroutine pzpbtrs(uplo, n, bw, nrhs, a, ja, desca, b, ib, descb, af, laf, work, lwork, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)