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 cplxsz, memsiz, ntests
93 parameter( cplxsz = 8,
94 $ memsiz = totmem / cplxsz, ntests = 20,
95 $ padval = ( -9923.0e+0, -9923.0e+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
114 REAL anorm, sresid, thresh
115 DOUBLE PRECISION nops, nops2, tmflops, tmflops2
119 INTEGER bwlval( ntests ), bwuval( ntests ), desca( 7 ),
120 $ desca2d( dlen_ ), descb( 7 ), descb2d( dlen_ ),
121 $ ierr( 1 ), nbrval( ntests ), nbval( ntests ),
122 $ nrval( ntests ), nval( ntests ),
123 $ pval( ntests ), qval( ntests )
124 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
125 COMPLEX mem( memsiz )
128 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
129 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
142 INTRINSIC dble,
max,
min, mod
145 DATA kfail, kpass, kskip, ktests / 4*0 /
154 CALL blacs_pinfo( iam, nprocs )
158 CALL pcgbinfo( outfile, nout, trans, nmat, nval, ntests, nbw,
159 $ bwlval, bwuval, ntests, nnb, nbval, ntests, nnr,
160 $ nrval, ntests, nnbr, nbrval, ntests, ngrids, pval,
161 $ ntests, qval, ntests, thresh, mem, iam, nprocs )
163 check = ( thresh.GE.0.0e+0 )
168 WRITE( nout, fmt = * )
169 WRITE( nout, fmt = 9995 )
170 WRITE( nout, fmt = 9994 )
171 WRITE( nout, fmt = * )
184 IF( nprow.LT.1 )
THEN
186 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
188 ELSE IF( npcol.LT.1 )
THEN
190 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
192 ELSE IF( nprow*npcol.GT.nprocs )
THEN
194 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
198 IF( ierr( 1 ).GT.0 )
THEN
200 $
WRITE( nout, fmt = 9997 )
'grid'
207 CALL blacs_get( -1, 0, ictxt )
208 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
213 CALL blacs_get( -1, 0, ictxtb )
214 CALL blacs_gridinit( ictxtb,
'Column-major', npcol, nprow )
219 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
221 IF( myrow.LT.0 .OR. mycol.LT.0 )
THEN
235 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
241 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
244 IF( ierr( 1 ).GT.0 )
THEN
246 $
WRITE( nout, fmt = 9997 )
'size'
252 DO 45 bw_num = 1, nbw
256 bwl = bwlval( bw_num )
259 $
WRITE( nout, fmt = 9999 )
'Lower Band',
'bwl', bwl
263 bwu = bwuval( bw_num )
266 $
WRITE( nout, fmt = 9999 )
'Upper Band',
'bwu', bwu
270 IF( bwl.GT.n-1 )
THEN
276 IF( bwu.GT.n-1 )
THEN
284 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
287 IF( ierr( 1 ).GT.0 )
THEN
298 nb =( (n-(npcol-1)*(bwl+bwu)-1)/npcol + 1 )
300 nb =
max( nb, 2*(bwl+bwu) )
308 IF( nb.GT.intmem )
THEN
311 WRITE( nout,* )
'You have chosen an '
312 $ ,
'NB > INTMEM in the driver.'
313 WRITE(nout, *)
'Please edit the driver '
314 $ ,
'and increase the value of INTMEM'
320 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
323 IF( ierr( 1 ).GT.0 )
THEN
330 np =
numroc( (2*bwl+2*bwu+1), (2*bwl+2*bwu+1),
332 nq =
numroc( n, nb, mycol, 0, npcol )
335 iprepad = ((2*bwl+2*bwu+1)+10)
337 ipostpad = ((2*bwl+2*bwu+1)+10)
346 CALL descinit( desca2d, (2*bwl+2*bwu+1), n,
347 $ (2*bwl+2*bwu+1), nb, 0, 0,
348 $ ictxt,((2*bwl+2*bwu+1)+10), ierr( 1 ) )
357 desca( 6 ) = ((2*bwl+2*bwu+1)+10)
360 ierr_temp = ierr( 1 )
362 ierr( 1 ) =
min( ierr( 1 ), ierr_temp )
366 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
368 IF( ierr( 1 ).LT.0 )
THEN
370 $
WRITE( nout, fmt = 9997 )
'descriptor'
382 free_ptr = free_ptr + iprepad
385 free_ptr = free_ptr + desca2d( lld_ )*
398 $ (nb+bwu)*(bwl+bwu)+6*(bwl+bwu)*(bwl+2*bwu)
402 free_ptr = free_ptr + iprepad
404 free_ptr = free_ptr + fillin_size
417 free_ptr = free_ptr + ipw_size
422 IF( free_ptr.GT.memsiz )
THEN
424 $
WRITE( nout, fmt = 9996 )
425 $
'divide and conquer factorization',
432 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
435 IF( ierr( 1 ).GT.0 )
THEN
437 $
WRITE( nout, fmt = 9997 )
'MEMORY'
443 worksiz =
max( ((2*bwl+2*bwu+1)+10), nb )
451 worksiz =
max( worksiz, desca2d( nb_ ) )
454 worksiz =
max( worksiz,
458 free_ptr = free_ptr + iprepad
459 ip_driver_w = free_ptr
460 free_ptr = free_ptr + worksiz + ipostpad
466 IF( free_ptr.GT.memsiz )
THEN
468 $
WRITE( nout, fmt = 9996 )
'factorization',
469 $ ( free_ptr )*cplxsz
475 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
478 IF( ierr( 1 ).GT.0 )
THEN
480 $
WRITE( nout, fmt = 9997 )
'MEMORY'
485 CALL pcbmatgen( ictxt,
'G',
'N', bwl, bwu, n,
486 $ (2*bwl+2*bwu+1), nb, mem( ipa+bwl+bwu ),
487 $ ((2*bwl+2*bwu+1)+10), 0, 0, iaseed,
488 $ myrow, mycol, nprow, npcol )
490 CALL pcfillpad( ictxt, np, nq, mem( ipa-iprepad ),
491 $ ((2*bwl+2*bwu+1)+10), iprepad, ipostpad,
495 $ mem( ip_driver_w-iprepad ), worksiz,
496 $ iprepad, ipostpad, padval )
502 anorm =
pclange(
'1', (2*bwl+2*bwu+1),
503 $ n, mem( ipa ), 1, 1,
504 $ desca2d, mem( ip_driver_w ) )
505 CALL pcchekpad( ictxt,
'PCLANGE', np, nq,
506 $ mem( ipa-iprepad ), ((2*bwl+2*bwu+1)+10),
507 $ iprepad, ipostpad, padval )
510 $ mem( ip_driver_w-iprepad ), worksiz,
511 $ iprepad, ipostpad, padval )
516 CALL blacs_barrier( ictxt,
'All' )
522 CALL pcgbtrf( n, bwl, bwu, mem( ipa ), 1, desca, ipiv,
523 $ mem( ip_fillin ), fillin_size, mem( ipw ),
530 WRITE( nout, fmt = * )
'PCGBTRF INFO=', info
541 $ nq, mem( ipa-iprepad ), ((2*bwl+2*bwu+1)+10),
542 $ iprepad, ipostpad, padval )
556 CALL descinit( descb2d, n, nrhs, nb, 1, 0, 0,
557 $ ictxtb, nb+10, ierr( 1 ) )
566 descb( 6 ) = descb2d( lld_ )
571 IF( ipb .GT. 0 )
THEN
575 free_ptr = free_ptr + iprepad
577 free_ptr = free_ptr + nrhs*descb2d( lld_ )
582 ipw_solve_size = nrhs*(nb+2*bwl+4*bwu)
585 free_ptr = free_ptr + ipw_solve_size
588 IF( free_ptr.GT.memsiz )
THEN
590 $
WRITE( nout, fmt = 9996 )
'solve',
591 $ ( free_ptr )*cplxsz
597 CALL igsum2d( ictxt,
'All',
' ', 1, 1,
600 IF( ierr( 1 ).GT.0 )
THEN
602 $
WRITE( nout, fmt = 9997 )
'MEMORY'
607 myrhs_size =
numroc( n, nb, mycol, 0, npcol )
612 $ descb2d( m_ ), descb2d( n_ ),
613 $ descb2d( mb_ ), descb2d( nb_ ),
615 $ descb2d( lld_ ), descb2d( rsrc_ ),
617 $ ibseed, 0, myrhs_size, 0, nrhs, mycol,
618 $ myrow, npcol, nprow )
622 $ mem( ipb-iprepad ),
627 $ mem( ip_driver_w-iprepad ),
633 CALL blacs_barrier( ictxt,
'All')
638 CALL pcgbtrs( trans, n, bwl, bwu, nrhs, mem( ipa ),
639 $ 1, desca, ipiv, mem( ipb ), 1, descb,
640 $ mem( ip_fillin ), fillin_size,
641 $ mem( ipw_solve ), ipw_solve_size,
648 $
WRITE( nout, fmt = * )
'PCGBTRS INFO=', info
660 $ mem( ip_driver_w-iprepad ),
670 $ mem( ipb ), 1, 1, descb2d,
671 $ iaseed, mem( ipa+bwl+bwu ), 1, 1, desca2d,
672 $ ibseed, anorm, sresid,
673 $ mem( ip_driver_w ), worksiz )
676 IF( sresid.GT.thresh )
677 $
WRITE( nout, fmt = 9985 ) sresid
682 IF( ( sresid.LE.thresh ).AND.
683 $ ( (sresid-sresid).EQ.0.0e+0 ) )
THEN
698 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
700 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
705 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
711 nprocs_real = ( n-1 )/nb + 1
712 n_last = mod( n-1, nb ) + 1
717 nops = 2*(dble(n)*dble(bwl)*
719 $ (dble(n)*dble(bwl))
724 $ 2 * (dble(n)*(dble(bwl)+dble((bwl+bwu)))
729 nops = nops * dble(4)
736 nops2 = 2*( (dble(n_first)*
737 $ dble((bwl+bwu))*dble(bwu)))
739 IF ( nprocs_real .GT. 1)
THEN
745 $ 8*( (dble(n_last)*dble((bwl+bwu))
746 $ *dble((bwl+bwu))) )
749 IF ( nprocs_real .GT. 2)
THEN
753 nops2 = nops2 + (nprocs_real-2)*
754 $ 8*( (dble(nb)*dble((bwl+bwu))
755 $ *dble((bwl+bwu))) )
761 $ 2*( nprocs_real-1 ) *
762 $ ( (bwl+bwu)*(bwl+bwu)*(bwl+bwu)/3 )
763 IF( nprocs_real .GT. 1 )
THEN
765 $ 2*( nprocs_real-2 ) *
766 $ (2*(bwl+bwu)*(bwl+bwu)*(bwl+bwu))
779 $ ( dble(bwl)+dble((bwl+bwu)))
781 IF ( nprocs_real .GT. 1 )
THEN
789 $ (dble(n_last)*(dble((bwl+bwu))+
790 $ dble((bwl+bwu))))*dble(nrhs)
793 IF ( nprocs_real .GT. 2 )
THEN
800 $ ( nprocs_real-2)*2*
801 $ ( (dble(nb)*(dble((bwl+bwu))+
802 $ dble((bwl+bwu))))*dble(nrhs) )
808 $ nrhs*( nprocs_real-1)*2*((bwl+bwu)*(bwl+bwu) )
809 IF( nprocs_real .GT. 1 )
THEN
811 $ nrhs*( nprocs_real-2 ) *
812 $ ( 6 * (bwl+bwu)*(bwl+bwu) )
818 nops2 = nops2 * dble(4)
825 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
827 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
832 IF( wtime( 1 )+wtime( 2 ).GT.0.0d+0 )
THEN
834 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
839 IF( wtime( 2 ).GE.0.0d+0 )
840 $
WRITE( nout, fmt = 9993 )
'WALL', trans,
843 $ nb, nrhs, nprow, npcol,
844 $ wtime( 1 ), wtime( 2 ), tmflops,
849 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
851 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
856 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
858 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
863 IF( ctime( 2 ).GE.0.0d+0 )
864 $
WRITE( nout, fmt = 9993 )
'CPU ', trans,
867 $ nb, nrhs, nprow, npcol,
868 $ ctime( 1 ), ctime( 2 ), tmflops,
884 CALL blacs_gridexit( ictxt )
885 CALL blacs_gridexit( ictxtb )
895 ktests = kpass + kfail + kskip
896 WRITE( nout, fmt = * )
897 WRITE( nout, fmt = 9992 ) ktests
899 WRITE( nout, fmt = 9991 ) kpass
900 WRITE( nout, fmt = 9989 ) kfail
902 WRITE( nout, fmt = 9990 ) kpass
904 WRITE( nout, fmt = 9988 ) kskip
905 WRITE( nout, fmt = * )
906 WRITE( nout, fmt = * )
907 WRITE( nout, fmt = 9987 )
908 IF( nout.NE.6 .AND. nout.NE.0 )
914 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
915 $
'; It should be at least 1' )
916 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
918 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
919 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
921 9995
FORMAT(
'TIME TR N BWL BWU NB NRHS P Q L*U Time ',
922 $
'Slv Time MFLOPS MFLOP2 CHECK' )
923 9994
FORMAT(
'---- -- ------ --- --- ---- ----- ---- ---- -------- ',
924 $
'-------- -------- -------- ------' )
925 9993
FORMAT( a4,1x,a1,2x,i6,1x,i3,1x,i3,1x,i4,1x,i5,
926 $ 1x,i4,1x,i4,1x,f9.3,
927 $ f9.4, f9.2, f9.2, 1x, a6 )
928 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
929 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
930 9990
FORMAT( i5,
' tests completed without checking.' )
931 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
932 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
933 9987
FORMAT(
'END OF TESTS.' )
934 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
935 9985
FORMAT(
'||Ax-b||/(||x||*||A||*eps*N) ', f25.7 )
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 numroc(n, nb, iproc, isrcproc, nprocs)
subroutine pcbmatgen(ictxt, aform, aform2, bwl, bwu, n, mb, nb, a, lda, iarow, iacol, iseed, myrow, mycol, nprow, npcol)
subroutine pcchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pcdblaschk(symm, uplo, trans, n, bwl, bwu, nrhs, x, ix, jx, descx, iaseed, a, ia, ja, desca, ibseed, anorm, resid, work, worksiz)
subroutine pcfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pcgbinfo(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 pcgbtrf(n, bwl, bwu, a, ja, desca, ipiv, af, laf, work, lwork, info)
subroutine pcgbtrs(trans, n, bwl, bwu, nrhs, a, ja, desca, ipiv, b, ib, descb, af, laf, work, lwork, info)
real function pclange(norm, m, n, a, ia, ja, desca, work)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)