64 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
65 $ lld_, mb_, m_, nb_, n_, rsrc_
66 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
67 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
68 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
69 INTEGER dblesz, intgsz, memsiz, ntests, totmem, zplxsz
70 COMPLEX*16 padval, zero
71 parameter( dblesz = 8, intgsz = 4, totmem = 2000000,
72 $ zplxsz = 16, memsiz = totmem / zplxsz,
74 $ padval = ( -9923.0d+0, -9923.0d+0 ),
75 $ zero = ( 0.0d+0, 0.0d+0 ) )
83 INTEGER i, iam, iaseed, ictxt, imidpad, info, ipa,
84 $ ippiv, iprepad, ipostpad, ipiw, ipw, itemp, j,
85 $ k, ktests, kpass, kfail, kskip, l, lcm, lipiv,
86 $ liwork, lwork, mycol, myrow, n, nb, ngrids,
87 $ nmat, nmtyp, nnb, nout, np, npcol, nprocs,
88 $ nprow, nq, workiinv, workinv, worksiz
90 DOUBLE PRECISION anorm, fresid, nops, rcond, tmflops
93 CHARACTER*3 mattyp( ntests )
94 INTEGER desca( dlen_ ), ierr( 1 ), nbval( ntests ),
95 $ nval( ntests ), pval( ntests ),
97 DOUBLE PRECISION ctime( 2 ), wtime( 2 )
98 COMPLEX*16 mem( memsiz )
101 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
102 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
120 DATA ktests, kpass, kfail, kskip /4*0/
126 CALL blacs_pinfo( iam, nprocs )
128 CALL pzinvinfo( outfile, nout, nmtyp, mattyp, ntests, nmat, nval,
129 $ ntests, nnb, nbval, ntests, ngrids, pval, ntests,
130 $ qval, ntests, thresh, mem, iam, nprocs )
131 check = ( thresh.GE.0.0e+0 )
142 WRITE( nout, fmt = * )
143 IF(
lsamen( 3, mtyp,
'GEN' ) )
THEN
144 WRITE( nout, fmt = 9986 )
145 $
'A is a general matrix.'
146 ELSE IF(
lsamen( 3, mtyp,
'UTR' ) )
THEN
147 WRITE( nout, fmt = 9986 )
148 $
'A is an upper triangular matrix.'
149 ELSE IF(
lsamen( 3, mtyp,
'LTR' ) )
THEN
150 WRITE( nout, fmt = 9986 )
151 $
'A is a lower triangular matrix.'
152 ELSE IF(
lsamen( 3, mtyp,
'UPD' ) )
THEN
153 WRITE( nout, fmt = 9986 )
154 $
'A is a Hermitian positive definite matrix.'
155 WRITE( nout, fmt = 9986 )
156 $
'Only the upper triangular part will be '//
158 ELSE IF(
lsamen( 3, mtyp,
'LPD' ) )
THEN
159 WRITE( nout, fmt = 9986 )
160 $
'A is a Hermitian positive definite matrix.'
161 WRITE( nout, fmt = 9986 )
162 $
'Only the lower triangular part will be '//
165 WRITE( nout, fmt = * )
166 WRITE( nout, fmt = 9995 )
167 WRITE( nout, fmt = 9994 )
168 WRITE( nout, fmt = * )
181 IF( nprow.LT.1 )
THEN
183 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
185 ELSE IF( npcol.LT.1 )
THEN
187 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
189 ELSE IF( nprow*npcol.GT.nprocs )
THEN
191 $
WRITE( nout, fmt = 9998 ) nprow*npcol, nprocs
195 IF( ierr( 1 ).GT.0 )
THEN
197 $
WRITE( nout, fmt = 9997 )
'grid'
204 CALL blacs_get( -1, 0, ictxt )
205 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
206 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
210 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
222 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
228 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
230 IF( ierr( 1 ).GT.0 )
THEN
232 $
WRITE( nout, fmt = 9997 )
'matrix'
249 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
254 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1,
257 IF( ierr( 1 ).GT.0 )
THEN
259 $
WRITE( nout, fmt = 9997 )
'NB'
266 np =
numroc( n, nb, myrow, 0, nprow )
267 nq =
numroc( n, nb, mycol, 0, npcol )
269 iprepad =
max( nb, np )
271 ipostpad =
max( nb, nq )
280 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
281 $
max( 1, np ) + imidpad, ierr( 1 ) )
285 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1,
288 IF( ierr( 1 ).LT.0 )
THEN
290 $
WRITE( nout, fmt = 9997 )
'descriptor'
300 lcm =
ilcm( nprow, npcol )
301 IF(
lsamen( 3, mtyp,
'GEN' ) )
THEN
305 ippiv = ipa + desca( lld_ ) * nq + ipostpad +
307 lipiv =
iceil( intgsz * ( np + nb ), zplxsz )
308 ipw = ippiv + lipiv + ipostpad + iprepad
310 lwork =
max( 1, np * desca( nb_ ) )
311 workinv = lwork + ipostpad
316 IF( nprow.EQ.npcol )
THEN
317 liwork = nq + desca( nb_ )
325 liwork =
numroc( desca( m_ ) +
326 $ desca( mb_ ) * nprow
327 $ + mod( 1 - 1, desca( mb_ ) ), desca( nb_ ),
328 $ mycol, desca( csrc_ ), npcol ) +
330 $
numroc( desca( m_ ) + desca( mb_ ) * nprow,
331 $ desca( mb_ ), myrow, desca( rsrc_ ), nprow ),
332 $ desca( mb_ ) ), lcm / nprow ), desca( nb_ ) )
335 workiinv =
iceil( liwork*intgsz, zplxsz ) +
337 ipiw = ipw + workinv + iprepad
338 worksiz = workinv + iprepad + workiinv
345 ipw = ipa + desca( lld_ ) * nq + ipostpad + iprepad
346 worksiz = 1 + ipostpad
355 IF(
lsamen( 3, mtyp,
'GEN' ).OR.
356 $
lsamen( 2, mtyp( 2:3 ),
'TR' ) )
THEN
360 IF( nprow.NE.npcol )
THEN
366 worksiz =
max( worksiz-ipostpad,
367 $
iceil( dblesz * itemp, zplxsz ) )
372 worksiz =
max( worksiz, 2 * nb *
max( 1, np ) ) +
380 IF( ipw+worksiz.GT.memsiz )
THEN
382 $
WRITE( nout, fmt = 9996 )
'inversion',
383 $ ( ipw + worksiz ) * zplxsz
389 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1,
392 IF( ierr( 1 ).GT.0 )
THEN
394 $
WRITE( nout, fmt = 9997 )
'MEMORY'
399 IF(
lsamen( 3, mtyp,
'GEN' ).OR.
400 $
lsamen( 2, mtyp( 2:3 ),
'TR' ) )
THEN
404 CALL pzmatgen( ictxt,
'N',
'D', desca( m_ ),
405 $ desca( n_ ), desca( mb_ ),
406 $ desca( nb_ ), mem( ipa ),
407 $ desca( lld_ ), desca( rsrc_ ),
408 $ desca( csrc_ ), iaseed, 0, np, 0,
409 $ nq, myrow, mycol, nprow, npcol )
411 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'PD' ) )
THEN
415 CALL pzmatgen( ictxt,
'H',
'D', desca( m_ ),
416 $ desca( n_ ), desca( mb_ ),
417 $ desca( nb_ ), mem( ipa ),
418 $ desca( lld_ ), desca( rsrc_ ),
419 $ desca( csrc_ ), iaseed, 0, np, 0,
420 $ nq, myrow, mycol, nprow, npcol )
426 IF(
lsamen( 1, mtyp,
'U' ) )
THEN
429 CALL pzlaset(
'Lower', n-1, n-1, zero, zero,
430 $ mem( ipa ), 2, 1, desca )
432 ELSE IF(
lsamen( 1, mtyp,
'L' ) )
THEN
435 CALL pzlaset(
'Upper', n-1, n-1, zero, zero,
436 $ mem( ipa ), 1, 2, desca )
448 CALL pzfillpad( ictxt, np, nq, mem( ipa-iprepad ),
449 $ desca( lld_ ), iprepad, ipostpad,
451 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
452 $ mem( ipw-iprepad ),
453 $ worksiz-ipostpad, iprepad,
456 IF(
lsamen( 3, mtyp,
'GEN' ) )
THEN
459 $ mem( ippiv-iprepad ), lipiv,
460 $ iprepad, ipostpad, padval )
461 anorm =
pzlange(
'1', n, n, mem( ipa ), 1, 1,
462 $ desca, mem( ipw ) )
463 CALL pzchekpad( ictxt,
'PZLANGE', np, nq,
464 $ mem( ipa-iprepad ),
466 $ iprepad, ipostpad, padval )
468 $ worksiz-ipostpad, 1,
469 $ mem( ipw-iprepad ),
471 $ iprepad, ipostpad, padval )
472 CALL pzfillpad( ictxt, workinv-ipostpad, 1,
473 $ mem( ipw-iprepad ),
475 $ iprepad, ipostpad, padval )
476 CALL pzfillpad( ictxt, workiinv-ipostpad, 1,
477 $ mem( ipiw-iprepad ),
478 $ workiinv-ipostpad, iprepad,
480 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'TR' ) )
THEN
482 anorm =
pzlantr(
'1', uplo,
'Non unit', n, n,
483 $ mem( ipa ), 1, 1, desca,
485 CALL pzchekpad( ictxt,
'PZLANTR', np, nq,
486 $ mem( ipa-iprepad ),
488 $ iprepad, ipostpad, padval )
490 $ worksiz-ipostpad, 1,
491 $ mem( ipw-iprepad ),
493 $ iprepad, ipostpad, padval )
495 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'PD' ) )
THEN
497 anorm =
pzlanhe(
'1', uplo, n, mem( ipa ), 1, 1,
498 $ desca, mem( ipw ) )
499 CALL pzchekpad( ictxt,
'PZLANHE', np, nq,
500 $ mem( ipa-iprepad ),
502 $ iprepad, ipostpad, padval )
504 $ worksiz-ipostpad, 1,
505 $ mem( ipw-iprepad ),
507 $ iprepad, ipostpad, padval )
509 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'SY' ) )
THEN
512 $ mem( ippiv-iprepad ), lipiv,
513 $ iprepad, ipostpad, padval )
514 anorm =
pzlansy(
'1', uplo, n, mem( ipa ), 1, 1,
515 $ desca, mem( ipw ) )
516 CALL pzchekpad( ictxt,
'PZLANSY', np, nq,
517 $ mem( ipa-iprepad ),
519 $ iprepad, ipostpad, padval )
521 $ worksiz-ipostpad, 1,
522 $ mem( ipw-iprepad ),
524 $ iprepad,ipostpad, padval )
526 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'HE' ) )
THEN
528 $ mem( ippiv-iprepad ), lipiv,
529 $ iprepad, ipostpad, padval )
530 anorm =
pzlanhe(
'1', uplo, n, mem( ipa ), 1, 1,
531 $ desca, mem( ipw ) )
532 CALL pzchekpad( ictxt,
'PZLANHE', np, nq,
533 $ mem( ipa-iprepad ),
535 $ iprepad, ipostpad, padval )
537 $ worksiz-ipostpad, 1,
538 $ mem( ipw-iprepad ),
540 $ iprepad, ipostpad, padval )
547 CALL blacs_barrier( ictxt,
'All' )
549 IF(
lsamen( 3, mtyp,
'GEN' ) )
THEN
554 CALL pzgetrf( n, n, mem( ipa ), 1, 1, desca,
555 $ mem( ippiv ), info )
562 CALL pzchekpad( ictxt,
'PZGETRF', np, nq,
563 $ mem( ipa-iprepad ),
565 $ iprepad, ipostpad, padval )
566 CALL pzchekpad( ictxt,
'PZGETRF', lipiv, 1,
567 $ mem( ippiv-iprepad ), lipiv,
568 $ iprepad, ipostpad, padval )
574 CALL pzgetri( n, mem( ipa ), 1, 1, desca,
575 $ mem( ippiv ), mem( ipw ), lwork,
576 $ mem( ipiw ), liwork, info )
583 CALL pzchekpad( ictxt,
'PZGETRI', np, nq,
584 $ mem( ipa-iprepad ),
586 $ iprepad, ipostpad, padval )
587 CALL pzchekpad( ictxt,
'PZGETRI', lipiv, 1,
588 $ mem( ippiv-iprepad ), lipiv,
589 $ iprepad, ipostpad, padval )
591 $ workiinv-ipostpad, 1,
592 $ mem( ipiw-iprepad ),
594 $ iprepad, ipostpad, padval )
596 $ workinv-ipostpad, 1,
597 $ mem( ipw-iprepad ),
599 $ iprepad, ipostpad, padval )
602 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'TR' ) )
THEN
607 CALL pztrtri( uplo,
'Non unit', n, mem( ipa ), 1,
615 CALL pzchekpad( ictxt,
'PZTRTRI', np, nq,
616 $ mem( ipa-iprepad ),
618 $ iprepad, ipostpad, padval )
621 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'PD' ) )
THEN
626 CALL pzpotrf( uplo, n, mem( ipa ), 1, 1, desca,
634 CALL pzchekpad( ictxt,
'PZPOTRF', np, nq,
635 $ mem( ipa-iprepad ),
637 $ iprepad, ipostpad, padval )
644 CALL pzpotri( uplo, n, mem( ipa ), 1, 1, desca,
652 CALL pzchekpad( ictxt,
'PZPOTRI', np, nq,
653 $ mem( ipa-iprepad ),
655 $ iprepad, ipostpad, padval )
662 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
663 $ mem( ipw-iprepad ),
664 $ worksiz-ipostpad, iprepad,
669 CALL pzinvchk( mtyp, n, mem( ipa ), 1, 1, desca,
670 $ iaseed, anorm, fresid, rcond,
675 CALL pzchekpad( ictxt,
'PZINVCHK', np, nq,
676 $ mem( ipa-iprepad ),
678 $ iprepad, ipostpad, padval )
680 $ worksiz-ipostpad, 1,
681 $ mem( ipw-iprepad ),
682 $ worksiz-ipostpad, iprepad,
687 IF( fresid.LE.thresh .AND. info.EQ.0 .AND.
688 $ ( (fresid-fresid) .EQ. 0.0d+0 ) )
THEN
706 fresid = fresid - fresid
713 CALL slcombine( ictxt,
'All',
'>',
'W', 2, 1, wtime )
714 CALL slcombine( ictxt,
'All',
'>',
'C', 2, 1, ctime )
718 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
720 IF(
lsamen( 3, mtyp,
'GEN' ) )
THEN
724 nops = ( 8.0d+0 / 3.0d+0 ) * ( dble( n )**3 ) -
730 $ ( 16.0d+0 / 3.0d+0 ) * ( dble( n )**3 )
732 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'TR' ) )
THEN
738 nops = ( 4.0d+0 / 3.0d+0 ) * ( dble( n )**3 ) +
739 $ 2.0d+0 * ( dble( n )**2 )
741 ELSE IF(
lsamen( 2, mtyp( 2:3 ),
'PD' ) )
THEN
745 nops = ( 4.0d+0 / 3.0d+0 ) * ( dble( n )**3 ) +
746 $ 2.0d+0 * ( dble( n )**2 )
751 $ ( 8.0d+0 / 3.0d+0 ) * ( dble( n )**3 ) +
752 $ 5.0d+0 * ( dble( n )**2 )
762 IF( wtime( 1 ) + wtime( 2 ) .GT. 0.0d+0 )
THEN
764 $ ( ( wtime( 1 )+wtime( 2 ) ) * 1.0d+6 )
769 IF( wtime( 2 ) .GE. 0.0d+0 )
770 $
WRITE( nout, fmt = 9993 )
'WALL', n, nb, nprow,
771 $ npcol, wtime( 1 ), wtime( 2 ), tmflops,
772 $ rcond, fresid, passed
776 IF( ctime( 1 ) + ctime( 2 ) .GT. 0.0d+0 )
THEN
778 $ ( ( ctime( 1 )+ctime( 2 ) ) * 1.0d+6 )
783 IF( ctime( 2 ) .GE. 0.0d+0 )
784 $
WRITE( nout, fmt = 9993 )
'CPU ', n, nb, nprow,
785 $ npcol, ctime( 1 ), ctime( 2 ), tmflops,
786 $ rcond, fresid, passed
793 CALL blacs_gridexit( ictxt )
802 ktests = kpass + kfail + kskip
803 WRITE( nout, fmt = * )
804 WRITE( nout, fmt = 9992 ) ktests
806 WRITE( nout, fmt = 9991 ) kpass
807 WRITE( nout, fmt = 9989 ) kfail
809 WRITE( nout, fmt = 9990 ) kpass
811 WRITE( nout, fmt = 9988 ) kskip
812 WRITE( nout, fmt = * )
813 WRITE( nout, fmt = * )
814 WRITE( nout, fmt = 9987 )
815 IF( nout.NE.6 .AND. nout.NE.0 )
821 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
822 $
'; It should be at least 1' )
823 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
825 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
826 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
828 9995
FORMAT(
'TIME N NB P Q Fct Time Inv Time ',
829 $
' MFLOPS Cond Resid CHECK' )
830 9994
FORMAT(
'---- ----- --- ----- ----- -------- -------- ',
831 $
'----------- ------- ------- ------' )
832 9993
FORMAT( a4, 1x, i5, 1x, i3, 1x, i5, 1x, i5, 1x, f8.2, 1x, f8.2,
833 $ 1x, f11.2, 1x, f7.1, 1x, f7.2, 1x, a6 )
834 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
835 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
836 9990
FORMAT( i5,
' tests completed without checking.' )
837 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
838 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
839 9987
FORMAT(
'END OF TESTS.' )
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 iceil(inum, idenom)
integer function ilcm(m, n)
integer function numroc(n, nb, iproc, isrcproc, nprocs)
logical function lsamen(n, ca, cb)
subroutine pzlaset(uplo, m, n, alpha, beta, a, ia, ja, desca)
subroutine pzchekpad(ictxt, mess, m, n, a, lda, ipre, ipost, chkval)
subroutine pzfillpad(ictxt, m, n, a, lda, ipre, ipost, chkval)
subroutine pzgetrf(m, n, a, ia, ja, desca, ipiv, info)
subroutine pzgetri(n, a, ia, ja, desca, ipiv, work, lwork, iwork, liwork, info)
subroutine pzinvchk(mattyp, n, a, ia, ja, desca, iaseed, anorm, fresid, rcond, work)
subroutine pzinvinfo(summry, nout, nmtyp, mattyp, ldmtyp, nmat, nval, ldnval, nnb, nbval, ldnbval, ngrids, pval, ldpval, qval, ldqval, thresh, work, iam, nprocs)
double precision function pzlange(norm, m, n, a, ia, ja, desca, work)
double precision function pzlanhe(norm, uplo, n, a, ia, ja, desca, work)
double precision function pzlansy(norm, uplo, n, a, ia, ja, desca, work)
double precision function pzlantr(norm, uplo, diag, m, n, a, ia, ja, desca, work)
subroutine pzpotrf(uplo, n, a, ia, ja, desca, info)
subroutine pzpotri(uplo, n, a, ia, ja, desca, info)
subroutine pztrtri(uplo, diag, n, a, ia, ja, desca, info)
subroutine slcombine(ictxt, scope, op, timetype, n, ibeg, times)