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, int_temp, ipa, ipb, ipostpad,
100 $ iprepad, ipw, ipw_size, ipw_solve,
101 $ ipw_solve_size, ip_driver_w, ip_fillin, j, k,
102 $ kfail, kpass, kskip, ktests, mycol, myrhs_size,
103 $ myrow, n, nb, nbw, ngrids, nmat, nnb, nnbr,
104 $ nnr, nout, np, npcol, nprocs, nprocs_real,
105 $ nprow, nq, nrhs, 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 pzptinfo( 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)*int_one-1)/npcol + 1 )
277 nb =
max( nb, 2*int_one )
284 IF( nb.LT.
min( 2*int_one, n ) )
THEN
290 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1,
293 IF( ierr( 1 ).GT.0 )
THEN
302 nq =
numroc( n, nb, mycol, 0, npcol )
318 $ ictxtb, nb+10, ierr( 1 ) )
327 desca( 6 ) = ((2)+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 + (nb+10)*(2)
371 free_ptr = free_ptr + iprepad
373 free_ptr = free_ptr + fillin_size
386 free_ptr = free_ptr + ipw_size
391 IF( free_ptr.GT.memsiz )
THEN
393 $
WRITE( nout, fmt = 9996 )
394 $
'divide and conquer factorization',
401 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
404 IF( ierr( 1 ).GT.0 )
THEN
406 $
WRITE( nout, fmt = 9997 )
'MEMORY'
412 worksiz =
max( ((2)+10), nb )
420 worksiz =
max( worksiz, desca2d( nb_ ) )
423 worksiz =
max( worksiz,
427 free_ptr = free_ptr + iprepad
428 ip_driver_w = free_ptr
429 free_ptr = free_ptr + worksiz + ipostpad
435 IF( free_ptr.GT.memsiz )
THEN
437 $
WRITE( nout, fmt = 9996 )
'factorization',
438 $ ( free_ptr )*zplxsz
444 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr,
447 IF( ierr( 1 ).GT.0 )
THEN
449 $
WRITE( nout, fmt = 9997 )
'MEMORY'
454 CALL pzbmatgen( ictxt, uplo,
'T', bw, bw, n, (2), nb,
455 $ mem( ipa ), nb+10, 0, 0, iaseed, myrow,
456 $ mycol, nprow, npcol )
457 CALL pzfillpad( ictxt, nq, np, mem( ipa-iprepad ),
458 $ nb+10, iprepad, ipostpad,
462 $ mem( ip_driver_w-iprepad ), worksiz,
463 $ iprepad, ipostpad, padval )
470 $ (2), mem( ipa ), 1, 1,
471 $ desca2d, mem( ip_driver_w ) )
472 CALL pzchekpad( ictxt,
'PZLANGE', nq, np,
473 $ mem( ipa-iprepad ), nb+10,
474 $ iprepad, ipostpad, padval )
477 $ mem( ip_driver_w-iprepad ), worksiz,
478 $ iprepad, ipostpad, padval )
481 IF(
lsame( uplo,
'L' ) )
THEN
484 int_temp = desca2d( lld_ )
490 DO 10 h=1,
numroc(n,nb,mycol,0,npcol)/2
491 mem( ipa+int_temp+h-1 ) = mem( ipa+int_temp+2*h-2 )
492 $ +mem( ipa+int_temp+2*h-1 )*( 0.0d+0, 1.0d+0 )
494 IF( 2*(
numroc(n,nb,mycol,0,npcol)/2).NE.
495 $
numroc(n,nb,mycol,0,npcol) )
THEN
496 h=
numroc(n,nb,mycol,0,npcol)/2+1
497 mem( ipa+int_temp+h-1 ) = mem( ipa+int_temp+2*h-2 )
502 CALL blacs_barrier( ictxt,
'All' )
508 CALL pzpttrf( n, mem( ipa+int_temp ),
509 $ mem( ipa+1*( nb+10-int_temp ) ), 1, desca,
510 $ mem( ip_fillin ), fillin_size, mem( ipw ),
517 WRITE( nout, fmt = * )
'PZPTTRF INFO=', info
528 $ np, mem( ipa-iprepad ), nb+10,
529 $ iprepad, ipostpad, padval )
543 CALL descinit( descb2d, n, nrhs, nb, 1, 0, 0,
544 $ ictxtb, nb+10, ierr( 1 ) )
553 descb( 6 ) = descb2d( lld_ )
558 IF( ipb .GT. 0 )
THEN
562 free_ptr = free_ptr + iprepad
564 free_ptr = free_ptr + nrhs*descb2d( lld_ )
569 ipw_solve_size = (10+2*
min(100,nrhs))*npcol+4*nrhs
572 free_ptr = free_ptr + ipw_solve_size
575 IF( free_ptr.GT.memsiz )
THEN
577 $
WRITE( nout, fmt = 9996 )
'solve',
578 $ ( free_ptr )*zplxsz
584 CALL igsum2d( ictxt,
'All',
' ', 1, 1,
587 IF( ierr( 1 ).GT.0 )
THEN
589 $
WRITE( nout, fmt = 9997 )
'MEMORY'
594 myrhs_size =
numroc( n, nb, mycol, 0, npcol )
599 $ descb2d( m_ ), descb2d( n_ ),
600 $ descb2d( mb_ ), descb2d( nb_ ),
602 $ descb2d( lld_ ), descb2d( rsrc_ ),
604 $ ibseed, 0, myrhs_size, 0, nrhs, mycol,
605 $ myrow, npcol, nprow )
609 $ mem( ipb-iprepad ),
614 $ mem( ip_driver_w-iprepad ),
620 CALL blacs_barrier( ictxt,
'All')
625 CALL pzpttrs( uplo, n, nrhs, mem( ipa+int_temp ),
626 $ mem( ipa+1*( nb+10-int_temp ) ), 1,
627 $ desca, mem( ipb ), 1, descb,
628 $ mem( ip_fillin ), fillin_size,
629 $ mem( ipw_solve ), ipw_solve_size,
636 $
WRITE( nout, fmt = * )
'PZPTTRS INFO=', info
648 $ mem( ip_driver_w-iprepad ),
661 $ ictxt, (2), ierr( 1 ) )
663 $ mem( ipb ), 1, 1, descb2d,
664 $ iaseed, mem( ipa ), 1, 1, desca2d,
665 $ ibseed, anorm, sresid,
666 $ mem( ip_driver_w ), worksiz )
669 IF( sresid.GT.thresh )
670 $
WRITE( nout, fmt = 9985 ) sresid
675 IF( ( sresid.LE.thresh ).AND.
676 $ ( (sresid-sresid).EQ.0.0d+0 ) )
THEN
691 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1,
693 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1,
698 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
704 nprocs_real = ( n-1 )/nb + 1
705 n_last = mod( n-1, nb ) + 1
708 nops = nops + dble(bw)*( -2.d0 / 3.d0+dble(bw)*
709 $ ( -1.d0+dble(bw)*( -1.d0 / 3.d0 ) ) ) +
710 $ dble(n)*( 1.d0+dble(bw)*( 3.d0 /
711 $ 2.d0+dble(bw)*( 1.d0 / 2.d0 ) ) )
712 nops = nops + dble(bw)*( -1.d0 / 6.d0+dble(bw)
713 $ *( -1.d0 /2.d0+dble(bw)
714 $ *( -1.d0 / 3.d0 ) ) ) +
715 $ dble(n)*( dble(bw) /
716 $ 2.d0*( 1.d0+dble(bw) ) )
719 $ dble(nrhs)*( ( 2*dble(n)-dble(bw) )*
720 $ ( dble(bw)+1.d0 ) )+ dble(nrhs)*
721 $ ( dble(bw)*( 2*dble(n)-
722 $ ( dble(bw)+1.d0 ) ) )
729 nops2 = ( (dble(n_first))* dble(bw)**2 )
731 IF ( nprocs_real .GT. 1)
THEN
736 $ 4*( (dble(n_last)*dble(bw)**2) )
739 IF ( nprocs_real .GT. 2)
THEN
743 nops2 = nops2 + (nprocs_real-2)*
744 $ 4*( (dble(nb)*dble(bw)**2) )
750 $ ( nprocs_real-1 ) * ( bw*bw*bw/3 )
751 IF( nprocs_real .GT. 1 )
THEN
753 $ ( nprocs_real-2 ) * ( 2 * bw*bw*bw )
760 $ ( 4.0d+0*(dble(n_first)*dble(bw))*dble(nrhs) )
762 IF ( nprocs_real .GT. 1 )
THEN
767 $ 2*( 4.0d+0*(dble(n_last)*dble(bw))*dble(nrhs) )
770 IF ( nprocs_real .GT. 2 )
THEN
775 $ ( nprocs_real-2)*2*
776 $ ( 4.0d+0*(dble(nb)*dble(bw))*dble(nrhs) )
782 $ nrhs*( nprocs_real-1 ) * ( bw*bw )
783 IF( nprocs_real .GT. 1 )
THEN
785 $ nrhs*( nprocs_real-2 ) * ( 3 * bw*bw )
791 nops2 = nops2 * dble(4)
798 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
800 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
805 IF( wtime( 1 )+wtime( 2 ).GT.0.0d+0 )
THEN
807 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
812 IF( wtime( 2 ).GE.0.0d+0 )
813 $
WRITE( nout, fmt = 9993 )
'WALL', uplo,
816 $ nb, nrhs, nprow, npcol,
817 $ wtime( 1 ), wtime( 2 ), tmflops,
822 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
824 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
829 IF( ctime( 1 )+ctime( 2 ).GT.0.0d+0 )
THEN
831 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
836 IF( ctime( 2 ).GE.0.0d+0 )
837 $
WRITE( nout, fmt = 9993 )
'CPU ', uplo,
840 $ nb, nrhs, nprow, npcol,
841 $ ctime( 1 ), ctime( 2 ), tmflops,
857 CALL blacs_gridexit( ictxt )
858 CALL blacs_gridexit( ictxtb )
868 ktests = kpass + kfail + kskip
869 WRITE( nout, fmt = * )
870 WRITE( nout, fmt = 9992 ) ktests
872 WRITE( nout, fmt = 9991 ) kpass
873 WRITE( nout, fmt = 9989 ) kfail
875 WRITE( nout, fmt = 9990 ) kpass
877 WRITE( nout, fmt = 9988 ) kskip
878 WRITE( nout, fmt = * )
879 WRITE( nout, fmt = * )
880 WRITE( nout, fmt = 9987 )
881 IF( nout.NE.6 .AND. nout.NE.0 )
887 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
888 $
'; It should be at least 1' )
889 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
891 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
892 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
894 9995
FORMAT(
'TIME UL N BW NB NRHS P Q L*U Time ',
895 $
'Slv Time MFLOPS MFLOP2 CHECK' )
896 9994
FORMAT(
'---- -- ------ --- ---- ----- -- ---- -------- ',
897 $
'-------- ------ ------ ------' )
898 9993
FORMAT( a4, 2x, a1, 1x, i6, 1x, i3, 1x, i4, 1x,
900 $ i4, 1x, f8.3, f9.4, f9.2, f9.2, 1x, a6 )
901 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
902 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
903 9990
FORMAT( i5,
' tests completed without checking.' )
904 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
905 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
906 9987
FORMAT(
'END OF TESTS.' )
907 9986
FORMAT(
'||A - ', a4,
'|| / (||A|| * N * eps) = ', g25.7 )
908 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 pzptinfo(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 pzptlaschk(symm, uplo, n, bwl, bwu, nrhs, x, ix, jx, descx, iaseed, a, ia, ja, desca, ibseed, anorm, resid, work, worksiz)
subroutine pzpttrf(n, d, e, ja, desca, af, laf, work, lwork, info)
subroutine pzpttrs(uplo, n, nrhs, d, e, ja, desca, b, ib, descb, af, laf, work, lwork, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)