66 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dt_,
67 $ lld_, mb_, m_, nb_, n_, rsrc_
68 parameter( block_cyclic_2d = 1, dlen_ = 9, dt_ = 1,
69 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
70 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
71 INTEGER zplxsz, totmem, memsiz, ntests
72 parameter( zplxsz = 16, totmem = 200000000,
73 $ memsiz = totmem / zplxsz, ntests = 20 )
74 COMPLEX*16 padval, zero, one
75 parameter( padval = ( -9923.0d+0, -9923.0d+0 ),
76 $ zero = ( 0.0d+0, 0.0d+0 ),
77 $ one = ( 1.0d+0, 0.0d+0 ) )
83 INTEGER i, iam, iaseed, icol, ictxt, ii, iii, imidpad,
84 $ info, ipa, ipostpad, iprepad, ipvl, ipvr, ipw,
85 $ ipwr, ipz, irow, j, jj, jjj, k, kfail, kpass,
86 $ kskip, ktests, lda, ldz, lwork, m, mycol,
87 $ myrow, n, nb, ngrids, nmat, nnb, nout, np,
88 $ npcol, nprocs, nprow, nq, worksiz
90 DOUBLE PRECISION anorm, fresid, nops, qresid, tmflops
94 INTEGER desca( dlen_ ), descz( dlen_ ), ierr( 2 ),
95 $ nbval( ntests ), nval( ntests ),
96 $ pval( ntests ), qval( ntests )
97 DOUBLE PRECISION ctime( 2 ), result( 2 ), rwork( 5000 ),
99 COMPLEX*16 mem( memsiz )
102 EXTERNAL blacs_barrier, blacs_exit, blacs_get,
103 $ blacs_gridexit, blacs_gridinfo, blacs_gridinit,
118 DATA kfail, kpass, kskip, ktests / 4*0 /
124 CALL blacs_pinfo( iam, nprocs )
126 CALL pzevcinfo( outfile, nout, nmat, nval, ntests, nnb, nbval,
127 $ ntests, ngrids, pval, ntests, qval, ntests,
128 $ thresh, mem, iam, nprocs )
129 check = ( thresh.GE.0.0e+0 )
134 WRITE( nout, fmt = * )
135 WRITE( nout, fmt = 9995 )
136 WRITE( nout, fmt = 9994 )
137 WRITE( nout, fmt = * )
150 IF( nprow.LT.1 )
THEN
152 $
WRITE( nout, fmt = 9999 )
'GRID',
'nprow', nprow
154 ELSE IF( npcol.LT.1 )
THEN
156 $
WRITE( nout, fmt = 9999 )
'GRID',
'npcol', npcol
158 ELSE IF( nprow*npcol.GT.nprocs )
THEN
160 $
WRITE( nout, fmt = 9998 )nprow*npcol, nprocs
164 IF( ierr( 1 ).GT.0 )
THEN
166 $
WRITE( nout, fmt = 9997 )
'grid'
173 CALL blacs_get( -1, 0, ictxt )
174 CALL blacs_gridinit( ictxt,
'Row-major', nprow, npcol )
175 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
180 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
192 $
WRITE( nout, fmt = 9999 )
'MATRIX',
'N', n
198 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
200 IF( ierr( 1 ).GT.0 )
THEN
202 $
WRITE( nout, fmt = 9997 )
'matrix'
217 $
WRITE( nout, fmt = 9999 )
'NB',
'NB', nb
222 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
224 IF( ierr( 1 ).GT.0 )
THEN
226 $
WRITE( nout, fmt = 9997 )
'NB'
233 np =
numroc( n, nb, myrow, 0, nprow )
234 nq =
numroc( n, nb, mycol, 0, npcol )
236 iprepad =
max( nb, np )
238 ipostpad =
max( nb, nq )
239 iprepad = iprepad + 1000
240 imidpad = imidpad + 1000
241 ipostpad = ipostpad + 1000
250 CALL descinit( desca, n, n, nb, nb, 0, 0, ictxt,
251 $
max( 1, np )+imidpad, ierr( 1 ) )
255 CALL descinit( descz, n, n, nb, nb, 0, 0, ictxt,
256 $
max( 1, np )+imidpad, ierr( 2 ) )
263 CALL igsum2d( ictxt,
'All',
' ', 2, 1, ierr, 2, -1, 0 )
265 IF( ierr( 1 ).LT.0 .OR. ierr( 2 ).LT.0 )
THEN
267 $
WRITE( nout, fmt = 9997 )
'descriptor'
276 ipz = ipa + desca( lld_ )*nq + ipostpad + iprepad
277 ipwr = ipz + descz( lld_ )*nq + ipostpad + iprepad
278 ipvl = ipwr + n + ipostpad + iprepad
279 ipvr = ipvl + descz( lld_ )*nq + ipostpad + iprepad
280 ipw = ipvr + descz( lld_ )*nq + ipostpad + iprepad
284 iii = 7*iii /
ilcm( nprow, npcol )
287 lwork = 3*n +
max( 2*
max( lda, ldz )+2*nq, iii )
288 lwork = lwork +
max( 2*n, ( 8*
ilcm( nprow, npcol )+2 )**
296 worksiz = lwork +
max( np*desca( nb_ ),
297 $ desca( mb_ )*nq ) + ipostpad
301 worksiz = lwork + ipostpad
308 IF( ipw+worksiz.GT.memsiz )
THEN
310 $
WRITE( nout, fmt = 9996 )
'Schur reduction',
311 $ ( ipw+worksiz )*zplxsz
317 CALL igsum2d( ictxt,
'All',
' ', 1, 1, ierr, 1, -1, 0 )
319 IF( ierr( 1 ).GT.0 )
THEN
321 $
WRITE( nout, fmt = 9997 )
'MEMORY'
328 CALL pzlaset(
'All', n, n, zero, one, mem( ipz ), 1, 1,
330 CALL pzlaset(
'All', n, n, zero, zero, mem( ipvr ), 1, 1,
332 CALL pzlaset(
'All', n, n, zero, zero, mem( ipvl ), 1, 1,
337 CALL pzmatgen( ictxt,
'No transpose',
'No transpose',
338 $ desca( m_ ), desca( n_ ), desca( mb_ ),
339 $ desca( nb_ ), mem( ipa ), desca( lld_ ),
340 $ desca( rsrc_ ), desca( csrc_ ), iaseed, 0,
341 $ np, 0, nq, myrow, mycol, nprow, npcol )
343 $ zero, zero, mem( ipa ),
min( n, 2 ), 1,
349 CALL pzfillpad( ictxt, np, nq, mem( ipa-iprepad ),
350 $ desca( lld_ ), iprepad, ipostpad,
352 CALL pzfillpad( ictxt, np, nq, mem( ipvr-iprepad ),
353 $ descz( lld_ ), iprepad, ipostpad,
355 CALL pzfillpad( ictxt, np, nq, mem( ipvl-iprepad ),
356 $ descz( lld_ ), iprepad, ipostpad,
358 CALL pzfillpad( ictxt, np, nq, mem( ipz-iprepad ),
359 $ descz( lld_ ), iprepad, ipostpad,
361 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
362 $ mem( ipw-iprepad ), worksiz-ipostpad,
363 $ iprepad, ipostpad, padval )
364 anorm =
pzlanhs(
'I', n, mem( ipa ), 1, 1, desca,
366 CALL pzchekpad( ictxt,
'PZLANHS', np, nq,
367 $ mem( ipa-iprepad ), desca( lld_ ),
368 $ iprepad, ipostpad, padval )
369 CALL pzchekpad( ictxt,
'PZLANHS', worksiz-ipostpad, 1,
370 $ mem( ipw-iprepad ), worksiz-ipostpad,
371 $ iprepad, ipostpad, padval )
373 CALL pzfillpad( ictxt, n, 1, mem( ipwr-iprepad ), n,
374 $ iprepad, ipostpad, padval )
375 CALL pzfillpad( ictxt, lwork, 1, mem( ipw-iprepad ),
376 $ lwork, iprepad, ipostpad, padval )
383 CALL infog2l( jjj, jjj, descz, nprow, npcol, myrow,
384 $ mycol, irow, icol, ii, jj )
385 IF( myrow.EQ.ii .AND. mycol.EQ.jj )
THEN
386 mem( ipwr-1+jjj ) = mem( ipa-1+( icol-1 )*lda+
389 mem( ipwr-1+jjj ) = zero
392 CALL zgsum2d( ictxt,
'All',
' ', n, 1, mem( ipwr ), n,
397 CALL blacs_barrier( ictxt,
'All' )
402 CALL pztrevc(
'B',
'A',
SELECT, n, mem( ipa ), desca,
403 $ mem( ipvl ), descz, mem( ipvr ), descz, n,
404 $ m, mem( ipw ), rwork, info )
410 $
WRITE( nout, fmt = * )
'PZTREVC INFO=', info
419 CALL pzchekpad( ictxt,
'PZTREVC (A)', np, nq,
420 $ mem( ipa-iprepad ), desca( lld_ ),
421 $ iprepad, ipostpad, padval )
422 CALL pzchekpad( ictxt,
'PZTREVC (VR)', np, nq,
423 $ mem( ipvr-iprepad ), descz( lld_ ),
424 $ iprepad, ipostpad, padval )
425 CALL pzchekpad( ictxt,
'PZTREVC (VL)', np, nq,
426 $ mem( ipvl-iprepad ), descz( lld_ ),
427 $ iprepad, ipostpad, padval )
428 CALL pzchekpad( ictxt,
'PZTREVC (WR)', n, 1,
429 $ mem( ipwr-iprepad ), n, iprepad,
431 CALL pzchekpad( ictxt,
'PZTREVC (WORK)', lwork, 1,
432 $ mem( ipw-iprepad ), lwork, iprepad,
435 CALL pzfillpad( ictxt, worksiz-ipostpad, 1,
436 $ mem( ipw-iprepad ), worksiz-ipostpad,
437 $ iprepad, ipostpad, padval )
443 CALL pzget22(
'N',
'N',
'N', n, mem( ipa ), desca,
444 $ mem( ipvr ), descz, mem( ipwr ),
445 $ mem( ipz ), descz, rwork, result )
451 CALL pzget22(
'C',
'N',
'C', n, mem( ipa ), desca,
452 $ mem( ipvl ), descz, mem( ipwr ),
453 $ mem( ipz ), descz, rwork, result )
454 fresid =
max( fresid, result( 1 ) )
455 qresid =
max( qresid, result( 2 ) )
457 CALL pzchekpad( ictxt,
'PZGET22 (A)', np, nq,
458 $ mem( ipa-iprepad ), desca( lld_ ),
459 $ iprepad, ipostpad, padval )
460 CALL pzchekpad( ictxt,
'PZGET22 (VR)', np, nq,
461 $ mem( ipvr-iprepad ), descz( lld_ ),
462 $ iprepad, ipostpad, padval )
463 CALL pzchekpad( ictxt,
'PZGET22 (VL)', np, nq,
464 $ mem( ipvl-iprepad ), descz( lld_ ),
465 $ iprepad, ipostpad, padval )
466 CALL pzchekpad( ictxt,
'PZGET22 (Z)', np, nq,
467 $ mem( ipz-iprepad ), descz( lld_ ),
468 $ iprepad, ipostpad, padval )
472 IF( ( fresid.LE.thresh ) .AND.
473 $ ( ( fresid-fresid ).EQ.0.0d+0 ) .AND.
474 $ ( qresid.LE.thresh ) .AND.
475 $ ( ( qresid-qresid ).EQ.0.0d+0 ) )
THEN
482 WRITE( nout, fmt = 9986 )fresid
483 WRITE( nout, fmt = 9985 )qresid
492 fresid = fresid - fresid
493 qresid = qresid - qresid
500 CALL slcombine( ictxt,
'All',
'>',
'W', 1, 1, wtime )
501 CALL slcombine( ictxt,
'All',
'>',
'C', 1, 1, ctime )
505 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
509 nops = 2.0d+0*dble( n )**2
516 IF( wtime( 1 ).GT.0.0d+0 )
THEN
517 tmflops = nops / ( wtime( 1 )*1.0d+6 )
521 IF( wtime( 1 ).GE.0.0d+0 )
522 $
WRITE( nout, fmt = 9993 )
'WALL', n, nb, nprow,
523 $ npcol, wtime( 1 ), tmflops, passed
527 IF( ctime( 1 ).GT.0.0d+0 )
THEN
528 tmflops = nops / ( ctime( 1 )*1.0d+6 )
533 IF( ctime( 1 ).GE.0.0d+0 )
534 $
WRITE( nout, fmt = 9993 )
'CPU ', n, nb, nprow,
535 $ npcol, ctime( 1 ), tmflops, passed
542 CALL blacs_gridexit( ictxt )
549 ktests = kpass + kfail + kskip
550 WRITE( nout, fmt = * )
551 WRITE( nout, fmt = 9992 )ktests
553 WRITE( nout, fmt = 9991 )kpass
554 WRITE( nout, fmt = 9989 )kfail
556 WRITE( nout, fmt = 9990 )kpass
558 WRITE( nout, fmt = 9988 )kskip
559 WRITE( nout, fmt = * )
560 WRITE( nout, fmt = * )
561 WRITE( nout, fmt = 9987 )
562 IF( nout.NE.6 .AND. nout.NE.0 )
568 9999
FORMAT(
'ILLEGAL ', a6,
': ', a5,
' = ', i3,
569 $
'; It should be at least 1' )
570 9998
FORMAT(
'ILLEGAL GRID: nprow*npcol = ', i4,
'. It can be at most',
572 9997
FORMAT(
'Bad ', a6,
' parameters: going on to next test case.' )
573 9996
FORMAT(
'Unable to perform ', a,
': need TOTMEM of at least',
575 9995
FORMAT(
'TIME N NB P Q NEP Time MFLOPS CHECK' )
576 9994
FORMAT(
'---- ----- --- ---- ---- -------- -------- ------' )
577 9993
FORMAT( a4, 1x, i5, 1x, i3, 1x, i4, 1x, i4, 1x, f8.2, 1x, f8.2,
579 9992
FORMAT(
'Finished ', i6,
' tests, with the following results:' )
580 9991
FORMAT( i5,
' tests completed and passed residual checks.' )
581 9990
FORMAT( i5,
' tests completed without checking.' )
582 9989
FORMAT( i5,
' tests completed and failed residual checks.' )
583 9988
FORMAT( i5,
' tests skipped because of illegal input values.' )
584 9987
FORMAT(
'END OF TESTS.' )
585 9986
FORMAT(
'||H*Z - Z*D|| / (||T|| * N * eps) = ', g25.7 )
586 9985
FORMAT(
'max_j(max|Z(j)| - 1) / ( N * eps ) ', g25.7 )