33 INTEGER cmemsiz, memelts
34 parameter( memelts = 250000 )
35 parameter( cmemsiz = 10000 )
48 INTEGER i, iam, nnodes, verb, outnum, memlen, nprec, isize, dsize
49 LOGICAL testsdrv, testbsbr, testcomb, testaux
52 CHARACTER*1 cmem(cmemsiz), prec(9)
53 INTEGER iprec(9), itmp(2)
54 DOUBLE PRECISION mem(memelts)
63 CALL blacs_pinfo( iam, nnodes )
69 IF( nnodes .GT. 0 )
THEN
70 CALL blacs_get( 0, 0, itmp )
71 CALL blacs_gridinit(itmp,
'c', 1, nnodes)
72 CALL blacs_gridexit(itmp)
78 $
CALL rdbtin( testsdrv, testbsbr, testcomb, testaux, nprec,
79 $ prec, verb, outnum )
81 memlen = (memelts * dsize) / isize
86 CALL btsetup( mem, memlen, cmem, cmemsiz, outnum, testsdrv,
87 $ testbsbr, testcomb, testaux, iam, nnodes )
102 IF( prec(i) .EQ.
'I' )
THEN
104 ELSE IF( prec(i) .EQ.
'S' )
THEN
106 ELSE IF( prec(i) .EQ.
'D' )
THEN
108 ELSE IF( prec(i) .EQ.
'C' )
THEN
110 ELSE IF( prec(i) .EQ.
'Z' )
THEN
114 IF( testsdrv ) iprec(6) = 1
115 IF( testbsbr ) iprec(7) = 1
116 IF( testcomb ) iprec(8) = 1
117 IF( testaux ) iprec(9) = 1
125 IF( iprec(i) .EQ. 1 )
THEN
127 ELSE IF( iprec(i) .EQ. 2 )
THEN
129 ELSE IF( iprec(i) .EQ. 3 )
THEN
131 ELSE IF( iprec(i) .EQ. 4 )
THEN
133 ELSE IF( iprec(i) .EQ. 5 )
THEN
137 testsdrv = ( iprec(6) .EQ. 1 )
138 testbsbr = ( iprec(7) .EQ. 1 )
139 testcomb = ( iprec(8) .EQ. 1 )
140 testaux = ( iprec(9) .EQ. 1 )
143 IF( testsdrv .OR. testbsbr .OR. testcomb .OR. testaux )
THEN
150 CALL runtests( mem, memlen, cmem, cmemsiz, prec, nprec, outnum,
151 $ verb, testsdrv, testbsbr, testcomb, testaux )
155 IF( iam .EQ. 0 )
THEN
160 WRITE(outnum,2000)
'NO'
162 WRITE(outnum,2000)
' '
166 IF( outnum.NE.0 .AND. outnum.NE.6 )
CLOSE(outnum)
170 1000
FORMAT(
'=======================================')
171 2000
FORMAT(
'THERE WERE ',a2,
' FAILURES IN THIS TEST RUN')
178 SUBROUTINE runtests( MEM, MEMLEN, CMEM, CMEMLEN, PREC, NPREC,
179 $ OUTNUM, VERB, TESTSDRV, TESTBSBR, TESTCOMB,
183 INTEGER MEMLEN, CMEMLEN, NPREC, OUTNUM, VERB, IAM, NNODES
184 LOGICAL TESTSDRV, TESTBSBR, TESTCOMB, TESTAUX
187 CHARACTER*1 CMEM(CMEMLEN), PREC(NPREC)
191 INTEGER IBTNPROCS, IBTMYPROC, IBTMSGID, IBTSIZEOF, SAFEINDEX
192 EXTERNAL IBTNPROCS, IBTMYPROC, IBTMSGID, IBTSIZEOF, SAFEINDEX
203 INTEGER NSCOPE, NOP, NTOP, NSHAPE, NMAT, NSRC, NDEST, NGRID
204 INTEGER TREP, TCOH, OPPTR, SCOPEPTR, TOPPTR, UPLOPTR, DIAGPTR
205 INTEGER MPTR, NPTR, LDSPTR, LDDPTR, LDIPTR
206 INTEGER RSRCPTR, CSRCPTR, RDESTPTR, CDESTPTR, PPTR, QPTR
207 INTEGER ISEEDPTR, RAPTR, CAPTR, CTXTPTR, WORKPTR, WORKLEN
208 INTEGER MEMUSED, CMEMUSED, I, J, K
209 INTEGER ISIZE, SSIZE, DSIZE, CSIZE, ZSIZE
218 isize = ibtsizeof(
'I')
219 ssize = ibtsizeof(
'S')
220 dsize = ibtsizeof(
'D')
221 csize = ibtsizeof(
'C')
222 zsize = ibtsizeof(
'Z')
225 CALL blacs_get( 0, 2, i )
239 CALL blacs_pinfo( itmp(1), itmp(3) )
240 CALL blacs_setup( itmp(2), itmp(4) )
241 IF( iam .EQ. 0 )
THEN
242 DO 35 i = 0, nnodes-1
244 $
CALL btrecv( 3, 4, itmp, i, ibtmsgid()+2 )
245 IF( itmp(1) .NE. itmp(2) )
246 $
WRITE( outnum, 1000 ) itmp(1), itmp(2)
247 IF( (itmp(3).NE.itmp(4)) .OR. (itmp(3).NE.nnodes) )
248 $
WRITE( outnum, 1000 ) itmp(3), itmp(4), nnodes
251 CALL btsend( 3, 4, itmp, 0, ibtmsgid()+2 )
261 CALL btinfo(
'SDRV', memused, mem, memlen, cmemused, cmem,
262 $ cmemlen, outnum, nop, nscope, trep, tcoh, ntop,
263 $ nshape, nmat, nsrc, ngrid, opptr, scopeptr,
264 $ topptr, uploptr, diagptr, mptr, nptr, ldsptr,
265 $ lddptr, ldiptr, rsrcptr, csrcptr, rdestptr,
266 $ cdestptr, pptr, qptr )
271 ctxtptr = memused + 1
272 iseedptr = ctxtptr + ngrid
273 memused = iseedptr - 1
275 $ memused = memused + nshape * nmat * nsrc * ngrid
277 CALL makegrids( mem(ctxtptr), outnum, ngrid, mem(pptr),
283 IF( prec(i) .EQ.
'I' )
THEN
285 workptr = safeindex(memused + 1, isize, isize)
286 worklen = ( dsize * (memlen - workptr + 1) ) / isize
287 CALL isdrvtest(outnum, verb, nshape, cmem(uploptr),
288 $ cmem(diagptr), nmat, mem(mptr),
289 $ mem(nptr), mem(ldsptr), mem(lddptr),
290 $ nsrc, mem(rsrcptr), mem(csrcptr),
291 $ mem(rdestptr), mem(cdestptr),
292 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
293 $ mem(iseedptr), mem(workptr), worklen)
295 ELSE IF( prec(i) .EQ.
'S' )
THEN
297 workptr = safeindex(memused + 1, isize, ssize)
298 worklen = ( dsize * (memlen - workptr + 1) ) / ssize
299 CALL ssdrvtest(outnum, verb, nshape, cmem(uploptr),
300 $ cmem(diagptr), nmat, mem(mptr),
301 $ mem(nptr), mem(ldsptr), mem(lddptr),
302 $ nsrc, mem(rsrcptr), mem(csrcptr),
303 $ mem(rdestptr), mem(cdestptr),
304 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
305 $ mem(iseedptr), mem(workptr), worklen)
307 ELSE IF( prec(i) .EQ.
'D' )
THEN
309 workptr = safeindex(memused + 1, isize, dsize)
310 worklen = ( dsize * (memlen - workptr + 1) ) / dsize
311 CALL dsdrvtest(outnum, verb, nshape, cmem(uploptr),
312 $ cmem(diagptr), nmat, mem(mptr),
313 $ mem(nptr), mem(ldsptr), mem(lddptr),
314 $ nsrc, mem(rsrcptr), mem(csrcptr),
315 $ mem(rdestptr), mem(cdestptr),
316 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
317 $ mem(iseedptr), mem(workptr), worklen)
319 ELSE IF( prec(i) .EQ.
'C' )
THEN
321 workptr = safeindex(memused + 1, isize, csize)
322 worklen = ( dsize * (memlen - workptr + 1) ) / csize
323 CALL csdrvtest(outnum, verb, nshape, cmem(uploptr),
324 $ cmem(diagptr), nmat, mem(mptr),
325 $ mem(nptr), mem(ldsptr), mem(lddptr),
326 $ nsrc, mem(rsrcptr), mem(csrcptr),
327 $ mem(rdestptr), mem(cdestptr),
328 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
329 $ mem(iseedptr), mem(workptr), worklen)
331 ELSE IF( prec(i) .EQ.
'Z' )
THEN
333 workptr = safeindex(memused + 1, isize, zsize)
334 worklen = ( dsize * (memlen - workptr + 1) ) / zsize
335 CALL zsdrvtest(outnum, verb, nshape, cmem(uploptr),
336 $ cmem(diagptr), nmat, mem(mptr),
337 $ mem(nptr), mem(ldsptr), mem(lddptr),
338 $ nsrc, mem(rsrcptr), mem(csrcptr),
339 $ mem(rdestptr), mem(cdestptr),
340 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
341 $ mem(iseedptr), mem(workptr), worklen)
351 CALL btinfo(
'BSBR', memused, mem, memlen, cmemused, cmem,
352 $ cmemlen, outnum, nop, nscope, trep, tcoh, ntop,
353 $ nshape, nmat, nsrc, ngrid, opptr, scopeptr,
354 $ topptr, uploptr, diagptr, mptr, nptr, ldsptr,
355 $ lddptr, ldiptr, rsrcptr, csrcptr, rdestptr,
356 $ cdestptr, pptr, qptr )
361 ctxtptr = memused + 1
362 iseedptr = ctxtptr + ngrid
363 memused = iseedptr - 1
365 $ memused = memused + nscope*ntop*nshape*nmat*nsrc*ngrid
367 CALL makegrids( mem(ctxtptr), outnum, ngrid, mem(pptr),
373 IF( prec(i) .EQ.
'I' )
THEN
375 workptr = safeindex(memused + 1, isize, isize)
376 worklen = ( dsize * (memlen - workptr + 1) ) / isize
377 CALL ibsbrtest(outnum, verb, nscope, cmem(scopeptr),
378 $ ntop, cmem(topptr), nshape, cmem(uploptr),
379 $ cmem(diagptr), nmat, mem(mptr),
380 $ mem(nptr), mem(ldsptr), mem(lddptr),
381 $ nsrc, mem(rsrcptr), mem(csrcptr),
382 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
383 $ mem(iseedptr), mem(workptr), worklen)
385 ELSE IF( prec(i) .EQ.
'S' )
THEN
387 workptr = safeindex(memused + 1, isize, ssize)
388 worklen = ( dsize * (memlen - workptr + 1) ) / ssize
389 CALL sbsbrtest(outnum, verb, nscope, cmem(scopeptr),
390 $ ntop, cmem(topptr), nshape, cmem(uploptr),
391 $ cmem(diagptr), nmat, mem(mptr),
392 $ mem(nptr), mem(ldsptr), mem(lddptr),
393 $ nsrc, mem(rsrcptr), mem(csrcptr),
394 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
395 $ mem(iseedptr), mem(workptr), worklen)
397 ELSE IF( prec(i) .EQ.
'D' )
THEN
399 workptr = safeindex(memused + 1, isize, dsize)
400 worklen = ( dsize * (memlen - workptr + 1) ) / dsize
401 CALL dbsbrtest(outnum, verb, nscope, cmem(scopeptr),
402 $ ntop, cmem(topptr), nshape, cmem(uploptr),
403 $ cmem(diagptr), nmat, mem(mptr),
404 $ mem(nptr), mem(ldsptr), mem(lddptr),
405 $ nsrc, mem(rsrcptr), mem(csrcptr),
406 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
407 $ mem(iseedptr), mem(workptr), worklen)
409 ELSE IF( prec(i) .EQ.
'C' )
THEN
411 workptr = safeindex(memused + 1, isize, csize)
412 worklen = ( dsize * (memlen - workptr + 1) ) / csize
413 CALL cbsbrtest(outnum, verb, nscope, cmem(scopeptr),
414 $ ntop, cmem(topptr), nshape, cmem(uploptr),
415 $ cmem(diagptr), nmat, mem(mptr),
416 $ mem(nptr), mem(ldsptr), mem(lddptr),
417 $ nsrc, mem(rsrcptr), mem(csrcptr),
418 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
419 $ mem(iseedptr), mem(workptr), worklen)
421 ELSE IF( prec(i) .EQ.
'Z' )
THEN
423 workptr = safeindex(memused + 1, isize, zsize)
424 worklen = ( dsize * (memlen - workptr + 1) ) / zsize
425 CALL zbsbrtest(outnum, verb, nscope, cmem(scopeptr),
426 $ ntop, cmem(topptr), nshape, cmem(uploptr),
427 $ cmem(diagptr), nmat, mem(mptr),
428 $ mem(nptr), mem(ldsptr), mem(lddptr),
429 $ nsrc, mem(rsrcptr), mem(csrcptr),
430 $ ngrid, mem(ctxtptr), mem(pptr), mem(qptr),
431 $ mem(iseedptr), mem(workptr), worklen)
442 CALL btinfo(
'COMB', memused, mem, memlen, cmemused, cmem,
443 $ cmemlen, outnum, nop, nscope, trep, tcoh, ntop,
444 $ nshape, nmat, ndest, ngrid, opptr, scopeptr,
445 $ topptr, uploptr, diagptr, mptr, nptr, ldsptr,
446 $ lddptr, ldiptr, rsrcptr, csrcptr, rdestptr,
447 $ cdestptr, pptr, qptr )
448 ctxtptr = memused + 1
449 memused = ctxtptr + ngrid - 1
455 IF( cmem(opptr+j).EQ.
'>' .OR. cmem(opptr+j).EQ.
'<' )
THEN
460 k = max0( k, 4*mem(mptr+i) )
461 IF ( mem(ldiptr+i) .NE. -1 )
462 $ k = max0( k, mem(nptr+i)*mem(ldiptr+i) +
475 IF( verb.LT.2 ) i = nscope * ntop * nmat * ndest * ngrid
476 memused = iseedptr +
max( 4*nnodes, i )
478 CALL makegrids( mem(ctxtptr), outnum, ngrid, mem(pptr),
485 IF( prec(i) .EQ.
'I' )
THEN
486 workptr = safeindex(memused, isize, isize)
487 worklen = ( dsize * (memlen - workptr + 1) ) / isize
488 IF( cmem(opptr+j) .EQ.
'+' )
THEN
489 CALL isumtest(outnum, verb, trep, tcoh, nscope,
490 $ cmem(scopeptr), ntop, cmem(topptr),
491 $ nmat, mem(mptr), mem(nptr),
492 $ mem(ldsptr), mem(lddptr), ndest,
493 $ mem(rdestptr), mem(cdestptr), ngrid,
494 $ mem(ctxtptr), mem(pptr), mem(qptr),
495 $ mem(iseedptr), mem(workptr),
497 ELSE IF( cmem(opptr+j) .EQ.
'>' )
THEN
498 CALL iamxtest(outnum, verb, trep, tcoh, nscope,
499 $ cmem(scopeptr), ntop, cmem(topptr),
500 $ nmat, mem(mptr), mem(nptr),
501 $ mem(ldsptr), mem(lddptr),
502 $ mem(ldiptr), ndest, mem(rdestptr),
503 $ mem(cdestptr), ngrid, mem(ctxtptr),
504 $ mem(pptr), mem(qptr), mem(iseedptr),
505 $ mem(raptr), mem(captr), k,
506 $ mem(workptr), worklen)
507 ELSE IF( cmem(opptr+j) .EQ.
'<' )
THEN
508 CALL iamntest(outnum, verb, trep, tcoh, nscope,
509 $ cmem(scopeptr), ntop, cmem(topptr),
510 $ nmat, mem(mptr), mem(nptr),
511 $ mem(ldsptr), mem(lddptr),
512 $ mem(ldiptr), ndest, mem(rdestptr),
513 $ mem(cdestptr), ngrid, mem(ctxtptr),
514 $ mem(pptr), mem(qptr), mem(iseedptr),
515 $ mem(raptr), mem(captr), k,
516 $ mem(workptr), worklen)
518 ELSE IF( prec(i) .EQ.
'S' )
THEN
519 workptr = safeindex(memused, isize, ssize)
520 worklen = ( dsize * (memlen - workptr + 1) ) / ssize
521 IF( cmem(opptr+j) .EQ.
'+' )
THEN
522 CALL ssumtest(outnum, verb, trep, tcoh, nscope,
523 $ cmem(scopeptr), ntop, cmem(topptr),
524 $ nmat, mem(mptr), mem(nptr),
525 $ mem(ldsptr), mem(lddptr), ndest,
526 $ mem(rdestptr), mem(cdestptr), ngrid,
527 $ mem(ctxtptr), mem(pptr), mem(qptr),
528 $ mem(iseedptr), mem(workptr),
530 ELSE IF( cmem(opptr+j) .EQ.
'>' )
THEN
531 CALL samxtest(outnum, verb, trep, tcoh, nscope,
532 $ cmem(scopeptr), ntop, cmem(topptr),
533 $ nmat, mem(mptr), mem(nptr),
534 $ mem(ldsptr), mem(lddptr),
535 $ mem(ldiptr), ndest, mem(rdestptr),
536 $ mem(cdestptr), ngrid, mem(ctxtptr),
537 $ mem(pptr), mem(qptr), mem(iseedptr),
538 $ mem(raptr), mem(captr), k,
539 $ mem(workptr), worklen)
540 ELSE IF( cmem(opptr+j) .EQ.
'<' )
THEN
541 CALL samntest(outnum, verb, trep, tcoh, nscope,
542 $ cmem(scopeptr), ntop, cmem(topptr),
543 $ nmat, mem(mptr), mem(nptr),
544 $ mem(ldsptr), mem(lddptr),
545 $ mem(ldiptr), ndest, mem(rdestptr),
546 $ mem(cdestptr), ngrid, mem(ctxtptr),
547 $ mem(pptr), mem(qptr), mem(iseedptr),
548 $ mem(raptr), mem(captr), k,
549 $ mem(workptr), worklen)
551 ELSE IF( prec(i) .EQ.
'C' )
THEN
552 workptr = safeindex(memused, isize, csize)
553 worklen = ( dsize * (memlen - workptr + 1) ) / csize
554 IF( cmem(opptr+j) .EQ.
'+' )
THEN
555 CALL csumtest(outnum, verb, trep, tcoh, nscope,
556 $ cmem(scopeptr), ntop, cmem(topptr),
557 $ nmat, mem(mptr), mem(nptr),
558 $ mem(ldsptr), mem(lddptr), ndest,
559 $ mem(rdestptr), mem(cdestptr), ngrid,
560 $ mem(ctxtptr), mem(pptr), mem(qptr),
561 $ mem(iseedptr), mem(workptr),
563 ELSE IF( cmem(opptr+j) .EQ.
'>' )
THEN
564 CALL camxtest(outnum, verb, trep, tcoh, nscope,
565 $ cmem(scopeptr), ntop, cmem(topptr),
566 $ nmat, mem(mptr), mem(nptr),
567 $ mem(ldsptr), mem(lddptr),
568 $ mem(ldiptr), ndest, mem(rdestptr),
569 $ mem(cdestptr), ngrid, mem(ctxtptr),
570 $ mem(pptr), mem(qptr), mem(iseedptr),
571 $ mem(raptr), mem(captr), k,
572 $ mem(workptr), worklen)
573 ELSE IF( cmem(opptr+j) .EQ.
'<' )
THEN
574 CALL camntest(outnum, verb, trep, tcoh, nscope,
575 $ cmem(scopeptr), ntop, cmem(topptr),
576 $ nmat, mem(mptr), mem(nptr),
577 $ mem(ldsptr), mem(lddptr),
578 $ mem(ldiptr), ndest, mem(rdestptr),
579 $ mem(cdestptr), ngrid, mem(ctxtptr),
580 $ mem(pptr), mem(qptr), mem(iseedptr),
581 $ mem(raptr), mem(captr), k,
582 $ mem(workptr), worklen)
584 ELSE IF( prec(i) .EQ.
'Z' )
THEN
585 workptr = safeindex(memused, isize, zsize)
586 worklen = ( dsize * (memlen - workptr + 1) ) / zsize
587 IF( cmem(opptr+j) .EQ.
'+' )
THEN
588 CALL zsumtest(outnum, verb, trep, tcoh, nscope,
589 $ cmem(scopeptr), ntop, cmem(topptr),
590 $ nmat, mem(mptr), mem(nptr),
591 $ mem(ldsptr), mem(lddptr), ndest,
592 $ mem(rdestptr), mem(cdestptr), ngrid,
593 $ mem(ctxtptr), mem(pptr), mem(qptr),
594 $ mem(iseedptr), mem(workptr),
596 ELSE IF( cmem(opptr+j) .EQ.
'>' )
THEN
597 CALL zamxtest(outnum, verb, trep, tcoh, nscope,
598 $ cmem(scopeptr), ntop, cmem(topptr),
599 $ nmat, mem(mptr), mem(nptr),
600 $ mem(ldsptr), mem(lddptr),
601 $ mem(ldiptr), ndest, mem(rdestptr),
602 $ mem(cdestptr), ngrid, mem(ctxtptr),
603 $ mem(pptr), mem(qptr), mem(iseedptr),
604 $ mem(raptr), mem(captr), k,
605 $ mem(workptr), worklen)
606 ELSE IF( cmem(opptr+j) .EQ.
'<' )
THEN
607 CALL zamntest(outnum, verb, trep, tcoh, nscope,
608 $ cmem(scopeptr), ntop, cmem(topptr),
609 $ nmat, mem(mptr), mem(nptr),
610 $ mem(ldsptr), mem(lddptr),
611 $ mem(ldiptr), ndest, mem(rdestptr),
612 $ mem(cdestptr), ngrid, mem(ctxtptr),
613 $ mem(pptr), mem(qptr), mem(iseedptr),
614 $ mem(raptr), mem(captr), k,
615 $ mem(workptr), worklen)
624 CALL auxtest( outnum, mem, memlen )
627 1000
FORMAT(
'AUXILIARY ERROR - IAM MISMATCH: BLACS_PINFO RETURNED',i4,
628 $ /,
' BLACS_SETUP RETURNED',i4,
'.')
629 1500
FORMAT(
'AUXILIARY ERROR - NPROC MISMATCH: BLACS_PINFO RETURNED',
630 $ i4,/,
' BLACS_SETUP RETURNED',i4,
', TESTER THINKS',i4,
'.')
631 2000
FORMAT(
'BEGINNING BLACS TESTING, BLACS DEBUG LEVEL =',i2)
632 3000
FORMAT(
'==============================================')
639 SUBROUTINE makegrids( CONTEXTS, OUTNUM, NGRIDS, P, Q )
640 INTEGER NGRIDS, OUTNUM
641 INTEGER CONTEXTS(NGRIDS), P(NGRIDS), Q(NGRIDS)
644 INTEGER NPROW, NPCOL, MYROW, MYCOL, I
647 CALL blacs_get( 0, 0, contexts(i) )
648 CALL blacs_gridinit( contexts(i),
'r', p(i), q(i) )
652 CALL blacs_gridinfo( contexts(i), nprow, npcol, myrow, mycol )
653 IF( nprow .GT. 0 )
THEN
654 IF( nprow.NE.p(i) .OR. npcol.NE.q(i) )
THEN
655 IF( ibtmyproc() .NE. 0 ) outnum = 6
657 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
658 CALL blacs_abort( contexts(i), -1 )
663 1000
FORMAT(
'Grid creation error trying to create grid #',i3)
669 INTEGER CONTEXTS(NGRIDS)
670 INTEGER I, NPROW, NPCOL, MYROW, MYCOL
673 CALL blacs_gridinfo( contexts(i), nprow, npcol, myrow, mycol )
674 IF( myrow.LT.nprow .AND. mycol.LT.npcol )
675 $
CALL blacs_gridexit( contexts(i) )
680 SUBROUTINE auxtest( OUTNUM, MEM, MEMLEN )
683 INTEGER OUTNUM, MEMLEN
690 INTEGER IBTMYPROC, IBTMSGID, BLACS_PNUM
691 DOUBLE PRECISION DWALLTIME00
692 EXTERNAL allpass, ibtmyproc, ibtmsgid, blacs_pnum
696 EXTERNAL blacs_pinfo, blacs_gridinit, blacs_gridmap
697 EXTERNAL blacs_freebuff, blacs_gridexit, blacs_abort
698 EXTERNAL blacs_gridinfo, blacs_pcoord, blacs_barrier
702 LOGICAL AUXPASSED, PASSED, IPRINT
703 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, CTXT, CTXT2, LDA
705 DOUBLE PRECISION DTIME, DEPS
708 DOUBLE PRECISION START(2), STST(2), KEEP(2)
712 iprint = ( ibtmyproc() .EQ. 0 )
718 CALL blacs_pinfo( i, nprocs )
719 IF( nprocs .LT. 2 )
THEN
721 $
WRITE(outnum,*)
'NOT ENOUGH PROCESSES TO PERFORM AUXTESTS'
729 WRITE(outnum,*)
'RUNNING BLACS_PNUM/BLACS_PCOORD TEST'
732 nprocs = nprocs - mod(nprocs,2)
733 CALL blacs_get( 0, 0, ctxt )
734 CALL blacs_gridinit( ctxt,
'r', 1, nprocs )
735 CALL blacs_gridinfo( ctxt, nprow, npcol, myrow, mycol )
736 IF( myrow.GE.nprow .OR. mycol.GE.npcol )
GOTO 100
738 k = blacs_pnum( ctxt, 0, i-1 )
739 CALL blacs_pcoord( ctxt, blacs_pnum( ctxt, 0, i-1 ), j, k )
740 IF( passed ) passed = ( j.EQ.0 .AND. k.EQ.i-1 )
744 CALL igsum2d( ctxt,
'a',
' ', 1, 1, k, 1, -1, 0 )
745 passed = ( k .EQ. 0 )
749 WRITE(outnum,*)
'PASSED BLACS_PNUM/BLACS_PCOORD TEST'
751 WRITE(outnum,*)
'FAILED BLACS_PNUM/BLACS_PCOORD TEST'
761 IF( iprint )
WRITE(outnum,*)
'RUNNING REPEATABLE SUM TEST'
768 start(1) = start(1) / 2.0d0
769 stst(1) = 1.0d0 + start(1)
770 IF (stst(1) .NE. 1.0d0)
GOTO 15
772 start(1) = deps / dble(npcol-1)
773 IF (mycol .EQ. 3) start(1) = 1.0d0
774 start(2) = 7.00005d0 * npcol
777 CALL blacs_set(ctxt, 15, j)
778 CALL dgsum2d(ctxt,
'a',
'f', 2, 1, stst, 2, -1, 0)
785 IF (mycol .EQ. i)
THEN
786 dtime = dwalltime00()
788 IF (dwalltime00() - dtime .LT. 2.0d0)
GOTO 20
792 CALL dgsum2d(ctxt,
'a',
'f', 2, 1, stst, 2, -1, 0)
793 IF ( (keep(1).NE.stst(1)) .OR. (keep(2).NE.stst(2)) )
798 CALL igsum2d( ctxt,
'a',
' ', 1, 1, k, 1, -1, 0 )
801 IF (.NOT.passed)
THEN
804 ELSE IF( iprint )
THEN
805 WRITE(outnum,*)
'SKIPPED REPEATABLE SUM TEST'
811 auxpassed = auxpassed .AND. passed
814 WRITE(outnum,*)
'PASSED REPEATABLE SUM TEST'
816 WRITE(outnum,*)
'FAILED REPEATABLE SUM TEST'
826 IF( iprint )
WRITE(outnum,*)
'RUNNING BLACS_GRIDMAP TEST'
828 npcol = nprocs / nprow
829 DO 40 i = 0, nprocs-1
830 mem(i+1) = blacs_pnum( ctxt, 0, mod(i+npcol, nprocs) )
832 CALL blacs_get( ctxt, 10, ctxt2 )
833 CALL blacs_gridmap( ctxt2, mem, nprow, nprow, npcol )
834 CALL blacs_gridinfo( ctxt2, nprow, npcol, myrow, mycol )
835 passed = ( nprow.EQ.2 .AND. npcol.EQ.nprocs/2 )
840 k = blacs_pnum( ctxt2, myrow, mycol )
841 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
844 IF( i.NE.0 .OR. j.NE.0 )
845 $
CALL igerv2d( ctxt2, 1, 1, k, 1, i, j )
847 $ passed = ( k .EQ. blacs_pnum(ctxt2, i, j) )
851 CALL igesd2d( ctxt2, 1, 1, k, 1, 0, 0 )
856 CALL igsum2d( ctxt,
'a',
' ', 1, 1, k, 1, -1, 0 )
857 passed = ( k .EQ. 0 )
858 auxpassed = auxpassed .AND. passed
861 WRITE(outnum,*)
'PASSED BLACS_GRIDMAP TEST'
863 WRITE(outnum,*)
'FAILED BLACS_GRIDMAP TEST'
868 IF( iprint )
WRITE(outnum,*)
'CALL BLACS_FREEBUFF'
869 CALL blacs_freebuff( ctxt, 0 )
870 CALL blacs_freebuff( ctxt, 1 )
872 CALL igsum2d( ctxt2,
'All',
' ', 1, 1, j, 1, -1, mycol )
874 WRITE(outnum,*)
'DONE BLACS_FREEBUFF'
880 IF( iprint )
WRITE(outnum,*)
'CALL BARRIER'
881 CALL blacs_barrier(ctxt2,
'A')
882 CALL blacs_barrier(ctxt2,
'R')
883 CALL blacs_barrier(ctxt2,
'C')
884 CALL blacs_barrier(ctxt2,
'R')
885 CALL blacs_barrier(ctxt2,
'A')
886 CALL blacs_barrier(ctxt2,
'C')
887 CALL blacs_barrier(ctxt2,
'C')
888 CALL blacs_barrier(ctxt2,
'R')
889 CALL blacs_barrier(ctxt2,
'A')
891 CALL igsum2d( ctxt2,
'All',
' ', 1, 1, j, 1, -1, mycol )
893 WRITE(outnum,*)
'DONE BARRIER'
900 WRITE(outnum,*)
'The following tests will hang if your BLACS'//
901 $
' are not locally blocking:'
902 WRITE(outnum,*)
'RUNNING LOCALLY-BLOCKING CONTIGUOUS SEND TEST'
904 k =
min( memlen, 50000 )
912 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
913 CALL igesd2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
914 CALL igesd2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
915 CALL igesd2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
916 CALL igerv2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
917 CALL igerv2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
918 CALL igerv2d( ctxt2, k, 1, mem, k, nprow-1, npcol-1 )
919 ELSE IF( myrow.EQ.nprow-1 .AND. mycol.EQ.npcol-1 )
THEN
920 CALL igesd2d( ctxt2, k, 1, mem, k, 0, 0 )
921 CALL igesd2d( ctxt2, k, 1, mem, k, 0, 0 )
922 CALL igesd2d( ctxt2, k, 1, mem, k, 0, 0 )
923 CALL igerv2d( ctxt2, k, 1, mem, k, 0, 0 )
924 CALL igerv2d( ctxt2, k, 1, mem, k, 0, 0 )
925 CALL igerv2d( ctxt2, k, 1, mem, k, 0, 0 )
928 CALL igsum2d( ctxt2,
'All',
' ', 1, 1, j, 1, -1, mycol )
930 $
WRITE(outnum,*)
'PASSED LOCALLY-BLOCKING CONTIGUOUS SEND TEST'
936 i =
max( 2, lda / 4 )
938 $
WRITE(outnum,*)
'RUNNING LOCALLY-BLOCKING NON-CONTIGUOUS '//
940 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
941 CALL igesd2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
942 CALL igesd2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
943 CALL igesd2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
944 CALL igerv2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
945 CALL igerv2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
946 CALL igerv2d( ctxt2, i, j, mem, lda, nprow-1, npcol-1 )
947 ELSE IF( myrow.EQ.nprow-1 .AND. mycol.EQ.npcol-1 )
THEN
948 CALL igesd2d( ctxt2, i, j, mem, lda, 0, 0 )
949 CALL igesd2d( ctxt2, i, j, mem, lda, 0, 0 )
950 CALL igesd2d( ctxt2, i, j, mem, lda, 0, 0 )
951 CALL igerv2d( ctxt2, i, j, mem, lda, 0, 0 )
952 CALL igerv2d( ctxt2, i, j, mem, lda, 0, 0 )
953 CALL igerv2d( ctxt2, i, j, mem, lda, 0, 0 )
955 CALL igsum2d( ctxt2,
'All',
' ', 1, 1, j, 1, -1, mycol )
957 WRITE(outnum,*)
'PASSED LOCALLY-BLOCKING NON-CONTIGUOUS '//
965 IF( iprint )
WRITE(outnum,*)
'RUNNING BLACS_SET/BLACS_GET TESTS'
967 CALL blacs_set( ctxt2, 11, 3 )
968 CALL blacs_set( ctxt2, 12, 2 )
969 CALL blacs_get( ctxt2, 12, i )
970 CALL blacs_get( ctxt2, 11, k )
971 IF( k.NE.3 ) j = j + 1
972 IF( i.NE.2 ) j = j + 1
973 CALL blacs_set( ctxt2, 13, 3 )
974 CALL blacs_set( ctxt2, 14, 2 )
975 CALL blacs_get( ctxt2, 14, i )
976 CALL blacs_get( ctxt2, 13, k )
977 IF( k.NE.3 ) j = j + 1
978 IF( i.NE.2 ) j = j + 1
982 CALL igsum2d( ctxt2,
'All',
' ', 1, 1, j, 1, -1, mycol )
984 auxpassed = auxpassed .AND. passed
987 WRITE(outnum,*)
'PASSED BLACS_SET/BLACS_GET TESTS'
989 WRITE(outnum,*)
'FAILED BLACS_SET/BLACS_GET TESTS'
994 IF( iprint )
WRITE(outnum,*)
'CALL BLACS_GRIDEXIT'
995 CALL blacs_gridexit(ctxt)
996 CALL blacs_gridexit(ctxt2)
998 WRITE(outnum,*)
'DONE BLACS_GRIDEXIT'
1004 passed = allpass(auxpassed)
1006 WRITE(outnum,*)
'The final auxiliary test is for BLACS_ABORT.'
1007 WRITE(outnum,*)
'Immediately after this message, all '//
1008 $
'processes should be killed.'
1009 WRITE(outnum,*)
'If processes survive the call, your BLACS_'//
1010 $
'ABORT is incorrect.'
1012 CALL blacs_pinfo( i, nprocs )
1013 CALL blacs_get( 0, 0, ctxt )
1014 CALL blacs_gridinit( ctxt,
'r', 1, nprocs )
1015 CALL blacs_barrier(ctxt,
'A')
1016 CALL blacs_gridinfo( ctxt, nprow, npcol, myrow, mycol )
1020 IF( myrow.EQ.nprow/2 .AND. mycol.EQ.npcol/2 )
THEN
1021 CALL blacs_abort( ctxt, -1 )
1031 IF( i.EQ.1 )
GOTO 110
1034 1000
FORMAT(
'AUXILIARY TESTS: BEGIN.')
1045 IF( transto .EQ.
'I' )
THEN
1047 imem(i) = ichar( cmem(i) )
1051 cmem(i) = char( imem(i) )
1057 SUBROUTINE btinfo( TEST, MEMUSED, MEM, MEMLEN, CMEMUSED, CMEM,
1058 $ CMEMLEN, OUTNUM, NOP, NSCOPE, TREP, TCOH, NTOP,
1059 $ NSHAPE, NMAT, NSRC, NGRID, OPPTR, SCOPEPTR,
1060 $ TOPPTR, UPLOPTR, DIAGPTR, MPTR, NPTR, LDSPTR,
1061 $ LDDPTR, LDIPTR, RSRCPTR, CSRCPTR, RDESTPTR,
1062 $ CDESTPTR, PPTR, QPTR )
1066 INTEGER CDESTPTR, CMEMLEN, CMEMUSED, CSRCPTR, DIAGPTR, LDDPTR,
1067 $ LDIPTR, LDSPTR, MEMLEN, MEMUSED, MPTR, NGRID, NMAT, NOP,
1068 $ NPTR, NSCOPE, NSHAPE, NSRC, NTOP, OPPTR, OUTNUM, PPTR,
1069 $ QPTR, RDESTPTR, RSRCPTR, SCOPEPTR, TCOH, TOPPTR, TREP,
1073 CHARACTER*1 CMEM(CMEMLEN)
1077 INTEGER IBTMYPROC, IBTMSGID, IBTSIZEOF
1078 EXTERNAL IBTMYPROC, IBTMSGID, IBTSIZEOF
1081 INTEGER IAM, ISIZE, DSIZE
1089 IF( iam .EQ. 0 )
THEN
1090 IF( test .EQ.
'S' )
THEN
1091 CALL rdsdrv( memused, mem, memlen, cmemused, cmem, cmemlen,
1093 ELSE IF( test .EQ.
'B' )
THEN
1094 CALL rdbsbr( memused, mem, memlen, cmemused, cmem, cmemlen,
1097 CALL rdcomb( memused, mem, memlen, cmemused, cmem, cmemlen,
1102 CALL btsend( 3, 2, itmp, -1, ibtmsgid()+3 )
1103 IF( memlen .GE. memused + cmemused )
THEN
1104 CALL bttranschar(
'I', cmemused, cmem, mem(memused+1) )
1106 isize = ibtsizeof(
'I')
1107 dsize = ibtsizeof(
'D')
1108 WRITE(outnum,1000) ( (memused+cmemused)*isize + dsize-1 )
1110 CALL blacs_abort(-1, -1)
1112 CALL btsend( 3, memused+cmemused, mem, -1, ibtmsgid()+4 )
1114 CALL btrecv( 3, 2, itmp, 0, ibtmsgid()+3 )
1117 IF( memlen .GE. memused + cmemused )
THEN
1118 CALL btrecv( 3, memused+cmemused, mem, 0, ibtmsgid()+4 )
1119 CALL bttranschar(
'C', cmemused, cmem, mem(memused+1) )
1121 isize = ibtsizeof(
'I')
1122 dsize = ibtsizeof(
'D')
1123 WRITE(outnum,1000) ( (memused+cmemused)*isize + dsize-1 )
1125 CALL blacs_abort(-1, -1)
1128 CALL btunpack( test, mem, memused, nop, nscope, trep, tcoh, ntop,
1129 $ nshape, nmat, nsrc, ngrid, opptr, scopeptr, topptr,
1130 $ uploptr, diagptr, mptr, nptr, ldsptr, lddptr,
1131 $ ldiptr, rsrcptr, csrcptr, rdestptr, cdestptr, pptr,
1134 1000
FORMAT(
'MEM array too short to pack CMEM; increase to at least',
1143 SUBROUTINE rdbtin( TESTSDRV, TESTBSBR, TESTCOMB, TESTAUX, NPREC,
1144 $ PREC, VERB, OUTNUM )
1152 LOGICAL TESTSDRV, TESTBSBR, TESTCOMB, TESTAUX
1153 INTEGER NPREC, OUTNUM, VERB
1199 INTEGER PRECMAX, VERBMAX, IN
1200 PARAMETER ( PRECMAX = 5, verbmax = 2, in = 11 )
1208 CHARACTER*80 HEADER, OUTNAME
1244 OPEN( unit = in, file =
'bt.dat', status =
'OLD' )
1251 IF( outnum.NE.6 .AND. outnum.NE.0 )
1252 $
OPEN( unit = outnum, file = outname, status =
'UNKNOWN' )
1253 WRITE(outnum, *) header
1258 IF( lsame(ch,
'T') )
THEN
1260 ELSE IF( lsame(ch,
'F') )
THEN
1263 WRITE(outnum, 1000)
'SDRV', ch
1268 IF( lsame(ch,
'T') )
THEN
1270 ELSE IF(lsame( ch,
'F') )
THEN
1273 WRITE(outnum, 1000)
'BSBR', ch
1278 IF( lsame(ch,
'T') )
THEN
1280 ELSE IF( lsame(ch,
'F') )
THEN
1283 WRITE(outnum, 1000)
'COMB', ch
1288 IF( lsame(ch,
'T') )
THEN
1290 ELSE IF( lsame(ch,
'F') )
THEN
1293 WRITE(outnum, 1000)
'AUX ', ch
1300 IF( nprec .LT. 0 )
THEN
1302 ELSE IF( nprec. gt. precmax )
THEN
1303 WRITE(outnum, 2000) nprec, precmax, precmax
1307 READ(in, *) ( prec(i), i = 1, nprec )
1309 IF( lsame(prec(i),
'C') )
THEN
1311 ELSE IF( lsame(prec(i),
'D') )
THEN
1313 ELSE IF( lsame(prec(i),
'I') )
THEN
1315 ELSE IF( lsame(prec(i),
'S') )
THEN
1317 ELSE IF( lsame(prec(i),
'Z') )
THEN
1320 WRITE(outnum, 3000) prec(i)
1327 IF( verb .GT. verbmax )
THEN
1328 WRITE(outnum, 4000) verb, verbmax, verbmax
1330 ELSE IF( verb .LT. 0 )
THEN
1331 WRITE(outnum, 5000) verb
1337 IF( readerror )
THEN
1339 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE( outnum )
1343 1000
FORMAT(
'INVALID CHARACTER FOR ',a4,
' TESTS ''', a1,
1344 $
''' (EXPECTED T/F)' )
1345 2000
FORMAT(
'NUMBER OF PRECISIONS ', i6,
' GREATER THAN ', i6,
1346 $
' - SETTING TO ', i6,
'.')
1347 3000
FORMAT(
'UNRECOGNIZABLE PRECISION ENTRY ''', a1,
1348 $
''' - EXPECTED ''C'', ''D'', ''I'', ''S'', OR ''Z''.')
1349 4000
FORMAT(
'VERBOSITY ', i4,
' GREATER THAN ',i4,
1350 $
' - SETTING TO ',i4,
'.')
1351 5000
FORMAT(
'VERBOSITY ', i4,
' LESS THAN 0 - SETTING TO 0' )
1352 6000
FORMAT(
'FATAL INPUT FILE ERROR - ABORTING RUN.' )
1378 if (minid .EQ. -1) then
1379 CALL blacs_get( -1, 1, itmp )
1381 itmp(1) = itmp(1) + 1000
1382 CALL blacs_set( -1, 1, itmp )
1392 SUBROUTINE btunpack(TEST, MEM, MEMLEN, NOP, NSCOPE, TREP, TCOH,
1393 $ NTOP, NSHAPE, NMAT, NSRC, NGRID, OPPTR,
1394 $ SCOPEPTR, TOPPTR, UPLOPTR, DIAGPTR, MPTR,
1395 $ NPTR, LDSPTR, LDDPTR, LDIPTR, RSRCPTR,
1396 $ CSRCPTR, RDESTPTR, CDESTPTR, PPTR, QPTR)
1405 INTEGER CDESTPTR, CSRCPTR, DIAGPTR, LDDPTR, LDIPTR, LDSPTR,
1406 $ MEMLEN, MPTR, NGRID, NMAT, NOP, NPTR, NSCOPE, NSHAPE,
1407 $ NSRC, NTOP, OPPTR, PPTR, QPTR, RDESTPTR, RSRCPTR,
1408 $ SCOPEPTR, TCOH, TOPPTR, TREP, UPLOPTR
1446 IF( TEST .EQ.
'S' ) THEN
1448 nshape = mem(memlen-3)
1453 nmat = mem(memlen-2)
1455 nsrc = mem(memlen-1)
1462 ELSE IF ( test .EQ.
'B' )
THEN
1464 nscope = mem(memlen-5)
1467 ntop = mem(memlen-4)
1468 nshape = mem(memlen-3)
1469 nmat = mem(memlen-2)
1471 nsrc = mem(memlen-1)
1480 nscope = mem(memlen-6)
1481 trep = mem(memlen-5)
1482 tcoh = mem(memlen-4)
1483 ntop = mem(memlen-3)
1485 nmat = mem(memlen-2)
1488 ndest = mem(memlen-1)
1493 scopeptr = opptr + nop
1494 topptr = scopeptr + nscope
1495 uploptr = topptr + ntop
1496 diagptr = uploptr + nshape
1499 ldsptr = nptr + nmat
1500 lddptr = ldsptr + nmat
1501 ldiptr = lddptr + nmat
1502 rsrcptr = ldiptr + nldi
1503 csrcptr = rsrcptr + nsrc
1504 rdestptr = csrcptr + nsrc
1505 cdestptr = rdestptr + ndest
1506 pptr = cdestptr + ndest
1508 IF( nsrc .EQ. 0 ) nsrc = ndest
1516 INTEGER FUNCTION safeindex(INDX, SIZE1, SIZE2)
1519 INTEGER indx, size1, size2
1535 IF( mod(i*size1, size2) .EQ. 0 )
GOTO 20
1546 SUBROUTINE rdsdrv( MEMUSED, MEM, MEMLEN, CMEMUSED, CMEM, CMEMLEN,
1555 INTEGER MEMUSED, MEMLEN, CMEMUSED, CMEMLEN, OUTNUM
1558 CHARACTER*1 CMEM(CMEMLEN)
1595 PARAMETER( SDIN = 12 )
1602 INTEGER NSHAPE, NMAT, NSRC, NGRID, I, J
1603 INTEGER UPLOPTR, DIAGPTR, MPTR, NPTR, LDSPTR, LDDPTR, RSRCPTR
1604 INTEGER CSRCPTR, RDESTPTR, CDESTPTR, PPTR, QPTR
1639 OPEN(unit = sdin, file =
'sdrv.dat', status =
'OLD')
1643 READ(sdin, *) nshape
1645 diagptr = uploptr + nshape
1646 cmemused = diagptr + nshape
1647 IF ( cmemused .GT. cmemlen )
THEN
1648 WRITE(outnum, 1000) cmemlen, nshape,
'MATRIX SHAPES.'
1649 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1651 ELSE IF( nshape .LT. 1 )
THEN
1652 WRITE(outnum, 2000)
'MATRIX SHAPE.'
1653 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1659 READ(sdin, *) ( cmem(uploptr+i), i = 0, nshape-1 )
1660 DO 30 i = 0, nshape-1
1661 IF(
lsame(cmem(uploptr+i),
'G') )
THEN
1662 cmem(uploptr+i) =
'G'
1663 ELSE IF(
lsame(cmem(uploptr+i),
'U') )
THEN
1664 cmem(uploptr+i) =
'U'
1665 ELSE IF(
lsame(cmem(uploptr+i),
'L') )
THEN
1666 cmem(uploptr+i) =
'L'
1668 WRITE(outnum, 3000)
'UPLO ', cmem(uploptr+i)
1669 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1674 READ(sdin, *) ( cmem(diagptr+i), i = 0, nshape-1 )
1675 DO 40 i = 0, nshape-1
1676 IF( cmem(uploptr+i) .NE.
'G' )
THEN
1677 IF(
lsame(cmem(diagptr+i),
'U') )
THEN
1678 cmem( diagptr+i ) =
'U'
1679 ELSE IF(
lsame(cmem(diagptr+i),
'N') )
THEN
1680 cmem(diagptr+i) =
'N'
1682 WRITE(outnum, 3000)
'DIAG ', cmem(diagptr+i)
1683 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1694 ldsptr = nptr + nmat
1695 lddptr = ldsptr + nmat
1696 memused = lddptr + nmat
1697 IF( memused .GT. memlen )
THEN
1698 WRITE(outnum, 1000) memlen, nmat,
'MATRICES.'
1699 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1701 ELSE IF( nmat .LT. 1 )
THEN
1702 WRITE(outnum, 2000)
'MATRIX.'
1703 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1706 READ(sdin, *) ( mem( mptr+i ), i = 0, nmat-1 )
1707 READ(sdin, *) ( mem( nptr+i ), i = 0, nmat-1 )
1708 READ(sdin, *) ( mem( ldsptr+i ), i = 0, nmat-1 )
1709 READ(sdin, *) ( mem( lddptr+i ), i = 0, nmat-1 )
1713 CALL chkmatdat( outnum,
'SDRV.dat', .false., nmat, mem(mptr),
1714 $ mem(nptr), mem(ldsptr), mem(lddptr), mem(lddptr) )
1720 csrcptr = rsrcptr + nsrc
1721 rdestptr = csrcptr + nsrc
1722 cdestptr = rdestptr + nsrc
1723 memused = cdestptr + nsrc
1724 IF( memused .GT. memlen )
THEN
1725 WRITE(outnum, 1000) memlen, nmat,
'SRC/DEST.'
1726 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1728 ELSE IF( nsrc .LT. 1 )
THEN
1729 WRITE(outnum, 2000)
'SRC/DEST.'
1730 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1733 READ(sdin, *) ( mem(rsrcptr+i), i = 0, nsrc-1 )
1734 READ(sdin, *) ( mem(csrcptr+i), i = 0, nsrc-1 )
1735 READ(sdin, *) ( mem(rdestptr+i), i = 0, nsrc-1 )
1736 READ(sdin, *) ( mem(cdestptr+i), i = 0, nsrc-1 )
1744 memused = qptr + ngrid
1745 IF( memused .GT. memlen )
THEN
1746 WRITE(outnum, 1000) memlen, ngrid,
'PROCESS GRIDS.'
1747 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1749 ELSE IF( ngrid .LT. 1 )
THEN
1750 WRITE(outnum, 2000)
'PROCESS GRID'
1751 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE( outnum )
1755 READ(sdin, *) ( mem(pptr+i), i = 0, ngrid-1 )
1756 READ(sdin, *) ( mem(qptr+i), i = 0, ngrid-1 )
1757 IF( sdin .NE. 6 .AND. sdin .NE. 0 )
CLOSE( sdin )
1761 DO 70 j = 0, ngrid-1
1762 IF( mem(pptr+j).LT.1 .OR. mem(qptr+j).LT.1 )
THEN
1763 WRITE(outnum, 4000) mem(pptr+j), mem(qptr+j)
1764 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
1771 mem(memused) = nshape
1772 mem(memused+1) = nmat
1773 mem(memused+2) = nsrc
1774 mem(memused+3) = ngrid
1775 memused = memused + 3
1776 cmemused = cmemused - 1
1778 1000
FORMAT(
'Mem too short (',i4,
') to handle',i4,
' ',a20)
1779 2000
FORMAT(
'Must have at least one ',a20)
1780 3000
FORMAT(
'UNRECOGNIZABLE ',a5,
' ''', a1,
'''.')
1781 4000
FORMAT(
'Illegal process grid: {',i3,
',',i3,
'}.')
1789 SUBROUTINE chkmatdat( NOUT, INFILE, TSTFLAG, NMAT, M0, N0,
1790 $ LDAS0, LDAD0, LDI0 )
1803 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
1849 IF( m0(i) .LT. 0 )
THEN
1850 WRITE(nout,1000) infile,
'M', m0(i)
1852 ELSE IF( n0(i) .LT. 0 )
THEN
1853 WRITE(nout,1000) infile,
'N', n0(i)
1855 ELSE IF( ldas0(i) .LT. m0(i) )
THEN
1856 WRITE(nout,2000) infile,
'LDASRC', ldas0(i), m0(i)
1858 ELSE IF( ldad0(i) .LT. m0(i) )
THEN
1859 WRITE(nout,2000) infile,
'LDADST', ldad0(i), m0(i)
1861 ELSE IF( tstflag )
THEN
1862 IF( (ldi0(i).LT.m0(i)) .AND. (ldi0(i).NE.-1) )
THEN
1863 WRITE(nout,2000) infile,
'RCFLAG', ldi0(i), m0(i)
1869 IF( .NOT.matok )
THEN
1870 IF( nout .NE. 6 .AND. nout .NE. 0 )
CLOSE(nout)
1871 CALL blacs_abort(-1, 1)
1874 1000
FORMAT(a8,
' INPUT ERROR: Illegal ',a1,
'; value=',i6,
'.')
1875 2000
FORMAT(a8,
' INPUT ERROR: Illegal ',a6,
'; value=',i6,
', but M=',i6)
1880 LOGICAL FUNCTION allpass( THISTEST )
1903 DATA passhist /.true./
1906 passhist = (passhist .AND. thistest)
1912 SUBROUTINE rdbsbr( MEMUSED, MEM, MEMLEN, CMEMUSED, CMEM, CMEMLEN,
1921 INTEGER MEMUSED, MEMLEN, CMEMUSED, CMEMLEN, OUTNUM
1924 CHARACTER*1 CMEM(CMEMLEN)
1961 PARAMETER( SDIN = 12 )
1968 INTEGER NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID, I, J
1969 INTEGER SCOPEPTR, TOPPTR, UPLOPTR, DIAGPTR, MPTR, NPTR
1970 INTEGER LDSPTR, LDDPTR, RSRCPTR, CSRCPTR, PPTR, QPTR
2007 OPEN(unit = sdin, file =
'bsbr.dat', status =
'OLD')
2011 READ(sdin, *) nscope
2013 cmemused = scopeptr + nscope
2014 IF ( cmemused .GT. cmemlen )
THEN
2015 WRITE(outnum, 1000) cmemlen, nscope,
'SCOPES.'
2016 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2018 ELSE IF( nscope .LT. 1 )
THEN
2019 WRITE(outnum, 2000)
'SCOPE.'
2020 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2024 READ(sdin, *) ( cmem(scopeptr+i), i = 0, nscope-1 )
2025 DO 20 i = 0, nscope-1
2026 IF(
lsame(cmem(scopeptr+i),
'R') )
THEN
2027 cmem(scopeptr+i) =
'R'
2028 ELSE IF(
lsame(cmem(scopeptr+i),
'C') )
THEN
2029 cmem(scopeptr+i) =
'C'
2030 ELSE IF(
lsame(cmem(scopeptr+i),
'A') )
THEN
2031 cmem(scopeptr+i) =
'A'
2033 WRITE(outnum, 3000)
'SCOPE', cmem(scopeptr+i)
2034 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2041 cmemused = topptr + ntop
2042 IF ( cmemused .GT. cmemlen )
THEN
2043 WRITE(outnum, 1000) cmemlen, ntop,
'TOPOLOGIES.'
2044 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2046 ELSE IF( ntop .LT. 1 )
THEN
2047 WRITE(outnum, 2000)
'TOPOLOGY.'
2048 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2051 READ(sdin, *) ( cmem(topptr+i), i = 0, ntop-1 )
2056 READ(sdin, *) nshape
2058 diagptr = uploptr + nshape
2059 cmemused = diagptr + nshape
2060 IF ( cmemused .GT. cmemlen )
THEN
2061 WRITE(outnum, 1000) cmemlen, nshape,
'MATRIX SHAPES.'
2062 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2064 ELSE IF( nshape .LT. 1 )
THEN
2065 WRITE(outnum, 2000)
'MATRIX SHAPE.'
2066 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2072 READ(sdin, *) ( cmem(uploptr+i), i = 0, nshape-1 )
2073 DO 30 i = 0, nshape-1
2074 IF(
lsame(cmem(uploptr+i),
'G') )
THEN
2075 cmem(uploptr+i) =
'G'
2076 ELSE IF(
lsame(cmem(uploptr+i),
'U') )
THEN
2077 cmem(uploptr+i) =
'U'
2078 ELSE IF(
lsame(cmem(uploptr+i),
'L') )
THEN
2079 cmem(uploptr+i) =
'L'
2081 WRITE(outnum, 3000)
'UPLO ', cmem(uploptr+i)
2082 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2087 READ(sdin, *) ( cmem(diagptr+i), i = 0, nshape-1 )
2088 DO 40 i = 0, nshape-1
2089 IF( cmem(uploptr+i) .NE.
'G' )
THEN
2090 IF(
lsame(cmem(diagptr+i),
'U') )
THEN
2091 cmem( diagptr+i ) =
'U'
2092 ELSE IF(
lsame(cmem(diagptr+i),
'N') )
THEN
2093 cmem(diagptr+i) =
'N'
2095 WRITE(outnum, 3000)
'DIAG ', cmem(diagptr+i)
2096 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2107 ldsptr = nptr + nmat
2108 lddptr = ldsptr + nmat
2109 memused = lddptr + nmat
2110 IF( memused .GT. memlen )
THEN
2111 WRITE(outnum, 1000) memlen, nmat,
'MATRICES.'
2112 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2114 ELSE IF( nmat .LT. 1 )
THEN
2115 WRITE(outnum, 2000)
'MATRIX.'
2116 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2119 READ(sdin, *) ( mem( mptr+i ), i = 0, nmat-1 )
2120 READ(sdin, *) ( mem( nptr+i ), i = 0, nmat-1 )
2121 READ(sdin, *) ( mem( ldsptr+i ), i = 0, nmat-1 )
2122 READ(sdin, *) ( mem( lddptr+i ), i = 0, nmat-1 )
2126 CALL chkmatdat( outnum,
'BSBR.dat', .false., nmat, mem(mptr),
2127 $ mem(nptr), mem(ldsptr), mem(lddptr), mem(lddptr) )
2133 csrcptr = rsrcptr + nsrc
2134 memused = csrcptr + nsrc
2135 IF( memused .GT. memlen )
THEN
2136 WRITE(outnum, 1000) memlen, nmat,
'SRC.'
2137 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2139 ELSE IF( nsrc .LT. 1 )
THEN
2140 WRITE(outnum, 2000)
'SRC.'
2141 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2144 READ(sdin, *) ( mem(rsrcptr+i), i = 0, nsrc-1 )
2145 READ(sdin, *) ( mem(csrcptr+i), i = 0, nsrc-1 )
2153 memused = qptr + ngrid
2154 IF( memused .GT. memlen )
THEN
2155 WRITE(outnum, 1000) memlen, ngrid,
'PROCESS GRIDS.'
2156 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2158 ELSE IF( ngrid .LT. 1 )
THEN
2159 WRITE(outnum, 2000)
'PROCESS GRID'
2160 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE( outnum )
2164 READ(sdin, *) ( mem(pptr+i), i = 0, ngrid-1 )
2165 READ(sdin, *) ( mem(qptr+i), i = 0, ngrid-1 )
2166 IF( sdin .NE. 6 .AND. sdin .NE. 0 )
CLOSE( sdin )
2170 DO 70 j = 0, ngrid-1
2171 IF( mem(pptr+j).LT.1 .OR. mem(qptr+j).LT.1 )
THEN
2172 WRITE(outnum, 4000) mem(pptr+j), mem(qptr+j)
2173 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
2180 mem(memused) = nscope
2181 mem(memused+1) = ntop
2182 mem(memused+2) = nshape
2183 mem(memused+3) = nmat
2184 mem(memused+4) = nsrc
2185 mem(memused+5) = ngrid
2186 memused = memused + 5
2187 cmemused = cmemused - 1
2189 1000
FORMAT(
'Mem too short (',i4,
') to handle',i4,
' ',a20)
2190 2000
FORMAT(
'Must have at least one ',a20)
2191 3000
FORMAT(
'UNRECOGNIZABLE ',a5,
' ''', a1,
'''.')
2192 4000
FORMAT(
'Illegal process grid: {',i3,
',',i3,
'}.')
2201 SUBROUTINE isdrvtest( OUTNUM, VERB, NSHAPE, UPLO0, DIAG0,
2202 $ NMAT, M0, N0, LDAS0, LDAD0, NSRC, RSRC0,
2203 $ CSRC0, RDEST0, CDEST0, NGRID, CONTEXT0,
2204 $ P0, Q0, TFAIL, MEM, MEMLEN )
2212 INTEGER OUTNUM, VERB, NSHAPE, NMAT, NSRC, NGRID, MEMLEN
2215 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
2216 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
2217 INTEGER RSRC0(NSRC), CSRC0(NSRC), RDEST0(NSRC), CDEST0(NSRC)
2218 INTEGER CONTEXT0(NGRID), P0(NGRID), Q0(NGRID), TFAIL(*)
2306 INTEGER IBTMYPROC, IBTSIZEOF
2307 EXTERNAL ALLPASS, IBTMYPROC, IBTSIZEOF
2310 EXTERNAL BLACS_GRIDINFO
2311 EXTERNAL ITRSD2D, IGESD2D, ITRRV2D, IGERV2D
2312 EXTERNAL IINITMAT, ICHKMAT, ICHKPAD, IBTCHECKIN
2315 CHARACTER*1 UPLO, DIAG
2317 INTEGER IAM, I, K, IGR, ISH, IMA, ISO, MYROW, MYCOL, IPRE, IPOST
2318 INTEGER M, N, NPROW, NPCOL, RSRC, CSRC, RDEST, CDEST
2319 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
2320 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE
2321 INTEGER SCHECKVAL, RCHECKVAL
2329 isize = ibtsizeof(
'I')
2330 isize = ibtsizeof(
'I')
2334 IF( iam .EQ. 0 )
THEN
2335 WRITE(outnum, *)
' '
2336 WRITE(outnum, *)
' '
2337 WRITE(outnum, 1000 )
2338 IF( verb .GT. 0 )
THEN
2340 WRITE(outnum, 2000)
'NSHAPE:', nshape
2341 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
2342 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
2343 WRITE(outnum, 2000)
'NMAT :', nmat
2344 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
2345 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
2346 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
2347 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
2348 WRITE(outnum, 2000)
'NSRC :', nsrc
2349 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
2350 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
2351 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, nsrc )
2352 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, nsrc )
2353 WRITE(outnum, 2000)
'NGRIDS:', ngrid
2354 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
2355 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
2356 WRITE(outnum, 2000)
'VERB :', verb
2359 IF( verb .GT. 1 )
THEN
2369 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
2370 IF( k .GT. i ) i = k
2372 maxerr = ( isize * (memlen-i) ) / ( isize*2 + isize*6 )
2373 IF( maxerr .LT. 1 )
THEN
2374 WRITE(outnum,*)
'ERROR: Not enough memory to run SDRV tests.'
2375 CALL blacs_abort(-1, 1)
2378 erriptr = errdptr + maxerr
2386 DO 110 igr = 1, ngrid
2388 context = context0(igr)
2389 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
2391 DO 80 ish = 1, nshape
2402 testnum = testnum + 1
2405 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
2411 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
2416 IF( verb .GT. 1 )
THEN
2417 IF( iam .EQ. 0 )
THEN
2418 WRITE(outnum, 7000) testnum,
'RUNNING',
2420 $ ldasrc, ldadst, rsrc, csrc,
2421 $ rdest, cdest, nprow, npcol
2432 IF( myrow .EQ. rsrc .AND. mycol .EQ. csrc )
THEN
2433 CALL iinitmat( uplo, diag, m, n, mem, ldasrc,
2434 $ ipre, ipost, scheckval, testnum,
2437 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
2438 CALL itrsd2d( context, uplo, diag, m, n,
2439 $ mem(aptr), ldasrc, rdest, cdest )
2441 CALL igesd2d( context, m, n, mem(aptr),
2442 $ ldasrc, rdest, cdest )
2446 IF( myrow .EQ. rdest .AND. mycol .EQ. cdest )
THEN
2450 DO 50 k = 1, ipre+ipost+ldadst*n
2456 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
2457 CALL itrrv2d( context, uplo, diag, m, n,
2458 $ mem(aptr), ldadst, rsrc, csrc )
2460 CALL igerv2d( context, m, n, mem(aptr),
2461 $ ldadst, rsrc, csrc )
2467 CALL ichkmat( uplo, diag, m, n, mem(aptr), ldadst,
2468 $ rsrc, csrc, myrow, mycol, testnum, maxerr,
2469 $ nerr, mem(erriptr), mem(errdptr) )
2471 CALL ichkpad( uplo, diag, m, n, mem, ldadst,
2472 $ rsrc, csrc, myrow, mycol, ipre, ipost,
2473 $ rcheckval, testnum, maxerr, nerr,
2474 $ mem(erriptr), mem(errdptr) )
2475 testok = i .EQ. nerr
2478 IF( verb .GT. 1 )
THEN
2480 CALL ibtcheckin( 0, outnum, maxerr, nerr,
2481 $ mem(erriptr), mem(errdptr),
2483 IF( iam .EQ. 0 )
THEN
2484 IF( testok .AND. i.EQ.nerr )
THEN
2485 WRITE(outnum, 7000) testnum,
'PASSED ',
2486 $ uplo, diag, m, n, ldasrc, ldadst,
2487 $ rsrc, csrc, rdest, cdest, nprow, npcol
2490 WRITE(outnum, 7000) testnum,
'FAILED ',
2491 $ uplo, diag, m, n, ldasrc, ldadst,
2492 $ rsrc, csrc, rdest, cdest, nprow, npcol
2505 IF( verb .LT. 2 )
THEN
2507 CALL ibtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
2508 $ mem(errdptr), tfail )
2510 IF( iam .EQ. 0 )
THEN
2511 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
2512 IF( nfail+nskip .EQ. 0 )
THEN
2513 WRITE(outnum, 8000 ) testnum
2515 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
2522 testok = allpass( (nfail.EQ.0) )
2524 1000
FORMAT(
'INTEGER SDRV TESTS: BEGIN.' )
2525 2000
FORMAT(1x,a7,3x,10i6)
2526 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
2528 5000
FORMAT(
' TEST# STATUS UPLO DIA M N LDAS LDAD RSRC ',
2529 $
'CSRC RDEST CDEST P Q')
2530 6000
FORMAT(
' ----- ------- ---- --- ----- ----- ----- ----- ---- ',
2531 $
'---- ----- ----- ---- ----')
2532 7000
FORMAT(i6,1x,a7,4x,a1,3x,a1,4i6,2i5,2i6,2i5)
2533 8000
FORMAT(
'INTEGER SDRV TESTS: PASSED ALL',
2535 9000
FORMAT(
'INTEGER SDRV TESTS:',i5,
' TESTS;',i5,
' PASSED,',
2536 $ i5,
' SKIPPED,',i5,
' FAILED.')
2545 SUBROUTINE ssdrvtest( OUTNUM, VERB, NSHAPE, UPLO0, DIAG0,
2546 $ NMAT, M0, N0, LDAS0, LDAD0, NSRC, RSRC0,
2547 $ CSRC0, RDEST0, CDEST0, NGRID, CONTEXT0,
2548 $ P0, Q0, TFAIL, MEM, MEMLEN )
2556 INTEGER OUTNUM, VERB, NSHAPE, NMAT, NSRC, NGRID, MEMLEN
2559 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
2560 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
2561 INTEGER RSRC0(NSRC), CSRC0(NSRC), RDEST0(NSRC), CDEST0(NSRC)
2562 INTEGER CONTEXT0(NGRID), P0(NGRID), Q0(NGRID), TFAIL(*)
2650 INTEGER IBTMYPROC, IBTSIZEOF
2651 EXTERNAL ALLPASS, IBTMYPROC, IBTSIZEOF
2654 EXTERNAL BLACS_GRIDINFO
2655 EXTERNAL STRSD2D, SGESD2D, STRRV2D, SGERV2D
2656 EXTERNAL SINITMAT, SCHKMAT, SCHKPAD, SBTCHECKIN
2659 CHARACTER*1 UPLO, DIAG
2661 INTEGER IAM, I, K, IGR, ISH, IMA, ISO, MYROW, MYCOL, IPRE, IPOST
2662 INTEGER M, N, NPROW, NPCOL, RSRC, CSRC, RDEST, CDEST
2663 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
2664 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, SSIZE
2665 REAL SCHECKVAL, RCHECKVAL
2673 isize = ibtsizeof(
'I')
2674 ssize = ibtsizeof(
'S')
2678 IF( iam .EQ. 0 )
THEN
2679 WRITE(outnum, *)
' '
2680 WRITE(outnum, *)
' '
2681 WRITE(outnum, 1000 )
2682 IF( verb .GT. 0 )
THEN
2684 WRITE(outnum, 2000)
'NSHAPE:', nshape
2685 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
2686 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
2687 WRITE(outnum, 2000)
'NMAT :', nmat
2688 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
2689 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
2690 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
2691 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
2692 WRITE(outnum, 2000)
'NSRC :', nsrc
2693 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
2694 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
2695 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, nsrc )
2696 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, nsrc )
2697 WRITE(outnum, 2000)
'NGRIDS:', ngrid
2698 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
2699 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
2700 WRITE(outnum, 2000)
'VERB :', verb
2703 IF( verb .GT. 1 )
THEN
2713 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
2714 IF( k .GT. i ) i = k
2716 maxerr = ( ssize * (memlen-i) ) / ( ssize*2 + isize*6 )
2717 IF( maxerr .LT. 1 )
THEN
2718 WRITE(outnum,*)
'ERROR: Not enough memory to run SDRV tests.'
2719 CALL blacs_abort(-1, 1)
2722 erriptr = errdptr + maxerr
2730 DO 110 igr = 1, ngrid
2732 context = context0(igr)
2733 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
2735 DO 80 ish = 1, nshape
2746 testnum = testnum + 1
2749 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
2755 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
2760 IF( verb .GT. 1 )
THEN
2761 IF( iam .EQ. 0 )
THEN
2762 WRITE(outnum, 7000) testnum,
'RUNNING',
2764 $ ldasrc, ldadst, rsrc, csrc,
2765 $ rdest, cdest, nprow, npcol
2776 IF( myrow .EQ. rsrc .AND. mycol .EQ. csrc )
THEN
2777 CALL sinitmat( uplo, diag, m, n, mem, ldasrc,
2778 $ ipre, ipost, scheckval, testnum,
2781 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
2782 CALL strsd2d( context, uplo, diag, m, n,
2783 $ mem(aptr), ldasrc, rdest, cdest )
2785 CALL sgesd2d( context, m, n, mem(aptr),
2786 $ ldasrc, rdest, cdest )
2790 IF( myrow .EQ. rdest .AND. mycol .EQ. cdest )
THEN
2794 DO 50 k = 1, ipre+ipost+ldadst*n
2800 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
2801 CALL strrv2d( context, uplo, diag, m, n,
2802 $ mem(aptr), ldadst, rsrc, csrc )
2804 CALL sgerv2d( context, m, n, mem(aptr),
2805 $ ldadst, rsrc, csrc )
2811 CALL schkmat( uplo, diag, m, n, mem(aptr), ldadst,
2812 $ rsrc, csrc, myrow, mycol, testnum, maxerr,
2813 $ nerr, mem(erriptr), mem(errdptr) )
2815 CALL schkpad( uplo, diag, m, n, mem, ldadst,
2816 $ rsrc, csrc, myrow, mycol, ipre, ipost,
2817 $ rcheckval, testnum, maxerr, nerr,
2818 $ mem(erriptr), mem(errdptr) )
2819 testok = i .EQ. nerr
2822 IF( verb .GT. 1 )
THEN
2824 CALL sbtcheckin( 0, outnum, maxerr, nerr,
2825 $ mem(erriptr), mem(errdptr),
2827 IF( iam .EQ. 0 )
THEN
2828 IF( testok .AND. i.EQ.nerr )
THEN
2829 WRITE(outnum, 7000) testnum,
'PASSED ',
2830 $ uplo, diag, m, n, ldasrc, ldadst,
2831 $ rsrc, csrc, rdest, cdest, nprow, npcol
2834 WRITE(outnum, 7000) testnum,
'FAILED ',
2835 $ uplo, diag, m, n, ldasrc, ldadst,
2836 $ rsrc, csrc, rdest, cdest, nprow, npcol
2849 IF( verb .LT. 2 )
THEN
2851 CALL sbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
2852 $ mem(errdptr), tfail )
2854 IF( iam .EQ. 0 )
THEN
2855 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
2856 IF( nfail+nskip .EQ. 0 )
THEN
2857 WRITE(outnum, 8000 ) testnum
2859 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
2866 testok = allpass( (nfail.EQ.0) )
2868 1000
FORMAT(
'REAL SDRV TESTS: BEGIN.' )
2869 2000
FORMAT(1x,a7,3x,10i6)
2870 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
2872 5000
FORMAT(
' TEST# STATUS UPLO DIA M N LDAS LDAD RSRC ',
2873 $
'CSRC RDEST CDEST P Q')
2874 6000
FORMAT(
' ----- ------- ---- --- ----- ----- ----- ----- ---- ',
2875 $
'---- ----- ----- ---- ----')
2876 7000
FORMAT(i6,1x,a7,4x,a1,3x,a1,4i6,2i5,2i6,2i5)
2877 8000
FORMAT(
'REAL SDRV TESTS: PASSED ALL',
2879 9000
FORMAT(
'REAL SDRV TESTS:',i5,
' TESTS;',i5,
' PASSED,',
2880 $ i5,
' SKIPPED,',i5,
' FAILED.')
2889 SUBROUTINE dsdrvtest( OUTNUM, VERB, NSHAPE, UPLO0, DIAG0,
2890 $ NMAT, M0, N0, LDAS0, LDAD0, NSRC, RSRC0,
2891 $ CSRC0, RDEST0, CDEST0, NGRID, CONTEXT0,
2892 $ P0, Q0, TFAIL, MEM, MEMLEN )
2900 INTEGER OUTNUM, VERB, NSHAPE, NMAT, NSRC, NGRID, MEMLEN
2903 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
2904 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
2905 INTEGER RSRC0(NSRC), CSRC0(NSRC), RDEST0(NSRC), CDEST0(NSRC)
2906 INTEGER CONTEXT0(NGRID), P0(NGRID), Q0(NGRID), TFAIL(*)
2907 DOUBLE PRECISION MEM(MEMLEN)
2994 INTEGER IBTMYPROC, IBTSIZEOF
2995 EXTERNAL ALLPASS, IBTMYPROC, IBTSIZEOF
2998 EXTERNAL BLACS_GRIDINFO
2999 EXTERNAL DTRSD2D, DGESD2D, DTRRV2D, DGERV2D
3000 EXTERNAL DINITMAT, DCHKMAT, DCHKPAD, DBTCHECKIN
3003 CHARACTER*1 UPLO, DIAG
3005 INTEGER IAM, I, K, IGR, ISH, IMA, ISO, MYROW, MYCOL, IPRE, IPOST
3006 INTEGER M, N, NPROW, NPCOL, RSRC, CSRC, RDEST, CDEST
3007 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
3008 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, DSIZE
3009 DOUBLE PRECISION SCHECKVAL, RCHECKVAL
3017 isize = ibtsizeof(
'I')
3018 dsize = ibtsizeof(
'D')
3022 IF( iam .EQ. 0 )
THEN
3023 WRITE(outnum, *)
' '
3024 WRITE(outnum, *)
' '
3025 WRITE(outnum, 1000 )
3026 IF( verb .GT. 0 )
THEN
3028 WRITE(outnum, 2000)
'NSHAPE:', nshape
3029 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
3030 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
3031 WRITE(outnum, 2000)
'NMAT :', nmat
3032 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
3033 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
3034 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
3035 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
3036 WRITE(outnum, 2000)
'NSRC :', nsrc
3037 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
3038 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
3039 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, nsrc )
3040 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, nsrc )
3041 WRITE(outnum, 2000)
'NGRIDS:', ngrid
3042 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
3043 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
3044 WRITE(outnum, 2000)
'VERB :', verb
3047 IF( verb .GT. 1 )
THEN
3057 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
3058 IF( k .GT. i ) i = k
3060 maxerr = ( dsize * (memlen-i) ) / ( dsize*2 + isize*6 )
3061 IF( maxerr .LT. 1 )
THEN
3062 WRITE(outnum,*)
'ERROR: Not enough memory to run SDRV tests.'
3063 CALL blacs_abort(-1, 1)
3066 erriptr = errdptr + maxerr
3074 DO 110 igr = 1, ngrid
3076 context = context0(igr)
3077 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
3079 DO 80 ish = 1, nshape
3090 testnum = testnum + 1
3093 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
3099 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
3104 IF( verb .GT. 1 )
THEN
3105 IF( iam .EQ. 0 )
THEN
3106 WRITE(outnum, 7000) testnum,
'RUNNING',
3108 $ ldasrc, ldadst, rsrc, csrc,
3109 $ rdest, cdest, nprow, npcol
3120 IF( myrow .EQ. rsrc .AND. mycol .EQ. csrc )
THEN
3121 CALL dinitmat( uplo, diag, m, n, mem, ldasrc,
3122 $ ipre, ipost, scheckval, testnum,
3125 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3126 CALL dtrsd2d( context, uplo, diag, m, n,
3127 $ mem(aptr), ldasrc, rdest, cdest )
3129 CALL dgesd2d( context, m, n, mem(aptr),
3130 $ ldasrc, rdest, cdest )
3134 IF( myrow .EQ. rdest .AND. mycol .EQ. cdest )
THEN
3138 DO 50 k = 1, ipre+ipost+ldadst*n
3144 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3145 CALL dtrrv2d( context, uplo, diag, m, n,
3146 $ mem(aptr), ldadst, rsrc, csrc )
3148 CALL dgerv2d( context, m, n, mem(aptr),
3149 $ ldadst, rsrc, csrc )
3155 CALL dchkmat( uplo, diag, m, n, mem(aptr), ldadst,
3156 $ rsrc, csrc, myrow, mycol, testnum, maxerr,
3157 $ nerr, mem(erriptr), mem(errdptr) )
3159 CALL dchkpad( uplo, diag, m, n, mem, ldadst,
3160 $ rsrc, csrc, myrow, mycol, ipre, ipost,
3161 $ rcheckval, testnum, maxerr, nerr,
3162 $ mem(erriptr), mem(errdptr) )
3163 testok = i .EQ. nerr
3166 IF( verb .GT. 1 )
THEN
3168 CALL dbtcheckin( 0, outnum, maxerr, nerr,
3169 $ mem(erriptr), mem(errdptr),
3171 IF( iam .EQ. 0 )
THEN
3172 IF( testok .AND. i.EQ.nerr )
THEN
3173 WRITE(outnum, 7000) testnum,
'PASSED ',
3174 $ uplo, diag, m, n, ldasrc, ldadst,
3175 $ rsrc, csrc, rdest, cdest, nprow, npcol
3178 WRITE(outnum, 7000) testnum,
'FAILED ',
3179 $ uplo, diag, m, n, ldasrc, ldadst,
3180 $ rsrc, csrc, rdest, cdest, nprow, npcol
3193 IF( verb .LT. 2 )
THEN
3195 CALL dbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
3196 $ mem(errdptr), tfail )
3198 IF( iam .EQ. 0 )
THEN
3199 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
3200 IF( nfail+nskip .EQ. 0 )
THEN
3201 WRITE(outnum, 8000 ) testnum
3203 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
3210 testok = allpass( (nfail.EQ.0) )
3212 1000
FORMAT(
'DOUBLE PRECISION SDRV TESTS: BEGIN.' )
3213 2000
FORMAT(1x,a7,3x,10i6)
3214 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
3216 5000
FORMAT(
' TEST# STATUS UPLO DIA M N LDAS LDAD RSRC ',
3217 $
'CSRC RDEST CDEST P Q')
3218 6000
FORMAT(
' ----- ------- ---- --- ----- ----- ----- ----- ---- ',
3219 $
'---- ----- ----- ---- ----')
3220 7000
FORMAT(i6,1x,a7,4x,a1,3x,a1,4i6,2i5,2i6,2i5)
3221 8000
FORMAT(
'DOUBLE PRECISION SDRV TESTS: PASSED ALL',
3223 9000
FORMAT(
'DOUBLE PRECISION SDRV TESTS:',i5,
' TESTS;',i5,
' PASSED,',
3224 $ i5,
' SKIPPED,',i5,
' FAILED.')
3233 SUBROUTINE csdrvtest( OUTNUM, VERB, NSHAPE, UPLO0, DIAG0,
3234 $ NMAT, M0, N0, LDAS0, LDAD0, NSRC, RSRC0,
3235 $ CSRC0, RDEST0, CDEST0, NGRID, CONTEXT0,
3236 $ P0, Q0, TFAIL, MEM, MEMLEN )
3244 INTEGER OUTNUM, VERB, NSHAPE, NMAT, NSRC, NGRID, MEMLEN
3247 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
3248 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
3249 INTEGER RSRC0(NSRC), CSRC0(NSRC), RDEST0(NSRC), CDEST0(NSRC)
3250 INTEGER CONTEXT0(NGRID), P0(NGRID), Q0(NGRID), TFAIL(*)
3338 INTEGER IBTMYPROC, IBTSIZEOF
3339 EXTERNAL ALLPASS, IBTMYPROC, IBTSIZEOF
3342 EXTERNAL BLACS_GRIDINFO
3343 EXTERNAL CTRSD2D, CGESD2D, CTRRV2D, CGERV2D
3344 EXTERNAL CINITMAT, CCHKMAT, CCHKPAD, CBTCHECKIN
3347 CHARACTER*1 UPLO, DIAG
3349 INTEGER IAM, I, K, IGR, ISH, IMA, ISO, MYROW, MYCOL, IPRE, IPOST
3350 INTEGER M, N, NPROW, NPCOL, RSRC, CSRC, RDEST, CDEST
3351 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
3352 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, CSIZE
3353 COMPLEX SCHECKVAL, RCHECKVAL
3357 SCHECKVAL =
cmplx( -0.01, -0.01 )
3358 rcheckval =
cmplx( -0.02, -0.02 )
3361 isize = ibtsizeof(
'I')
3362 csize = ibtsizeof(
'C')
3366 IF( iam .EQ. 0 )
THEN
3367 WRITE(outnum, *)
' '
3368 WRITE(outnum, *)
' '
3369 WRITE(outnum, 1000 )
3370 IF( verb .GT. 0 )
THEN
3372 WRITE(outnum, 2000)
'NSHAPE:', nshape
3373 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
3374 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
3375 WRITE(outnum, 2000)
'NMAT :', nmat
3376 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
3377 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
3378 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
3379 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
3380 WRITE(outnum, 2000)
'NSRC :', nsrc
3381 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
3382 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
3383 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, nsrc )
3384 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, nsrc )
3385 WRITE(outnum, 2000)
'NGRIDS:', ngrid
3386 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
3387 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
3388 WRITE(outnum, 2000)
'VERB :', verb
3391 IF( verb .GT. 1 )
THEN
3401 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
3402 IF( k .GT. i ) i = k
3404 maxerr = ( csize * (memlen-i) ) / ( csize*2 + isize*6 )
3405 IF( maxerr .LT. 1 )
THEN
3406 WRITE(outnum,*)
'ERROR: Not enough memory to run SDRV tests.'
3407 CALL blacs_abort(-1, 1)
3410 erriptr = errdptr + maxerr
3418 DO 110 igr = 1, ngrid
3420 context = context0(igr)
3421 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
3423 DO 80 ish = 1, nshape
3434 testnum = testnum + 1
3437 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
3443 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
3448 IF( verb .GT. 1 )
THEN
3449 IF( iam .EQ. 0 )
THEN
3450 WRITE(outnum, 7000) testnum,
'RUNNING',
3452 $ ldasrc, ldadst, rsrc, csrc,
3453 $ rdest, cdest, nprow, npcol
3464 IF( myrow .EQ. rsrc .AND. mycol .EQ. csrc )
THEN
3465 CALL cinitmat( uplo, diag, m, n, mem, ldasrc,
3466 $ ipre, ipost, scheckval, testnum,
3469 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3470 CALL ctrsd2d( context, uplo, diag, m, n,
3471 $ mem(aptr), ldasrc, rdest, cdest )
3473 CALL cgesd2d( context, m, n, mem(aptr),
3474 $ ldasrc, rdest, cdest )
3478 IF( myrow .EQ. rdest .AND. mycol .EQ. cdest )
THEN
3482 DO 50 k = 1, ipre+ipost+ldadst*n
3488 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3489 CALL ctrrv2d( context, uplo, diag, m, n,
3490 $ mem(aptr), ldadst, rsrc, csrc )
3492 CALL cgerv2d( context, m, n, mem(aptr),
3493 $ ldadst, rsrc, csrc )
3499 CALL cchkmat( uplo, diag, m, n, mem(aptr), ldadst,
3500 $ rsrc, csrc, myrow, mycol, testnum, maxerr,
3501 $ nerr, mem(erriptr), mem(errdptr) )
3503 CALL cchkpad( uplo, diag, m, n, mem, ldadst,
3504 $ rsrc, csrc, myrow, mycol, ipre, ipost,
3505 $ rcheckval, testnum, maxerr, nerr,
3506 $ mem(erriptr), mem(errdptr) )
3507 testok = i .EQ. nerr
3510 IF( verb .GT. 1 )
THEN
3512 CALL cbtcheckin( 0, outnum, maxerr, nerr,
3513 $ mem(erriptr), mem(errdptr),
3515 IF( iam .EQ. 0 )
THEN
3516 IF( testok .AND. i.EQ.nerr )
THEN
3517 WRITE(outnum, 7000) testnum,
'PASSED ',
3518 $ uplo, diag, m, n, ldasrc, ldadst,
3519 $ rsrc, csrc, rdest, cdest, nprow, npcol
3522 WRITE(outnum, 7000) testnum,
'FAILED ',
3523 $ uplo, diag, m, n, ldasrc, ldadst,
3524 $ rsrc, csrc, rdest, cdest, nprow, npcol
3537 IF( verb .LT. 2 )
THEN
3539 CALL cbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
3540 $ mem(errdptr), tfail )
3542 IF( iam .EQ. 0 )
THEN
3543 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
3544 IF( nfail+nskip .EQ. 0 )
THEN
3545 WRITE(outnum, 8000 ) testnum
3547 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
3554 testok = allpass( (nfail.EQ.0) )
3556 1000
FORMAT(
'COMPLEX SDRV TESTS: BEGIN.' )
3557 2000
FORMAT(1x,a7,3x,10i6)
3558 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
3560 5000
FORMAT(
' TEST# STATUS UPLO DIA M N LDAS LDAD RSRC ',
3561 $
'CSRC RDEST CDEST P Q')
3562 6000
FORMAT(
' ----- ------- ---- --- ----- ----- ----- ----- ---- ',
3563 $
'---- ----- ----- ---- ----')
3564 7000
FORMAT(i6,1x,a7,4x,a1,3x,a1,4i6,2i5,2i6,2i5)
3565 8000
FORMAT(
'COMPLEX SDRV TESTS: PASSED ALL',
3567 9000
FORMAT(
'COMPLEX SDRV TESTS:',i5,
' TESTS;',i5,
' PASSED,',
3568 $ i5,
' SKIPPED,',i5,
' FAILED.')
3577 SUBROUTINE zsdrvtest( OUTNUM, VERB, NSHAPE, UPLO0, DIAG0,
3578 $ NMAT, M0, N0, LDAS0, LDAD0, NSRC, RSRC0,
3579 $ CSRC0, RDEST0, CDEST0, NGRID, CONTEXT0,
3580 $ P0, Q0, TFAIL, MEM, MEMLEN )
3588 INTEGER OUTNUM, VERB, NSHAPE, NMAT, NSRC, NGRID, MEMLEN
3591 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
3592 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
3593 INTEGER RSRC0(NSRC), CSRC0(NSRC), RDEST0(NSRC), CDEST0(NSRC)
3594 INTEGER CONTEXT0(NGRID), P0(NGRID), Q0(NGRID), TFAIL(*)
3595 DOUBLE COMPLEX MEM(MEMLEN)
3682 INTEGER IBTMYPROC, IBTSIZEOF
3683 EXTERNAL ALLPASS, IBTMYPROC, IBTSIZEOF
3686 EXTERNAL BLACS_GRIDINFO
3687 EXTERNAL ZTRSD2D, ZGESD2D, ZTRRV2D, ZGERV2D
3688 EXTERNAL ZINITMAT, ZCHKMAT, ZCHKPAD, ZBTCHECKIN
3691 CHARACTER*1 UPLO, DIAG
3693 INTEGER IAM, I, K, IGR, ISH, IMA, ISO, MYROW, MYCOL, IPRE, IPOST
3694 INTEGER M, N, NPROW, NPCOL, RSRC, CSRC, RDEST, CDEST
3695 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
3696 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, ZSIZE
3697 DOUBLE COMPLEX SCHECKVAL, RCHECKVAL
3701 SCHECKVAL = dcmplx( -0.01d0, -0.01d0 )
3702 rcheckval = dcmplx( -0.02d0, -0.02d0 )
3705 isize = ibtsizeof(
'I')
3706 zsize = ibtsizeof(
'Z')
3710 IF( iam .EQ. 0 )
THEN
3711 WRITE(outnum, *)
' '
3712 WRITE(outnum, *)
' '
3713 WRITE(outnum, 1000 )
3714 IF( verb .GT. 0 )
THEN
3716 WRITE(outnum, 2000)
'NSHAPE:', nshape
3717 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
3718 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
3719 WRITE(outnum, 2000)
'NMAT :', nmat
3720 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
3721 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
3722 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
3723 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
3724 WRITE(outnum, 2000)
'NSRC :', nsrc
3725 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
3726 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
3727 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, nsrc )
3728 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, nsrc )
3729 WRITE(outnum, 2000)
'NGRIDS:', ngrid
3730 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
3731 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
3732 WRITE(outnum, 2000)
'VERB :', verb
3735 IF( verb .GT. 1 )
THEN
3745 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
3746 IF( k .GT. i ) i = k
3748 maxerr = ( zsize * (memlen-i) ) / ( zsize*2 + isize*6 )
3749 IF( maxerr .LT. 1 )
THEN
3750 WRITE(outnum,*)
'ERROR: Not enough memory to run SDRV tests.'
3751 CALL blacs_abort(-1, 1)
3754 erriptr = errdptr + maxerr
3762 DO 110 igr = 1, ngrid
3764 context = context0(igr)
3765 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
3767 DO 80 ish = 1, nshape
3778 testnum = testnum + 1
3781 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
3787 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
3792 IF( verb .GT. 1 )
THEN
3793 IF( iam .EQ. 0 )
THEN
3794 WRITE(outnum, 7000) testnum,
'RUNNING',
3796 $ ldasrc, ldadst, rsrc, csrc,
3797 $ rdest, cdest, nprow, npcol
3808 IF( myrow .EQ. rsrc .AND. mycol .EQ. csrc )
THEN
3809 CALL zinitmat( uplo, diag, m, n, mem, ldasrc,
3810 $ ipre, ipost, scheckval, testnum,
3813 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3814 CALL ztrsd2d( context, uplo, diag, m, n,
3815 $ mem(aptr), ldasrc, rdest, cdest )
3817 CALL zgesd2d( context, m, n, mem(aptr),
3818 $ ldasrc, rdest, cdest )
3822 IF( myrow .EQ. rdest .AND. mycol .EQ. cdest )
THEN
3826 DO 50 k = 1, ipre+ipost+ldadst*n
3832 IF( uplo .EQ.
'U' .OR. uplo .EQ.
'L' )
THEN
3833 CALL ztrrv2d( context, uplo, diag, m, n,
3834 $ mem(aptr), ldadst, rsrc, csrc )
3836 CALL zgerv2d( context, m, n, mem(aptr),
3837 $ ldadst, rsrc, csrc )
3843 CALL zchkmat( uplo, diag, m, n, mem(aptr), ldadst,
3844 $ rsrc, csrc, myrow, mycol, testnum, maxerr,
3845 $ nerr, mem(erriptr), mem(errdptr) )
3847 CALL zchkpad( uplo, diag, m, n, mem, ldadst,
3848 $ rsrc, csrc, myrow, mycol, ipre, ipost,
3849 $ rcheckval, testnum, maxerr, nerr,
3850 $ mem(erriptr), mem(errdptr) )
3851 testok = i .EQ. nerr
3854 IF( verb .GT. 1 )
THEN
3856 CALL zbtcheckin( 0, outnum, maxerr, nerr,
3857 $ mem(erriptr), mem(errdptr),
3859 IF( iam .EQ. 0 )
THEN
3860 IF( testok .AND. i.EQ.nerr )
THEN
3861 WRITE(outnum, 7000) testnum,
'PASSED ',
3862 $ uplo, diag, m, n, ldasrc, ldadst,
3863 $ rsrc, csrc, rdest, cdest, nprow, npcol
3866 WRITE(outnum, 7000) testnum,
'FAILED ',
3867 $ uplo, diag, m, n, ldasrc, ldadst,
3868 $ rsrc, csrc, rdest, cdest, nprow, npcol
3881 IF( verb .LT. 2 )
THEN
3883 CALL zbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
3884 $ mem(errdptr), tfail )
3886 IF( iam .EQ. 0 )
THEN
3887 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
3888 IF( nfail+nskip .EQ. 0 )
THEN
3889 WRITE(outnum, 8000 ) testnum
3891 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
3898 testok = allpass( (nfail.EQ.0) )
3900 1000
FORMAT(
'DOUBLE COMPLEX SDRV TESTS: BEGIN.' )
3901 2000
FORMAT(1x,a7,3x,10i6)
3902 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
3904 5000
FORMAT(
' TEST# STATUS UPLO DIA M N LDAS LDAD RSRC ',
3905 $
'CSRC RDEST CDEST P Q')
3906 6000
FORMAT(
' ----- ------- ---- --- ----- ----- ----- ----- ---- ',
3907 $
'---- ----- ----- ---- ----')
3908 7000
FORMAT(i6,1x,a7,4x,a1,3x,a1,4i6,2i5,2i6,2i5)
3909 8000
FORMAT(
'DOUBLE COMPLEX SDRV TESTS: PASSED ALL',
3911 9000
FORMAT(
'DOUBLE COMPLEX SDRV TESTS:',i5,
' TESTS;',i5,
' PASSED,',
3912 $ i5,
' SKIPPED,',i5,
' FAILED.')
3921 SUBROUTINE ibsbrtest( OUTNUM, VERB, NSCOPE, SCOPE0, NTOP, TOP0,
3922 $ NSHAPE, UPLO0, DIAG0, NMAT, M0, N0, LDAS0,
3923 $ LDAD0, NSRC, RSRC0, CSRC0, NGRID, CONTEXT0,
3924 $ P0, Q0, TFAIL, MEM, MEMLEN )
3932 INTEGER OUTNUM, VERB, NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID
3936 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
3937 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
3938 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
3939 INTEGER RSRC0(NSRC), CSRC0(NSRC), CONTEXT0(NGRID)
3940 INTEGER P0(NGRID), Q0(NGRID), TFAIL(*)
4031 LOGICAL ALLPASS, LSAME
4032 INTEGER IBTMYPROC, IBTSIZEOF
4033 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTSIZEOF
4036 EXTERNAL BLACS_GRIDINFO
4037 EXTERNAL ITRBS2D, IGEBS2D, ITRBR2D, IGEBR2D
4038 EXTERNAL IINITMAT, ICHKMAT, ICHKPAD, IBTCHECKIN
4041 CHARACTER*1 SCOPE, TOP, UPLO, DIAG
4042 LOGICAL TESTOK, INGRID
4043 INTEGER IAM, I, K, J, IGR, ISH, IMA, ISO, ISC, ITO
4044 INTEGER M, N, NPROW, NPCOL, MYROW, MYCOL, RSRC, CSRC
4045 INTEGER ISTART, ISTOP, IPRE, IPOST, SETWHAT
4046 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
4047 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE
4048 INTEGER SCHECKVAL, RCHECKVAL
4056 isize = ibtsizeof(
'I')
4057 isize = ibtsizeof(
'I')
4061 IF( iam .EQ. 0 )
THEN
4062 WRITE(outnum, *)
' '
4063 WRITE(outnum, *)
' '
4064 WRITE(outnum, 1000 )
4065 IF( verb .GT. 0 )
THEN
4067 WRITE(outnum, 2000)
'NSCOPE:', nscope
4068 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
4069 WRITE(outnum, 2000)
'NTOP :', ntop
4070 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
4071 WRITE(outnum, 2000)
'NSHAPE:', nshape
4072 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
4073 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
4074 WRITE(outnum, 2000)
'NMAT :', nmat
4075 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
4076 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
4077 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
4078 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
4079 WRITE(outnum, 2000)
'NSRC :', nsrc
4080 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
4081 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
4082 WRITE(outnum, 2000)
'NGRIDS:', ngrid
4083 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
4084 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
4085 WRITE(outnum, 2000)
'VERB :', verb
4088 IF( verb .GT. 1 )
THEN
4098 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
4099 IF( k .GT. i ) i = k
4101 maxerr = ( isize * (memlen-i) ) / ( isize*2 + isize*6 )
4102 IF( maxerr .LT. 1 )
THEN
4103 WRITE(outnum,*)
'ERROR: Not enough memory to run BSBR tests.'
4104 CALL blacs_abort(-1, 1)
4107 erriptr = errdptr + maxerr
4115 DO 110 igr = 1, ngrid
4117 context = context0(igr)
4118 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
4120 ingrid = ( nprow .GT. 0 )
4122 DO 100 isc = 1, nscope
4130 IF( lsame(top,
'M') )
THEN
4132 IF( scope .EQ.
'R' )
THEN
4133 istart = -(npcol - 1)
4135 ELSE IF (scope .EQ.
'C')
THEN
4136 istart = -(nprow - 1)
4139 istart = -(nprow*npcol - 1)
4142 ELSE IF( lsame(top,
'T') )
THEN
4145 IF( scope .EQ.
'R' )
THEN
4147 ELSE IF (scope .EQ.
'C')
THEN
4150 istop = nprow*npcol - 1
4157 DO 80 ish = 1, nshape
4168 testnum = testnum + 1
4171 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
4175 IF( verb .GT. 1 )
THEN
4176 IF( iam .EQ. 0 )
THEN
4178 $ testnum,
'RUNNING',scope, top, uplo, diag,
4179 $ m, n, ldasrc, ldadst, rsrc, csrc,
4191 IF( (myrow.EQ.rsrc .AND. scope.EQ.
'R') .OR.
4192 $ (mycol.EQ.csrc .AND. scope.EQ.
'C') .OR.
4193 $ (scope .EQ.
'A') )
THEN
4197 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
4198 CALL iinitmat(uplo, diag, m, n, mem,
4199 $ ldasrc, ipre, ipost,
4200 $ scheckval, testnum,
4203 DO 20 j = istart, istop
4204 IF( j.EQ.0 )
GOTO 20
4206 $
CALL blacs_set(context, setwhat, j)
4207 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
4208 CALL itrbs2d(context, scope, top,
4210 $ mem(aptr), ldasrc )
4212 CALL igebs2d(context, scope, top,
4220 ELSE IF( ingrid )
THEN
4221 DO 40 j = istart, istop
4222 IF( j.EQ.0 )
GOTO 40
4224 $
CALL blacs_set(context, setwhat, j)
4228 DO 30 k = 1, ipre+ipost+ldadst*n
4234 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
4235 CALL itrbr2d(context, scope, top,
4237 $ mem(aptr), ldadst,
4240 CALL igebr2d(context, scope, top,
4242 $ ldadst, rsrc, csrc)
4248 CALL ichkmat(uplo, diag, m, n,
4249 $ mem(aptr), ldadst, rsrc, csrc,
4250 $ myrow, mycol, testnum, maxerr,
4251 $ nerr, mem(erriptr),
4254 CALL ichkpad(uplo, diag, m, n, mem,
4255 $ ldadst, rsrc, csrc, myrow,
4256 $ mycol, ipre, ipost, rcheckval,
4257 $ testnum, maxerr, nerr,
4258 $ mem(erriptr), mem(errdptr))
4260 testok = ( i .EQ. nerr )
4264 IF( verb .GT. 1 )
THEN
4266 CALL ibtcheckin(0, outnum, maxerr, nerr,
4267 $ mem(erriptr), mem(errdptr),
4269 IF( iam .EQ. 0 )
THEN
4270 testok = ( testok .AND. (i.EQ.nerr) )
4272 WRITE(outnum,7000)testnum,
'PASSED ',
4273 $ scope, top, uplo, diag, m, n,
4274 $ ldasrc, ldadst, rsrc, csrc,
4278 WRITE(outnum,7000)testnum,
'FAILED ',
4279 $ scope, top, uplo, diag, m, n,
4280 $ ldasrc, ldadst, rsrc, csrc,
4296 IF( verb .LT. 2 )
THEN
4298 CALL ibtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
4299 $ mem(errdptr), tfail )
4301 IF( iam .EQ. 0 )
THEN
4302 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
4303 IF( nfail+nskip .EQ. 0 )
THEN
4304 WRITE(outnum, 8000 ) testnum
4306 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
4313 testok = allpass( (nfail.EQ.0) )
4315 1000
FORMAT(
'INTEGER BSBR TESTS: BEGIN.' )
4316 2000
FORMAT(1x,a7,3x,10i6)
4317 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
4319 5000
FORMAT(
' TEST# STATUS SCOPE TOP UPLO DIAG M N LDAS ',
4320 $
' LDAD RSRC CSRC P Q')
4321 6000
FORMAT(
' ----- ------- ----- --- ---- ---- ----- ----- ----- ',
4322 $
'----- ---- ---- ---- ----')
4323 7000
FORMAT(i6,1x,a7,5x,a1,3x,a1,2(4x,a1), 4i6, 4i5)
4324 8000
FORMAT(
'INTEGER BSBR TESTS: PASSED ALL',
4326 9000
FORMAT(
'INTEGER BSBR TESTS:',i5,
' TESTS;',i5,
' PASSED,',
4327 $ i5,
' SKIPPED,',i5,
' FAILED.')
4336 SUBROUTINE sbsbrtest( OUTNUM, VERB, NSCOPE, SCOPE0, NTOP, TOP0,
4337 $ NSHAPE, UPLO0, DIAG0, NMAT, M0, N0, LDAS0,
4338 $ LDAD0, NSRC, RSRC0, CSRC0, NGRID, CONTEXT0,
4339 $ P0, Q0, TFAIL, MEM, MEMLEN )
4347 INTEGER OUTNUM, VERB, NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID
4351 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
4352 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
4353 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
4354 INTEGER RSRC0(NSRC), CSRC0(NSRC), CONTEXT0(NGRID)
4355 INTEGER P0(NGRID), Q0(NGRID), TFAIL(*)
4446 LOGICAL ALLPASS, LSAME
4447 INTEGER IBTMYPROC, IBTSIZEOF
4448 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTSIZEOF
4451 EXTERNAL BLACS_GRIDINFO
4452 EXTERNAL STRBS2D, SGEBS2D, STRBR2D, SGEBR2D
4453 EXTERNAL SINITMAT, SCHKMAT, SCHKPAD, SBTCHECKIN
4456 CHARACTER*1 SCOPE, TOP, UPLO, DIAG
4457 LOGICAL TESTOK, INGRID
4458 INTEGER IAM, I, K, J, IGR, ISH, IMA, ISO, ISC, ITO
4459 INTEGER M, N, NPROW, NPCOL, MYROW, MYCOL, RSRC, CSRC
4460 INTEGER ISTART, ISTOP, IPRE, IPOST, SETWHAT
4461 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
4462 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, SSIZE
4463 REAL SCHECKVAL, RCHECKVAL
4471 isize = ibtsizeof(
'I')
4472 ssize = ibtsizeof(
'S')
4476 IF( iam .EQ. 0 )
THEN
4477 WRITE(outnum, *)
' '
4478 WRITE(outnum, *)
' '
4479 WRITE(outnum, 1000 )
4480 IF( verb .GT. 0 )
THEN
4482 WRITE(outnum, 2000)
'NSCOPE:', nscope
4483 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
4484 WRITE(outnum, 2000)
'NTOP :', ntop
4485 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
4486 WRITE(outnum, 2000)
'NSHAPE:', nshape
4487 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
4488 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
4489 WRITE(outnum, 2000)
'NMAT :', nmat
4490 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
4491 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
4492 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
4493 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
4494 WRITE(outnum, 2000)
'NSRC :', nsrc
4495 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
4496 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
4497 WRITE(outnum, 2000)
'NGRIDS:', ngrid
4498 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
4499 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
4500 WRITE(outnum, 2000)
'VERB :', verb
4503 IF( verb .GT. 1 )
THEN
4513 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
4514 IF( k .GT. i ) i = k
4516 maxerr = ( ssize * (memlen-i) ) / ( ssize*2 + isize*6 )
4517 IF( maxerr .LT. 1 )
THEN
4518 WRITE(outnum,*)
'ERROR: Not enough memory to run BSBR tests.'
4519 CALL blacs_abort(-1, 1)
4522 erriptr = errdptr + maxerr
4530 DO 110 igr = 1, ngrid
4532 context = context0(igr)
4533 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
4535 ingrid = ( nprow .GT. 0 )
4537 DO 100 isc = 1, nscope
4545 IF( lsame(top,
'M') )
THEN
4547 IF( scope .EQ.
'R' )
THEN
4548 istart = -(npcol - 1)
4550 ELSE IF (scope .EQ.
'C')
THEN
4551 istart = -(nprow - 1)
4554 istart = -(nprow*npcol - 1)
4557 ELSE IF( lsame(top,
'T') )
THEN
4560 IF( scope .EQ.
'R' )
THEN
4562 ELSE IF (scope .EQ.
'C')
THEN
4565 istop = nprow*npcol - 1
4572 DO 80 ish = 1, nshape
4583 testnum = testnum + 1
4586 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
4590 IF( verb .GT. 1 )
THEN
4591 IF( iam .EQ. 0 )
THEN
4593 $ testnum,
'RUNNING',scope, top, uplo, diag,
4594 $ m, n, ldasrc, ldadst, rsrc, csrc,
4606 IF( (myrow.EQ.rsrc .AND. scope.EQ.
'R') .OR.
4607 $ (mycol.EQ.csrc .AND. scope.EQ.
'C') .OR.
4608 $ (scope .EQ.
'A') )
THEN
4612 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
4613 CALL sinitmat(uplo, diag, m, n, mem,
4614 $ ldasrc, ipre, ipost,
4615 $ scheckval, testnum,
4618 DO 20 j = istart, istop
4619 IF( j.EQ.0 )
GOTO 20
4621 $
CALL blacs_set(context, setwhat, j)
4622 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
4623 CALL strbs2d(context, scope, top,
4625 $ mem(aptr), ldasrc )
4627 CALL sgebs2d(context, scope, top,
4635 ELSE IF( ingrid )
THEN
4636 DO 40 j = istart, istop
4637 IF( j.EQ.0 )
GOTO 40
4639 $
CALL blacs_set(context, setwhat, j)
4643 DO 30 k = 1, ipre+ipost+ldadst*n
4649 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
4650 CALL strbr2d(context, scope, top,
4652 $ mem(aptr), ldadst,
4655 CALL sgebr2d(context, scope, top,
4657 $ ldadst, rsrc, csrc)
4663 CALL schkmat(uplo, diag, m, n,
4664 $ mem(aptr), ldadst, rsrc, csrc,
4665 $ myrow, mycol, testnum, maxerr,
4666 $ nerr, mem(erriptr),
4669 CALL schkpad(uplo, diag, m, n, mem,
4670 $ ldadst, rsrc, csrc, myrow,
4671 $ mycol, ipre, ipost, rcheckval,
4672 $ testnum, maxerr, nerr,
4673 $ mem(erriptr), mem(errdptr))
4675 testok = ( i .EQ. nerr )
4679 IF( verb .GT. 1 )
THEN
4681 CALL sbtcheckin(0, outnum, maxerr, nerr,
4682 $ mem(erriptr), mem(errdptr),
4684 IF( iam .EQ. 0 )
THEN
4685 testok = ( testok .AND. (i.EQ.nerr) )
4687 WRITE(outnum,7000)testnum,
'PASSED ',
4688 $ scope, top, uplo, diag, m, n,
4689 $ ldasrc, ldadst, rsrc, csrc,
4693 WRITE(outnum,7000)testnum,
'FAILED ',
4694 $ scope, top, uplo, diag, m, n,
4695 $ ldasrc, ldadst, rsrc, csrc,
4711 IF( verb .LT. 2 )
THEN
4713 CALL sbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
4714 $ mem(errdptr), tfail )
4716 IF( iam .EQ. 0 )
THEN
4717 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
4718 IF( nfail+nskip .EQ. 0 )
THEN
4719 WRITE(outnum, 8000 ) testnum
4721 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
4728 testok = allpass( (nfail.EQ.0) )
4730 1000
FORMAT(
'REAL BSBR TESTS: BEGIN.' )
4731 2000
FORMAT(1x,a7,3x,10i6)
4732 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
4734 5000
FORMAT(
' TEST# STATUS SCOPE TOP UPLO DIAG M N LDAS ',
4735 $
' LDAD RSRC CSRC P Q')
4736 6000
FORMAT(
' ----- ------- ----- --- ---- ---- ----- ----- ----- ',
4737 $
'----- ---- ---- ---- ----')
4738 7000
FORMAT(i6,1x,a7,5x,a1,3x,a1,2(4x,a1), 4i6, 4i5)
4739 8000
FORMAT(
'REAL BSBR TESTS: PASSED ALL',
4741 9000
FORMAT(
'REAL BSBR TESTS:',i5,
' TESTS;',i5,
' PASSED,',
4742 $ i5,
' SKIPPED,',i5,
' FAILED.')
4751 SUBROUTINE dbsbrtest( OUTNUM, VERB, NSCOPE, SCOPE0, NTOP, TOP0,
4752 $ NSHAPE, UPLO0, DIAG0, NMAT, M0, N0, LDAS0,
4753 $ LDAD0, NSRC, RSRC0, CSRC0, NGRID, CONTEXT0,
4754 $ P0, Q0, TFAIL, MEM, MEMLEN )
4762 INTEGER OUTNUM, VERB, NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID
4766 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
4767 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
4768 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
4769 INTEGER RSRC0(NSRC), CSRC0(NSRC), CONTEXT0(NGRID)
4770 INTEGER P0(NGRID), Q0(NGRID), TFAIL(*)
4771 DOUBLE PRECISION MEM(MEMLEN)
4861 LOGICAL ALLPASS, LSAME
4862 INTEGER IBTMYPROC, IBTSIZEOF
4863 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTSIZEOF
4866 EXTERNAL BLACS_GRIDINFO
4867 EXTERNAL DTRBS2D, DGEBS2D, DTRBR2D, DGEBR2D
4868 EXTERNAL DINITMAT, DCHKMAT, DCHKPAD, DBTCHECKIN
4871 CHARACTER*1 SCOPE, TOP, UPLO, DIAG
4872 LOGICAL TESTOK, INGRID
4873 INTEGER IAM, I, K, J, IGR, ISH, IMA, ISO, ISC, ITO
4874 INTEGER M, N, NPROW, NPCOL, MYROW, MYCOL, RSRC, CSRC
4875 INTEGER ISTART, ISTOP, IPRE, IPOST, SETWHAT
4876 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
4877 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, DSIZE
4878 DOUBLE PRECISION SCHECKVAL, RCHECKVAL
4886 isize = ibtsizeof(
'I')
4887 dsize = ibtsizeof(
'D')
4891 IF( iam .EQ. 0 )
THEN
4892 WRITE(outnum, *)
' '
4893 WRITE(outnum, *)
' '
4894 WRITE(outnum, 1000 )
4895 IF( verb .GT. 0 )
THEN
4897 WRITE(outnum, 2000)
'NSCOPE:', nscope
4898 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
4899 WRITE(outnum, 2000)
'NTOP :', ntop
4900 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
4901 WRITE(outnum, 2000)
'NSHAPE:', nshape
4902 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
4903 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
4904 WRITE(outnum, 2000)
'NMAT :', nmat
4905 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
4906 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
4907 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
4908 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
4909 WRITE(outnum, 2000)
'NSRC :', nsrc
4910 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
4911 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
4912 WRITE(outnum, 2000)
'NGRIDS:', ngrid
4913 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
4914 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
4915 WRITE(outnum, 2000)
'VERB :', verb
4918 IF( verb .GT. 1 )
THEN
4928 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
4929 IF( k .GT. i ) i = k
4931 maxerr = ( dsize * (memlen-i) ) / ( dsize*2 + isize*6 )
4932 IF( maxerr .LT. 1 )
THEN
4933 WRITE(outnum,*)
'ERROR: Not enough memory to run BSBR tests.'
4934 CALL blacs_abort(-1, 1)
4937 erriptr = errdptr + maxerr
4945 DO 110 igr = 1, ngrid
4947 context = context0(igr)
4948 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
4950 ingrid = ( nprow .GT. 0 )
4952 DO 100 isc = 1, nscope
4960 IF( lsame(top,
'M') )
THEN
4962 IF( scope .EQ.
'R' )
THEN
4963 istart = -(npcol - 1)
4965 ELSE IF (scope .EQ.
'C')
THEN
4966 istart = -(nprow - 1)
4969 istart = -(nprow*npcol - 1)
4972 ELSE IF( lsame(top,
'T') )
THEN
4975 IF( scope .EQ.
'R' )
THEN
4977 ELSE IF (scope .EQ.
'C')
THEN
4980 istop = nprow*npcol - 1
4987 DO 80 ish = 1, nshape
4998 testnum = testnum + 1
5001 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
5005 IF( verb .GT. 1 )
THEN
5006 IF( iam .EQ. 0 )
THEN
5008 $ testnum,
'RUNNING',scope, top, uplo, diag,
5009 $ m, n, ldasrc, ldadst, rsrc, csrc,
5021 IF( (myrow.EQ.rsrc .AND. scope.EQ.
'R') .OR.
5022 $ (mycol.EQ.csrc .AND. scope.EQ.
'C') .OR.
5023 $ (scope .EQ.
'A') )
THEN
5027 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
5028 CALL dinitmat(uplo, diag, m, n, mem,
5029 $ ldasrc, ipre, ipost,
5030 $ scheckval, testnum,
5033 DO 20 j = istart, istop
5034 IF( j.EQ.0 )
GOTO 20
5036 $
CALL blacs_set(context, setwhat, j)
5037 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5038 CALL dtrbs2d(context, scope, top,
5040 $ mem(aptr), ldasrc )
5042 CALL dgebs2d(context, scope, top,
5050 ELSE IF( ingrid )
THEN
5051 DO 40 j = istart, istop
5052 IF( j.EQ.0 )
GOTO 40
5054 $
CALL blacs_set(context, setwhat, j)
5058 DO 30 k = 1, ipre+ipost+ldadst*n
5064 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5065 CALL dtrbr2d(context, scope, top,
5067 $ mem(aptr), ldadst,
5070 CALL dgebr2d(context, scope, top,
5072 $ ldadst, rsrc, csrc)
5078 CALL dchkmat(uplo, diag, m, n,
5079 $ mem(aptr), ldadst, rsrc, csrc,
5080 $ myrow, mycol, testnum, maxerr,
5081 $ nerr, mem(erriptr),
5084 CALL dchkpad(uplo, diag, m, n, mem,
5085 $ ldadst, rsrc, csrc, myrow,
5086 $ mycol, ipre, ipost, rcheckval,
5087 $ testnum, maxerr, nerr,
5088 $ mem(erriptr), mem(errdptr))
5090 testok = ( i .EQ. nerr )
5094 IF( verb .GT. 1 )
THEN
5096 CALL dbtcheckin(0, outnum, maxerr, nerr,
5097 $ mem(erriptr), mem(errdptr),
5099 IF( iam .EQ. 0 )
THEN
5100 testok = ( testok .AND. (i.EQ.nerr) )
5102 WRITE(outnum,7000)testnum,
'PASSED ',
5103 $ scope, top, uplo, diag, m, n,
5104 $ ldasrc, ldadst, rsrc, csrc,
5108 WRITE(outnum,7000)testnum,
'FAILED ',
5109 $ scope, top, uplo, diag, m, n,
5110 $ ldasrc, ldadst, rsrc, csrc,
5126 IF( verb .LT. 2 )
THEN
5128 CALL dbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
5129 $ mem(errdptr), tfail )
5131 IF( iam .EQ. 0 )
THEN
5132 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
5133 IF( nfail+nskip .EQ. 0 )
THEN
5134 WRITE(outnum, 8000 ) testnum
5136 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
5143 testok = allpass( (nfail.EQ.0) )
5145 1000
FORMAT(
'DOUBLE PRECISION BSBR TESTS: BEGIN.' )
5146 2000
FORMAT(1x,a7,3x,10i6)
5147 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
5149 5000
FORMAT(
' TEST# STATUS SCOPE TOP UPLO DIAG M N LDAS ',
5150 $
' LDAD RSRC CSRC P Q')
5151 6000
FORMAT(
' ----- ------- ----- --- ---- ---- ----- ----- ----- ',
5152 $
'----- ---- ---- ---- ----')
5153 7000
FORMAT(i6,1x,a7,5x,a1,3x,a1,2(4x,a1), 4i6, 4i5)
5154 8000
FORMAT(
'DOUBLE PRECISION BSBR TESTS: PASSED ALL',
5156 9000
FORMAT(
'DOUBLE PRECISION BSBR TESTS:',i5,
' TESTS;',i5,
' PASSED,',
5157 $ i5,
' SKIPPED,',i5,
' FAILED.')
5166 SUBROUTINE cbsbrtest( OUTNUM, VERB, NSCOPE, SCOPE0, NTOP, TOP0,
5167 $ NSHAPE, UPLO0, DIAG0, NMAT, M0, N0, LDAS0,
5168 $ LDAD0, NSRC, RSRC0, CSRC0, NGRID, CONTEXT0,
5169 $ P0, Q0, TFAIL, MEM, MEMLEN )
5177 INTEGER OUTNUM, VERB, NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID
5181 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
5182 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
5183 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
5184 INTEGER RSRC0(NSRC), CSRC0(NSRC), CONTEXT0(NGRID)
5185 INTEGER P0(NGRID), Q0(NGRID), TFAIL(*)
5276 LOGICAL ALLPASS, LSAME
5277 INTEGER IBTMYPROC, IBTSIZEOF
5278 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTSIZEOF
5281 EXTERNAL BLACS_GRIDINFO
5282 EXTERNAL CTRBS2D, CGEBS2D, CTRBR2D, CGEBR2D
5283 EXTERNAL CINITMAT, CCHKMAT, CCHKPAD, CBTCHECKIN
5286 CHARACTER*1 SCOPE, TOP, UPLO, DIAG
5287 LOGICAL TESTOK, INGRID
5288 INTEGER IAM, I, K, J, IGR, ISH, IMA, ISO, ISC, ITO
5289 INTEGER M, N, NPROW, NPCOL, MYROW, MYCOL, RSRC, CSRC
5290 INTEGER ISTART, ISTOP, IPRE, IPOST, SETWHAT
5291 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
5292 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, CSIZE
5293 COMPLEX SCHECKVAL, RCHECKVAL
5297 SCHECKVAL =
cmplx( -0.01, -0.01 )
5298 rcheckval =
cmplx( -0.02, -0.02 )
5301 isize = ibtsizeof(
'I')
5302 csize = ibtsizeof(
'C')
5306 IF( iam .EQ. 0 )
THEN
5307 WRITE(outnum, *)
' '
5308 WRITE(outnum, *)
' '
5309 WRITE(outnum, 1000 )
5310 IF( verb .GT. 0 )
THEN
5312 WRITE(outnum, 2000)
'NSCOPE:', nscope
5313 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
5314 WRITE(outnum, 2000)
'NTOP :', ntop
5315 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
5316 WRITE(outnum, 2000)
'NSHAPE:', nshape
5317 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
5318 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
5319 WRITE(outnum, 2000)
'NMAT :', nmat
5320 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
5321 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
5322 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
5323 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
5324 WRITE(outnum, 2000)
'NSRC :', nsrc
5325 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
5326 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
5327 WRITE(outnum, 2000)
'NGRIDS:', ngrid
5328 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
5329 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
5330 WRITE(outnum, 2000)
'VERB :', verb
5333 IF( verb .GT. 1 )
THEN
5343 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
5344 IF( k .GT. i ) i = k
5346 maxerr = ( csize * (memlen-i) ) / ( csize*2 + isize*6 )
5347 IF( maxerr .LT. 1 )
THEN
5348 WRITE(outnum,*)
'ERROR: Not enough memory to run BSBR tests.'
5349 CALL blacs_abort(-1, 1)
5352 erriptr = errdptr + maxerr
5360 DO 110 igr = 1, ngrid
5362 context = context0(igr)
5363 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
5365 ingrid = ( nprow .GT. 0 )
5367 DO 100 isc = 1, nscope
5375 IF( lsame(top,
'M') )
THEN
5377 IF( scope .EQ.
'R' )
THEN
5378 istart = -(npcol - 1)
5380 ELSE IF (scope .EQ.
'C')
THEN
5381 istart = -(nprow - 1)
5384 istart = -(nprow*npcol - 1)
5387 ELSE IF( lsame(top,
'T') )
THEN
5390 IF( scope .EQ.
'R' )
THEN
5392 ELSE IF (scope .EQ.
'C')
THEN
5395 istop = nprow*npcol - 1
5402 DO 80 ish = 1, nshape
5413 testnum = testnum + 1
5416 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
5420 IF( verb .GT. 1 )
THEN
5421 IF( iam .EQ. 0 )
THEN
5423 $ testnum,
'RUNNING',scope, top, uplo, diag,
5424 $ m, n, ldasrc, ldadst, rsrc, csrc,
5436 IF( (myrow.EQ.rsrc .AND. scope.EQ.
'R') .OR.
5437 $ (mycol.EQ.csrc .AND. scope.EQ.
'C') .OR.
5438 $ (scope .EQ.
'A') )
THEN
5442 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
5443 CALL cinitmat(uplo, diag, m, n, mem,
5444 $ ldasrc, ipre, ipost,
5445 $ scheckval, testnum,
5448 DO 20 j = istart, istop
5449 IF( j.EQ.0 )
GOTO 20
5451 $
CALL blacs_set(context, setwhat, j)
5452 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5453 CALL ctrbs2d(context, scope, top,
5455 $ mem(aptr), ldasrc )
5457 CALL cgebs2d(context, scope, top,
5465 ELSE IF( ingrid )
THEN
5466 DO 40 j = istart, istop
5467 IF( j.EQ.0 )
GOTO 40
5469 $
CALL blacs_set(context, setwhat, j)
5473 DO 30 k = 1, ipre+ipost+ldadst*n
5479 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5480 CALL ctrbr2d(context, scope, top,
5482 $ mem(aptr), ldadst,
5485 CALL cgebr2d(context, scope, top,
5487 $ ldadst, rsrc, csrc)
5493 CALL cchkmat(uplo, diag, m, n,
5494 $ mem(aptr), ldadst, rsrc, csrc,
5495 $ myrow, mycol, testnum, maxerr,
5496 $ nerr, mem(erriptr),
5499 CALL cchkpad(uplo, diag, m, n, mem,
5500 $ ldadst, rsrc, csrc, myrow,
5501 $ mycol, ipre, ipost, rcheckval,
5502 $ testnum, maxerr, nerr,
5503 $ mem(erriptr), mem(errdptr))
5505 testok = ( i .EQ. nerr )
5509 IF( verb .GT. 1 )
THEN
5511 CALL cbtcheckin(0, outnum, maxerr, nerr,
5512 $ mem(erriptr), mem(errdptr),
5514 IF( iam .EQ. 0 )
THEN
5515 testok = ( testok .AND. (i.EQ.nerr) )
5517 WRITE(outnum,7000)testnum,
'PASSED ',
5518 $ scope, top, uplo, diag, m, n,
5519 $ ldasrc, ldadst, rsrc, csrc,
5523 WRITE(outnum,7000)testnum,
'FAILED ',
5524 $ scope, top, uplo, diag, m, n,
5525 $ ldasrc, ldadst, rsrc, csrc,
5541 IF( verb .LT. 2 )
THEN
5543 CALL cbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
5544 $ mem(errdptr), tfail )
5546 IF( iam .EQ. 0 )
THEN
5547 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
5548 IF( nfail+nskip .EQ. 0 )
THEN
5549 WRITE(outnum, 8000 ) testnum
5551 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
5558 testok = allpass( (nfail.EQ.0) )
5560 1000
FORMAT(
'COMPLEX BSBR TESTS: BEGIN.' )
5561 2000
FORMAT(1x,a7,3x,10i6)
5562 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
5564 5000
FORMAT(
' TEST# STATUS SCOPE TOP UPLO DIAG M N LDAS ',
5565 $
' LDAD RSRC CSRC P Q')
5566 6000
FORMAT(
' ----- ------- ----- --- ---- ---- ----- ----- ----- ',
5567 $
'----- ---- ---- ---- ----')
5568 7000
FORMAT(i6,1x,a7,5x,a1,3x,a1,2(4x,a1), 4i6, 4i5)
5569 8000
FORMAT(
'COMPLEX BSBR TESTS: PASSED ALL',
5571 9000
FORMAT(
'COMPLEX BSBR TESTS:',i5,
' TESTS;',i5,
' PASSED,',
5572 $ i5,
' SKIPPED,',i5,
' FAILED.')
5581 SUBROUTINE zbsbrtest( OUTNUM, VERB, NSCOPE, SCOPE0, NTOP, TOP0,
5582 $ NSHAPE, UPLO0, DIAG0, NMAT, M0, N0, LDAS0,
5583 $ LDAD0, NSRC, RSRC0, CSRC0, NGRID, CONTEXT0,
5584 $ P0, Q0, TFAIL, MEM, MEMLEN )
5592 INTEGER OUTNUM, VERB, NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID
5596 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
5597 CHARACTER*1 UPLO0(NSHAPE), DIAG0(NSHAPE)
5598 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
5599 INTEGER RSRC0(NSRC), CSRC0(NSRC), CONTEXT0(NGRID)
5600 INTEGER P0(NGRID), Q0(NGRID), TFAIL(*)
5601 DOUBLE COMPLEX MEM(MEMLEN)
5691 LOGICAL ALLPASS, LSAME
5692 INTEGER IBTMYPROC, IBTSIZEOF
5693 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTSIZEOF
5696 EXTERNAL BLACS_GRIDINFO
5697 EXTERNAL ZTRBS2D, ZGEBS2D, ZTRBR2D, ZGEBR2D
5698 EXTERNAL ZINITMAT, ZCHKMAT, ZCHKPAD, ZBTCHECKIN
5701 CHARACTER*1 SCOPE, TOP, UPLO, DIAG
5702 LOGICAL TESTOK, INGRID
5703 INTEGER IAM, I, K, J, IGR, ISH, IMA, ISO, ISC, ITO
5704 INTEGER M, N, NPROW, NPCOL, MYROW, MYCOL, RSRC, CSRC
5705 INTEGER ISTART, ISTOP, IPRE, IPOST, SETWHAT
5706 INTEGER NERR, NSKIP, NFAIL, TESTNUM, CONTEXT, MAXERR, LDASRC
5707 INTEGER LDADST, ERRDPTR, APTR, ERRIPTR, ISIZE, ZSIZE
5708 DOUBLE COMPLEX SCHECKVAL, RCHECKVAL
5712 SCHECKVAL = dcmplx( -0.01d0, -0.01d0 )
5713 rcheckval = dcmplx( -0.02d0, -0.02d0 )
5716 isize = ibtsizeof(
'I')
5717 zsize = ibtsizeof(
'Z')
5721 IF( iam .EQ. 0 )
THEN
5722 WRITE(outnum, *)
' '
5723 WRITE(outnum, *)
' '
5724 WRITE(outnum, 1000 )
5725 IF( verb .GT. 0 )
THEN
5727 WRITE(outnum, 2000)
'NSCOPE:', nscope
5728 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
5729 WRITE(outnum, 2000)
'NTOP :', ntop
5730 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
5731 WRITE(outnum, 2000)
'NSHAPE:', nshape
5732 WRITE(outnum, 3000)
' UPLO :', ( uplo0(i), i = 1, nshape )
5733 WRITE(outnum, 3000)
' DIAG :', ( diag0(i), i = 1, nshape )
5734 WRITE(outnum, 2000)
'NMAT :', nmat
5735 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
5736 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
5737 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
5738 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
5739 WRITE(outnum, 2000)
'NSRC :', nsrc
5740 WRITE(outnum, 2000)
' RSRC :',( rsrc0(i), i = 1, nsrc )
5741 WRITE(outnum, 2000)
' CSRC :',( csrc0(i), i = 1, nsrc )
5742 WRITE(outnum, 2000)
'NGRIDS:', ngrid
5743 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
5744 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
5745 WRITE(outnum, 2000)
'VERB :', verb
5748 IF( verb .GT. 1 )
THEN
5758 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + 4 * m0(ima)
5759 IF( k .GT. i ) i = k
5761 maxerr = ( zsize * (memlen-i) ) / ( zsize*2 + isize*6 )
5762 IF( maxerr .LT. 1 )
THEN
5763 WRITE(outnum,*)
'ERROR: Not enough memory to run BSBR tests.'
5764 CALL blacs_abort(-1, 1)
5767 erriptr = errdptr + maxerr
5775 DO 110 igr = 1, ngrid
5777 context = context0(igr)
5778 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
5780 ingrid = ( nprow .GT. 0 )
5782 DO 100 isc = 1, nscope
5790 IF( lsame(top,
'M') )
THEN
5792 IF( scope .EQ.
'R' )
THEN
5793 istart = -(npcol - 1)
5795 ELSE IF (scope .EQ.
'C')
THEN
5796 istart = -(nprow - 1)
5799 istart = -(nprow*npcol - 1)
5802 ELSE IF( lsame(top,
'T') )
THEN
5805 IF( scope .EQ.
'R' )
THEN
5807 ELSE IF (scope .EQ.
'C')
THEN
5810 istop = nprow*npcol - 1
5817 DO 80 ish = 1, nshape
5828 testnum = testnum + 1
5831 IF( rsrc.GE.p0(igr) .OR. csrc.GE.q0(igr) )
THEN
5835 IF( verb .GT. 1 )
THEN
5836 IF( iam .EQ. 0 )
THEN
5838 $ testnum,
'RUNNING',scope, top, uplo, diag,
5839 $ m, n, ldasrc, ldadst, rsrc, csrc,
5851 IF( (myrow.EQ.rsrc .AND. scope.EQ.
'R') .OR.
5852 $ (mycol.EQ.csrc .AND. scope.EQ.
'C') .OR.
5853 $ (scope .EQ.
'A') )
THEN
5857 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
5858 CALL zinitmat(uplo, diag, m, n, mem,
5859 $ ldasrc, ipre, ipost,
5860 $ scheckval, testnum,
5863 DO 20 j = istart, istop
5864 IF( j.EQ.0 )
GOTO 20
5866 $
CALL blacs_set(context, setwhat, j)
5867 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5868 CALL ztrbs2d(context, scope, top,
5870 $ mem(aptr), ldasrc )
5872 CALL zgebs2d(context, scope, top,
5880 ELSE IF( ingrid )
THEN
5881 DO 40 j = istart, istop
5882 IF( j.EQ.0 )
GOTO 40
5884 $
CALL blacs_set(context, setwhat, j)
5888 DO 30 k = 1, ipre+ipost+ldadst*n
5894 IF( uplo.EQ.
'U' .OR. uplo.EQ.
'L' )
THEN
5895 CALL ztrbr2d(context, scope, top,
5897 $ mem(aptr), ldadst,
5900 CALL zgebr2d(context, scope, top,
5902 $ ldadst, rsrc, csrc)
5908 CALL zchkmat(uplo, diag, m, n,
5909 $ mem(aptr), ldadst, rsrc, csrc,
5910 $ myrow, mycol, testnum, maxerr,
5911 $ nerr, mem(erriptr),
5914 CALL zchkpad(uplo, diag, m, n, mem,
5915 $ ldadst, rsrc, csrc, myrow,
5916 $ mycol, ipre, ipost, rcheckval,
5917 $ testnum, maxerr, nerr,
5918 $ mem(erriptr), mem(errdptr))
5920 testok = ( i .EQ. nerr )
5924 IF( verb .GT. 1 )
THEN
5926 CALL zbtcheckin(0, outnum, maxerr, nerr,
5927 $ mem(erriptr), mem(errdptr),
5929 IF( iam .EQ. 0 )
THEN
5930 testok = ( testok .AND. (i.EQ.nerr) )
5932 WRITE(outnum,7000)testnum,
'PASSED ',
5933 $ scope, top, uplo, diag, m, n,
5934 $ ldasrc, ldadst, rsrc, csrc,
5938 WRITE(outnum,7000)testnum,
'FAILED ',
5939 $ scope, top, uplo, diag, m, n,
5940 $ ldasrc, ldadst, rsrc, csrc,
5956 IF( verb .LT. 2 )
THEN
5958 CALL zbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
5959 $ mem(errdptr), tfail )
5961 IF( iam .EQ. 0 )
THEN
5962 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
5963 IF( nfail+nskip .EQ. 0 )
THEN
5964 WRITE(outnum, 8000 ) testnum
5966 WRITE(outnum, 9000 ) testnum, testnum-nskip-nfail,
5973 testok = allpass( (nfail.EQ.0) )
5975 1000
FORMAT(
'DOUBLE COMPLEX BSBR TESTS: BEGIN.' )
5976 2000
FORMAT(1x,a7,3x,10i6)
5977 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
5979 5000
FORMAT(
' TEST# STATUS SCOPE TOP UPLO DIAG M N LDAS ',
5980 $
' LDAD RSRC CSRC P Q')
5981 6000
FORMAT(
' ----- ------- ----- --- ---- ---- ----- ----- ----- ',
5982 $
'----- ---- ---- ---- ----')
5983 7000
FORMAT(i6,1x,a7,5x,a1,3x,a1,2(4x,a1), 4i6, 4i5)
5984 8000
FORMAT(
'DOUBLE COMPLEX BSBR TESTS: PASSED ALL',
5986 9000
FORMAT(
'DOUBLE COMPLEX BSBR TESTS:',i5,
' TESTS;',i5,
' PASSED,',
5987 $ i5,
' SKIPPED,',i5,
' FAILED.')
5996 SUBROUTINE rdcomb( MEMUSED, MEM, MEMLEN, CMEMUSED, CMEM, CMEMLEN,
6005 INTEGER MEMUSED, MEMLEN, CMEMUSED, CMEMLEN, OUTNUM
6008 CHARACTER*1 CMEM(CMEMLEN)
6045 PARAMETER( SDIN = 12 )
6052 INTEGER TOPSREPEAT, TOPSCOHRNT, NOPS, NSCOPE, NTOP, NMAT, NDEST
6053 INTEGER NGRID, I, J, OPPTR, SCOPEPTR, TOPPTR, MPTR, NPTR
6054 INTEGER LDSPTR, LDDPTR, LDIPTR, RDESTPTR, CDESTPTR, PPTR, QPTR
6090 OPEN(unit = sdin, file =
'comb.dat', status =
'OLD')
6096 cmemused = opptr + nops
6097 IF ( cmemused .GT. cmemlen )
THEN
6098 WRITE(outnum, 1000) cmemlen, nops,
'OPERATIONS.'
6099 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6101 ELSE IF( nops .LT. 1 )
THEN
6102 WRITE(outnum, 2000)
'OPERATIONS.'
6103 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6107 READ(sdin, *) ( cmem(opptr+i), i = 0, nops-1 )
6109 IF( (cmem(opptr+i).NE.
'+') .AND. (cmem(opptr+i).NE.
'>') .AND.
6110 $ (cmem(opptr+i).NE.
'<') )
THEN
6111 WRITE(outnum,5000) cmem(opptr+i)
6112 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6119 READ(sdin, *) nscope
6121 cmemused = scopeptr + nscope
6122 IF ( cmemused .GT. cmemlen )
THEN
6123 WRITE(outnum, 1000) cmemlen, nscope,
'SCOPES.'
6124 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6126 ELSE IF( nscope .LT. 1 )
THEN
6127 WRITE(outnum, 2000)
'SCOPE.'
6128 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6132 READ(sdin, *) ( cmem(scopeptr+i), i = 0, nscope-1 )
6133 DO 20 i = 0, nscope-1
6134 IF(
lsame(cmem(scopeptr+i),
'R') )
THEN
6135 cmem(scopeptr+i) =
'R'
6136 ELSE IF(
lsame(cmem(scopeptr+i),
'C') )
THEN
6137 cmem(scopeptr+i) =
'C'
6138 ELSE IF(
lsame(cmem(scopeptr+i),
'A') )
THEN
6139 cmem(scopeptr+i) =
'A'
6141 WRITE(outnum, 3000)
'SCOPE', cmem(scopeptr+i)
6142 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6147 READ(sdin, *) topsrepeat
6148 READ(sdin, *) topscohrnt
6152 cmemused = topptr + ntop
6153 IF ( cmemused .GT. cmemlen )
THEN
6154 WRITE(outnum, 1000) cmemlen, ntop,
'TOPOLOGIES.'
6155 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6157 ELSE IF( ntop .LT. 1 )
THEN
6158 WRITE(outnum, 2000)
'TOPOLOGY.'
6159 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6162 READ(sdin, *) ( cmem(topptr+i), i = 0, ntop-1 )
6170 ldsptr = nptr + nmat
6171 lddptr = ldsptr + nmat
6172 ldiptr = lddptr + nmat
6173 memused = ldiptr + nmat
6174 IF( memused .GT. memlen )
THEN
6175 WRITE(outnum, 1000) memlen, nmat,
'MATRICES.'
6176 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6178 ELSE IF( nmat .LT. 1 )
THEN
6179 WRITE(outnum, 2000)
'MATRIX.'
6180 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6183 READ(sdin, *) ( mem( mptr+i ), i = 0, nmat-1 )
6184 READ(sdin, *) ( mem( nptr+i ), i = 0, nmat-1 )
6185 READ(sdin, *) ( mem( ldsptr+i ), i = 0, nmat-1 )
6186 READ(sdin, *) ( mem( lddptr+i ), i = 0, nmat-1 )
6187 READ(sdin, *) ( mem( ldiptr+i ), i = 0, nmat-1 )
6191 CALL chkmatdat( outnum,
'COMB.dat', .true., nmat, mem(mptr),
6192 $ mem(nptr), mem(ldsptr), mem(lddptr), mem(ldiptr) )
6198 cdestptr = rdestptr + ndest
6199 memused = cdestptr + ndest
6200 IF( memused .GT. memlen )
THEN
6201 WRITE(outnum, 1000) memlen, nmat,
'DEST.'
6202 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6204 ELSE IF( ndest .LT. 1 )
THEN
6205 WRITE(outnum, 2000)
'DEST.'
6206 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6209 READ(sdin, *) ( mem(rdestptr+i), i = 0, ndest-1 )
6210 READ(sdin, *) ( mem(cdestptr+i), i = 0, ndest-1 )
6218 memused = qptr + ngrid
6219 IF( memused .GT. memlen )
THEN
6220 WRITE(outnum, 1000) memlen, ngrid,
'PROCESS GRIDS.'
6221 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6223 ELSE IF( ngrid .LT. 1 )
THEN
6224 WRITE(outnum, 2000)
'PROCESS GRID'
6225 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE( outnum )
6229 READ(sdin, *) ( mem(pptr+i), i = 0, ngrid-1 )
6230 READ(sdin, *) ( mem(qptr+i), i = 0, ngrid-1 )
6231 IF( sdin .NE. 6 .AND. sdin .NE. 0 )
CLOSE( sdin )
6235 DO 70 j = 0, ngrid-1
6236 IF( mem(pptr+j).LT.1 .OR. mem(qptr+j).LT.1 )
THEN
6237 WRITE(outnum, 4000) mem(pptr+j), mem(qptr+j)
6238 IF( outnum .NE. 6 .AND. outnum .NE. 0 )
CLOSE(outnum)
6246 mem(memused+1) = nscope
6247 mem(memused+2) = topsrepeat
6248 mem(memused+3) = topscohrnt
6249 mem(memused+4) = ntop
6250 mem(memused+5) = nmat
6251 mem(memused+6) = ndest
6252 mem(memused+7) = ngrid
6253 memused = memused + 7
6254 cmemused = cmemused - 1
6256 1000
FORMAT(
'Mem too short (',i4,
') to handle',i4,
' ',a20)
6257 2000
FORMAT(
'Must have at least one ',a20)
6258 3000
FORMAT(
'UNRECOGNIZABLE ',a5,
' ''', a1,
'''.')
6259 4000
FORMAT(
'Illegal process grid: {',i3,
',',i3,
'}.')
6260 5000
FORMAT(
'Illegal OP value ''',a1,
''':, expected ''+'' (SUM),',
6261 $
' ''>'' (MAX), or ''<'' (MIN).')
6270 SUBROUTINE ibtcheckin( NFTESTS, OUTNUM, MAXERR, NERR, IERR,
6272 INTEGER NFTESTS, OUTNUM, MAXERR, NERR
6273 INTEGER IERR(*), TFAILED(*)
6326 INTEGER IBTMYPROC, IBTNPROCS, IBTMSGID
6327 EXTERNAL IBTMYPROC, IBTNPROCS, IBTMSGID
6331 INTEGER K, NERR2, IAM, NPROCS, NTESTS
6336 nprocs = ibtnprocs()
6338 IF( iam .EQ. 0 )
THEN
6343 counting = nftests .GT. 0
6351 CALL iprinterrs(outnum, maxerr, nerr, ierr, ival, counting,
6354 DO 20 k = 1, nprocs-1
6355 CALL btsend(3, 0, k, k, ibtmsgid()+50)
6356 CALL btrecv(3, 1, nerr2, k, ibtmsgid()+50)
6357 IF( nerr2 .GT. 0 )
THEN
6359 CALL btrecv(3, nerr2*6, ierr, k, ibtmsgid()+51)
6360 CALL btrecv(3, nerr2*2, ival, k, ibtmsgid()+51)
6361 CALL iprinterrs(outnum, maxerr, nerr2, ierr, ival,
6362 $ counting, tfailed)
6371 nftests = nftests + tfailed(k)
6378 CALL btrecv(3, 0, k, 0, ibtmsgid()+50)
6379 CALL btsend(3, 1, nerr, 0, ibtmsgid()+50)
6380 IF( nerr .GT. 0 )
THEN
6381 CALL btsend(3, nerr*6, ierr, 0, ibtmsgid()+51)
6382 CALL btsend(3, nerr*2, ival, 0, ibtmsgid()+51)
6392 SUBROUTINE iinitmat(UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
6393 $ CHECKVAL, TESTNUM, MYROW, MYCOL)
6394 CHARACTER*1 UPLO, DIAG
6395 INTEGER M, N, LDA, IPRE, IPOST, TESTNUM, MYROW, MYCOL
6404 CALL igenmat( m, n, mem(ipre+1), lda, testnum, myrow, mycol )
6405 CALL ipadmat( uplo, diag, m, n, mem, lda, ipre, ipost, checkval )
6410 SUBROUTINE igenmat( M, N, A, LDA, TESTNUM, MYROW, MYCOL )
6418 INTEGER M, N, LDA, TESTNUM, MYROW, MYCOL
6452 EXTERNAL ibtran, ibtnprocs
6455 INTEGER I, J, NPROCS, SRC
6467 nprocs = ibtnprocs()
6468 src = myrow * nprocs + mycol
6469 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
6470 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
6471 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
6472 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
6476 a(i, j) = ibtran( iseed )
6485 INTEGER FUNCTION ibtran(ISEED)
6493 DOUBLE PRECISION dval
6497 dval = 1.0d6 *
dlarnd(2, iseed)
6506 SUBROUTINE ipadmat( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
6514 CHARACTER*1 UPLO, DIAG
6515 INTEGER M, N, LDA, IPRE, IPOST
6573 IF( ipre .GT. 0 )
THEN
6581 IF( ipost .GT. 0 )
THEN
6582 j = ipre + lda*n + 1
6583 DO 20 i = j, j+ipost-1
6590 IF( lda .GT. m )
THEN
6593 DO 30 i = k, k+lda-m-1
6604 IF( uplo .EQ.
'U' )
THEN
6606 IF( diag .EQ.
'U' )
THEN
6609 k = ipre + i + (j-1)*lda
6616 k = ipre + i + (j-1)*lda
6622 IF( diag .EQ.
'U' )
THEN
6624 DO 46 j = 1, i-(m-n)
6625 k = ipre + i + (j-1)*lda
6631 DO 48 j = 1, i-(m-n)-1
6632 k = ipre + i + (j-1)*lda
6638 ELSE IF( uplo .EQ.
'L' )
THEN
6640 IF( diag .EQ.
'U' )
THEN
6643 k = ipre + i + (j-1)*lda
6649 DO 52 j = n-m+i+1, n
6650 k = ipre + i + (j-1)*lda
6656 IF( uplo .EQ.
'U' )
THEN
6659 k = ipre + i + (j-1)*lda
6666 k = ipre + i + (j-1)*lda
6679 SUBROUTINE ichkpad( UPLO, DIAG, M, N, MEM, LDA, RSRC, CSRC,
6680 $ MYROW, MYCOL, IPRE, IPOST, CHECKVAL,
6681 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF )
6689 CHARACTER*1 UPLO, DIAG
6690 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, IPRE, IPOST
6691 INTEGER TESTNUM, MAXERR, NERR
6695 INTEGER ERRIBUF(6, MAXERR)
6696 INTEGER MEM(*), ERRDBUF(2, MAXERR)
6783 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
6784 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
6785 parameter( err_mat = 5 )
6793 INTEGER I, J, K, IRST, IRND, ICST, ICND, SRC, DEST
6798 NPROCS = ibtnprocs()
6799 src = rsrc * nprocs + csrc
6800 dest = myrow * nprocs + mycol
6804 IF( ipre .GT. 0 )
THEN
6806 IF( mem(i) .NE. checkval )
THEN
6808 IF( nerr .LE. maxerr )
THEN
6809 erribuf(1, nerr) = testnum
6810 erribuf(2, nerr) = src
6811 erribuf(3, nerr) = dest
6812 erribuf(4, nerr) = i
6813 erribuf(5, nerr) = ipre - i + 1
6814 erribuf(6, nerr) = err_pre
6815 errdbuf(1, nerr) = mem(i)
6816 errdbuf(2, nerr) = checkval
6824 IF( ipost .GT. 0 )
THEN
6825 j = ipre + lda*n + 1
6826 DO 20 i = j, j+ipost-1
6827 IF( mem(i) .NE. checkval )
THEN
6829 IF( nerr .LE. maxerr )
THEN
6830 erribuf(1, nerr) = testnum
6831 erribuf(2, nerr) = src
6832 erribuf(3, nerr) = dest
6833 erribuf(4, nerr) = i - j + 1
6834 erribuf(5, nerr) = j
6835 erribuf(6, nerr) = err_post
6836 errdbuf(1, nerr) = mem(i)
6837 errdbuf(2, nerr) = checkval
6845 IF( lda .GT. m )
THEN
6848 k = ipre + (j-1)*lda + i
6849 IF( mem(k) .NE. checkval)
THEN
6851 IF( nerr .LE. maxerr )
THEN
6852 erribuf(1, nerr) = testnum
6853 erribuf(2, nerr) = src
6854 erribuf(3, nerr) = dest
6855 erribuf(4, nerr) = i
6856 erribuf(5, nerr) = j
6857 erribuf(6, nerr) = err_gap
6858 errdbuf(1, nerr) = mem(k)
6859 errdbuf(2, nerr) = checkval
6869 IF( uplo .EQ.
'U' )
THEN
6876 ELSEIF( m .GT. n )
THEN
6882 IF( diag .EQ.
'U' )
THEN
6886 ELSE IF( uplo .EQ.
'L' )
THEN
6893 ELSEIF( m .GT. n )
THEN
6899 IF( diag .EQ.
'U' )
THEN
6907 DO 100 j = icst, icnd
6908 DO 105 i = irst, irnd
6909 IF( mem( ipre + (j-1)*lda + i ) .NE. checkval )
THEN
6911 IF( nerr .LE. maxerr )
THEN
6912 erribuf(1, nerr) = testnum
6913 erribuf(2, nerr) = src
6914 erribuf(3, nerr) = dest
6915 erribuf(4, nerr) = i
6916 erribuf(5, nerr) = j
6917 erribuf(6, nerr) = err_tri
6918 errdbuf(1, nerr) = mem( ipre + (j-1)*lda + i )
6919 errdbuf(2, nerr) = checkval
6926 IF( uplo .EQ.
'U' )
THEN
6940 SUBROUTINE ichkmat( UPLO, DIAG, M, N, A, LDA, RSRC, CSRC,
6941 $ MYROW, MYCOL, TESTNUM, MAXERR, NERR,
6942 $ ERRIBUF, ERRDBUF )
6950 CHARACTER*1 UPLO, DIAG
6951 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, TESTNUM
6952 INTEGER MAXERR, NERR
6955 INTEGER ERRIBUF(6, MAXERR)
6956 INTEGER A(LDA,N), ERRDBUF(2, MAXERR)
7035 INTEGER I, J, NPROCS, SRC, DEST
7045 EXTERNAL IBTRAN, IBTNPROCS
7049 NPROCS = ibtnprocs()
7050 src = rsrc * nprocs + csrc
7051 dest = myrow * nprocs + mycol
7055 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
7056 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
7057 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
7058 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
7066 compval = ibtran( iseed )
7073 IF( uplo .EQ.
'U' )
THEN
7075 IF( diag .EQ.
'U' )
THEN
7085 IF( diag .EQ.
'U' )
THEN
7086 IF( i .GE. m-n+j )
THEN
7090 IF( i .GT. m-n+j )
THEN
7095 ELSE IF( uplo .EQ.
'L' )
THEN
7097 IF( diag .EQ.
'U' )
THEN
7098 IF( j. ge. i+(n-m) )
THEN
7102 IF( j .GT. i+(n-m) )
THEN
7107 IF( diag .EQ.
'U' )
THEN
7124 IF( a(i,j) .NE. compval )
THEN
7126 IF( nerr .LE. maxerr )
THEN
7127 erribuf(1, nerr) = testnum
7128 erribuf(2, nerr) = src
7129 erribuf(3, nerr) = dest
7130 erribuf(4, nerr) = i
7131 erribuf(5, nerr) = j
7132 erribuf(6, nerr) = 5
7133 errdbuf(1, nerr) = a(i, j)
7134 errdbuf(2, nerr) = compval
7147 $ ERRIBUF, ERRDBUF, COUNTING, TFAILED )
7156 INTEGER OUTNUM, MAXERR, NERR
7159 INTEGER ERRIBUF(6, MAXERR), TFAILED(*)
7160 INTEGER ERRDBUF(2, MAXERR)
7208 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
7209 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
7210 parameter( err_mat = 5 )
7213 INTEGER IBTMYPROC, IBTNPROCS
7214 EXTERNAL ibtmyproc, ibtnprocs
7219 INTEGER OLDTEST, NPROCS, PROW, PCOL, I, ERRTYPE
7223 IF( (IBTMYPROC().NE.0) .OR. (NERR.LE.0) ) RETURN
7225 nprocs = ibtnprocs()
7226 prow = erribuf(3,1) / nprocs
7227 pcol = mod( erribuf(3,1), nprocs )
7228 IF( nerr .GT. maxerr )
WRITE(outnum,13000)
7230 DO 20 i = 1,
min( nerr, maxerr )
7231 IF( erribuf(1,i) .NE. oldtest )
THEN
7232 IF( oldtest .NE. -1 )
7233 $
WRITE(outnum,12000) prow, pcol, oldtest
7235 WRITE(outnum,1000) prow, pcol, erribuf(1,i)
7236 IF( counting ) tfailed( erribuf(1,i) ) = 1
7237 oldtest = erribuf(1, i)
7242 errtype = erribuf(6, i)
7243 IF( errtype .LT. -10 )
THEN
7244 errtype = -errtype - 10
7247 ELSE IF( errtype .LT. 0 )
THEN
7258 IF( erribuf(2, i) .EQ. -1 )
THEN
7259 WRITE(outnum,11000) erribuf(4,i), erribuf(5,i), mat,
7260 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
7261 ELSE IF( errtype .EQ. err_pre )
THEN
7262 WRITE(outnum,7000) erribuf(5,i), mat,
7263 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
7264 ELSE IF( errtype .EQ. err_post )
THEN
7265 WRITE(outnum,8000) erribuf(4,i), mat,
7266 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
7267 ELSE IF( errtype .EQ. err_gap )
THEN
7268 WRITE(outnum,9000) mat, erribuf(4,i), erribuf(5,i),
7269 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
7271 WRITE(outnum,10000) mat, erribuf(4,i), erribuf(5,i),
7272 $ int( errdbuf(2,i) ),
7273 $ int( errdbuf(1,i) )
7279 IF( errtype .EQ. err_pre )
THEN
7280 WRITE(outnum,2000) erribuf(5,i), errdbuf(2,i),
7282 ELSE IF( errtype .EQ. err_post )
THEN
7283 WRITE(outnum,3000) erribuf(4,i), errdbuf(2,i),
7285 ELSE IF( errtype .EQ. err_gap )
THEN
7286 WRITE(outnum,4000) erribuf(4,i), erribuf(5,i),
7287 $ errdbuf(2,i), errdbuf(1,i)
7288 ELSE IF( errtype .EQ. err_tri )
THEN
7289 WRITE(outnum,5000) erribuf(4,i), erribuf(5,i),
7290 $ errdbuf(2,i), errdbuf(1,i)
7292 WRITE(outnum,6000) erribuf(4,i), erribuf(5,i),
7293 $ errdbuf(2,i), errdbuf(1,i)
7297 WRITE(outnum,12000) prow, pcol, oldtest
7299 1000
FORMAT(
'PROCESS {',i4,
',',i4,
'} REPORTS ERRORS IN TEST#',i6,
':')
7300 2000
FORMAT(
' Buffer overwrite ',i4,
7301 $
' elements before the start of A:',/,
7303 $
'; Received=',i12)
7304 3000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of A:',
7305 $ /,
' Expected=',i12,
7306 $
'; Received=',i12)
7307 4000
FORMAT(
' LDA-M gap overwrite at postion (',i4,
',',i4,
'):',/,
7309 $
'; Received=',i12)
7310 5000
FORMAT(
' Complementory triangle overwrite at A(',i4,
',',i4,
7311 $
'):',/,
' Expected=',i12,
7312 $
'; Received=',i12)
7313 6000
FORMAT(
' Invalid element at A(',i4,
',',i4,
'):',/,
7315 $
'; Received=',i12)
7316 7000
FORMAT(
' Buffer overwrite ',i4,
' elements before the start of ',
7317 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
7318 8000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of ',
7319 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
7321 9000
FORMAT(
' LD',a1,
'A-M gap overwrite at postion (',i4,
',',i4,
'):'
7322 $ ,/,
' Expected=',i12,
'; Received=',i12)
7324 10000
FORMAT(
' Invalid element at ',a1,
'A(',i4,
',',i4,
'):',/,
7325 $
' Expected=',i12,
'; Received=',i12)
7326 11000
FORMAT(
' Overwrite at position (',i4,
',',i4,
') of non-existent '
7327 $ ,a1,
'A array.',/,
' Expected=',i12,
'; Received=',i12)
7328 12000
FORMAT(
'PROCESS {',i4,
',',i4,
'} DONE ERROR REPORT FOR TEST#',
7330 13000
FORMAT(
'WARNING: There were more errors than could be recorded.',
7331 $ /,
'Increase MEMELTS to get complete listing.')
7339 SUBROUTINE sbtcheckin( NFTESTS, OUTNUM, MAXERR, NERR, IERR,
7341 INTEGER NFTESTS, OUTNUM, MAXERR, NERR
7342 INTEGER IERR(*), TFAILED(*)
7395 INTEGER IBTMYPROC, IBTNPROCS, IBTMSGID
7396 EXTERNAL ibtmyproc, ibtnprocs, ibtmsgid
7400 INTEGER K, NERR2, IAM, NPROCS, NTESTS
7405 nprocs = ibtnprocs()
7407 IF( iam .EQ. 0 )
THEN
7412 counting = nftests .GT. 0
7420 CALL sprinterrs(outnum, maxerr, nerr, ierr, sval, counting,
7423 DO 20 k = 1, nprocs-1
7424 CALL btsend(3, 0, k, k, ibtmsgid()+50)
7425 CALL btrecv(3, 1, nerr2, k, ibtmsgid()+50)
7426 IF( nerr2 .GT. 0 )
THEN
7428 CALL btrecv(3, nerr2*6, ierr, k, ibtmsgid()+51)
7429 CALL btrecv(4, nerr2*2, sval, k, ibtmsgid()+51)
7430 CALL sprinterrs(outnum, maxerr, nerr2, ierr, sval,
7431 $ counting, tfailed)
7440 nftests = nftests + tfailed(k)
7447 CALL btrecv(3, 0, k, 0, ibtmsgid()+50)
7448 CALL btsend(3, 1, nerr, 0, ibtmsgid()+50)
7449 IF( nerr .GT. 0 )
THEN
7450 CALL btsend(3, nerr*6, ierr, 0, ibtmsgid()+51)
7451 CALL btsend(4, nerr*2, sval, 0, ibtmsgid()+51)
7461 SUBROUTINE sinitmat(UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
7462 $ CHECKVAL, TESTNUM, MYROW, MYCOL)
7463 CHARACTER*1 UPLO, DIAG
7464 INTEGER M, N, LDA, IPRE, IPOST, TESTNUM, MYROW, MYCOL
7473 CALL sgenmat( m, n, mem(ipre+1), lda, testnum, myrow, mycol )
7474 CALL spadmat( uplo, diag, m, n, mem, lda, ipre, ipost, checkval )
7479 SUBROUTINE sgenmat( M, N, A, LDA, TESTNUM, MYROW, MYCOL )
7487 INTEGER M, N, LDA, TESTNUM, MYROW, MYCOL
7521 EXTERNAL sbtran, ibtnprocs
7524 INTEGER I, J, NPROCS, SRC
7536 nprocs = ibtnprocs()
7537 src = myrow * nprocs + mycol
7538 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
7539 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
7540 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
7541 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
7545 a(i, j) = sbtran( iseed )
7554 REAL FUNCTION SBTRAN(ISEED)
7570 SUBROUTINE spadmat( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
7578 CHARACTER*1 UPLO, DIAG
7579 INTEGER M, N, LDA, IPRE, IPOST
7637 IF( ipre .GT. 0 )
THEN
7645 IF( ipost .GT. 0 )
THEN
7646 j = ipre + lda*n + 1
7647 DO 20 i = j, j+ipost-1
7654 IF( lda .GT. m )
THEN
7657 DO 30 i = k, k+lda-m-1
7668 IF( uplo .EQ.
'U' )
THEN
7670 IF( diag .EQ.
'U' )
THEN
7673 k = ipre + i + (j-1)*lda
7680 k = ipre + i + (j-1)*lda
7686 IF( diag .EQ.
'U' )
THEN
7688 DO 46 j = 1, i-(m-n)
7689 k = ipre + i + (j-1)*lda
7695 DO 48 j = 1, i-(m-n)-1
7696 k = ipre + i + (j-1)*lda
7702 ELSE IF( uplo .EQ.
'L' )
THEN
7704 IF( diag .EQ.
'U' )
THEN
7707 k = ipre + i + (j-1)*lda
7713 DO 52 j = n-m+i+1, n
7714 k = ipre + i + (j-1)*lda
7720 IF( uplo .EQ.
'U' )
THEN
7723 k = ipre + i + (j-1)*lda
7730 k = ipre + i + (j-1)*lda
7743 SUBROUTINE schkpad( UPLO, DIAG, M, N, MEM, LDA, RSRC, CSRC,
7744 $ MYROW, MYCOL, IPRE, IPOST, CHECKVAL,
7745 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF )
7753 CHARACTER*1 UPLO, DIAG
7754 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, IPRE, IPOST
7755 INTEGER TESTNUM, MAXERR, NERR
7759 INTEGER ERRIBUF(6, MAXERR)
7760 REAL MEM(*), ERRDBUF(2, MAXERR)
7847 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
7848 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
7849 parameter( err_mat = 5 )
7857 INTEGER I, J, K, IRST, IRND, ICST, ICND, SRC, DEST
7862 NPROCS = ibtnprocs()
7863 src = rsrc * nprocs + csrc
7864 dest = myrow * nprocs + mycol
7868 IF( ipre .GT. 0 )
THEN
7870 IF( mem(i) .NE. checkval )
THEN
7872 IF( nerr .LE. maxerr )
THEN
7873 erribuf(1, nerr) = testnum
7874 erribuf(2, nerr) = src
7875 erribuf(3, nerr) = dest
7876 erribuf(4, nerr) = i
7877 erribuf(5, nerr) = ipre - i + 1
7878 erribuf(6, nerr) = err_pre
7879 errdbuf(1, nerr) = mem(i)
7880 errdbuf(2, nerr) = checkval
7888 IF( ipost .GT. 0 )
THEN
7889 j = ipre + lda*n + 1
7890 DO 20 i = j, j+ipost-1
7891 IF( mem(i) .NE. checkval )
THEN
7893 IF( nerr .LE. maxerr )
THEN
7894 erribuf(1, nerr) = testnum
7895 erribuf(2, nerr) = src
7896 erribuf(3, nerr) = dest
7897 erribuf(4, nerr) = i - j + 1
7898 erribuf(5, nerr) = j
7899 erribuf(6, nerr) = err_post
7900 errdbuf(1, nerr) = mem(i)
7901 errdbuf(2, nerr) = checkval
7909 IF( lda .GT. m )
THEN
7912 k = ipre + (j-1)*lda + i
7913 IF( mem(k) .NE. checkval)
THEN
7915 IF( nerr .LE. maxerr )
THEN
7916 erribuf(1, nerr) = testnum
7917 erribuf(2, nerr) = src
7918 erribuf(3, nerr) = dest
7919 erribuf(4, nerr) = i
7920 erribuf(5, nerr) = j
7921 erribuf(6, nerr) = err_gap
7922 errdbuf(1, nerr) = mem(k)
7923 errdbuf(2, nerr) = checkval
7933 IF( uplo .EQ.
'U' )
THEN
7940 ELSEIF( m .GT. n )
THEN
7946 IF( diag .EQ.
'U' )
THEN
7950 ELSE IF( uplo .EQ.
'L' )
THEN
7957 ELSEIF( m .GT. n )
THEN
7963 IF( diag .EQ.
'U' )
THEN
7971 DO 100 j = icst, icnd
7972 DO 105 i = irst, irnd
7973 IF( mem( ipre + (j-1)*lda + i ) .NE. checkval )
THEN
7975 IF( nerr .LE. maxerr )
THEN
7976 erribuf(1, nerr) = testnum
7977 erribuf(2, nerr) = src
7978 erribuf(3, nerr) = dest
7979 erribuf(4, nerr) = i
7980 erribuf(5, nerr) = j
7981 erribuf(6, nerr) = err_tri
7982 errdbuf(1, nerr) = mem( ipre + (j-1)*lda + i )
7983 errdbuf(2, nerr) = checkval
7990 IF( uplo .EQ.
'U' )
THEN
8004 SUBROUTINE schkmat( UPLO, DIAG, M, N, A, LDA, RSRC, CSRC,
8005 $ MYROW, MYCOL, TESTNUM, MAXERR, NERR,
8006 $ ERRIBUF, ERRDBUF )
8014 CHARACTER*1 UPLO, DIAG
8015 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, TESTNUM
8016 INTEGER MAXERR, NERR
8019 INTEGER ERRIBUF(6, MAXERR)
8020 REAL A(LDA,N), ERRDBUF(2, MAXERR)
8099 INTEGER I, J, NPROCS, SRC, DEST
8109 EXTERNAL SBTRAN, IBTNPROCS
8113 NPROCS = ibtnprocs()
8114 src = rsrc * nprocs + csrc
8115 dest = myrow * nprocs + mycol
8119 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
8120 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
8121 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
8122 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
8130 compval = sbtran( iseed )
8137 IF( uplo .EQ.
'U' )
THEN
8139 IF( diag .EQ.
'U' )
THEN
8149 IF( diag .EQ.
'U' )
THEN
8150 IF( i .GE. m-n+j )
THEN
8154 IF( i .GT. m-n+j )
THEN
8159 ELSE IF( uplo .EQ.
'L' )
THEN
8161 IF( diag .EQ.
'U' )
THEN
8162 IF( j. ge. i+(n-m) )
THEN
8166 IF( j .GT. i+(n-m) )
THEN
8171 IF( diag .EQ.
'U' )
THEN
8188 IF( a(i,j) .NE. compval )
THEN
8190 IF( nerr .LE. maxerr )
THEN
8191 erribuf(1, nerr) = testnum
8192 erribuf(2, nerr) = src
8193 erribuf(3, nerr) = dest
8194 erribuf(4, nerr) = i
8195 erribuf(5, nerr) = j
8196 erribuf(6, nerr) = 5
8197 errdbuf(1, nerr) = a(i, j)
8198 errdbuf(2, nerr) = compval
8211 $ ERRIBUF, ERRDBUF, COUNTING, TFAILED )
8220 INTEGER OUTNUM, MAXERR, NERR
8223 INTEGER ERRIBUF(6, MAXERR), TFAILED(*)
8224 REAL ERRDBUF(2, MAXERR)
8272 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
8273 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
8274 parameter( err_mat = 5 )
8277 INTEGER IBTMYPROC, IBTNPROCS
8278 EXTERNAL IBTMYPROC, IBTNPROCS
8283 INTEGER OLDTEST, NPROCS, PROW, PCOL, I, ERRTYPE
8287 IF( (ibtmyproc().NE.0) .OR. (nerr.LE.0) )
RETURN
8289 nprocs = ibtnprocs()
8290 prow = erribuf(3,1) / nprocs
8291 pcol = mod( erribuf(3,1), nprocs )
8292 IF( nerr .GT. maxerr )
WRITE(outnum,13000)
8294 DO 20 i = 1,
min( nerr, maxerr )
8295 IF( erribuf(1,i) .NE. oldtest )
THEN
8296 IF( oldtest .NE. -1 )
8297 $
WRITE(outnum,12000) prow, pcol, oldtest
8299 WRITE(outnum,1000) prow, pcol, erribuf(1,i)
8300 IF( counting ) tfailed( erribuf(1,i) ) = 1
8301 oldtest = erribuf(1, i)
8306 errtype = erribuf(6, i)
8307 IF( errtype .LT. -10 )
THEN
8308 errtype = -errtype - 10
8311 ELSE IF( errtype .LT. 0 )
THEN
8322 IF( erribuf(2, i) .EQ. -1 )
THEN
8323 WRITE(outnum,11000) erribuf(4,i), erribuf(5,i), mat,
8324 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
8325 ELSE IF( errtype .EQ. err_pre )
THEN
8326 WRITE(outnum,7000) erribuf(5,i), mat,
8327 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
8328 ELSE IF( errtype .EQ. err_post )
THEN
8329 WRITE(outnum,8000) erribuf(4,i), mat,
8330 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
8331 ELSE IF( errtype .EQ. err_gap )
THEN
8332 WRITE(outnum,9000) mat, erribuf(4,i), erribuf(5,i),
8333 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
8335 WRITE(outnum,10000) mat, erribuf(4,i), erribuf(5,i),
8336 $ int( errdbuf(2,i) ),
8337 $ int( errdbuf(1,i) )
8343 IF( errtype .EQ. err_pre )
THEN
8344 WRITE(outnum,2000) erribuf(5,i), errdbuf(2,i),
8346 ELSE IF( errtype .EQ. err_post )
THEN
8347 WRITE(outnum,3000) erribuf(4,i), errdbuf(2,i),
8349 ELSE IF( errtype .EQ. err_gap )
THEN
8350 WRITE(outnum,4000) erribuf(4,i), erribuf(5,i),
8351 $ errdbuf(2,i), errdbuf(1,i)
8352 ELSE IF( errtype .EQ. err_tri )
THEN
8353 WRITE(outnum,5000) erribuf(4,i), erribuf(5,i),
8354 $ errdbuf(2,i), errdbuf(1,i)
8356 WRITE(outnum,6000) erribuf(4,i), erribuf(5,i),
8357 $ errdbuf(2,i), errdbuf(1,i)
8361 WRITE(outnum,12000) prow, pcol, oldtest
8363 1000
FORMAT(
'PROCESS {',i4,
',',i4,
'} REPORTS ERRORS IN TEST#',i6,
':')
8364 2000
FORMAT(
' Buffer overwrite ',i4,
8365 $
' elements before the start of A:',/,
8366 $
' Expected=',g15.8,
8367 $
'; Received=',g15.8)
8368 3000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of A:',
8369 $ /,
' Expected=',g15.8,
8370 $
'; Received=',g15.8)
8371 4000
FORMAT(
' LDA-M gap overwrite at postion (',i4,
',',i4,
'):',/,
8372 $
' Expected=',g15.8,
8373 $
'; Received=',g15.8)
8374 5000
FORMAT(
' Complementory triangle overwrite at A(',i4,
',',i4,
8375 $
'):',/,
' Expected=',g15.8,
8376 $
'; Received=',g15.8)
8377 6000
FORMAT(
' Invalid element at A(',i4,
',',i4,
'):',/,
8378 $
' Expected=',g15.8,
8379 $
'; Received=',g15.8)
8380 7000
FORMAT(
' Buffer overwrite ',i4,
' elements before the start of ',
8381 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
8382 8000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of ',
8383 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
8385 9000
FORMAT(
' LD',a1,
'A-M gap overwrite at postion (',i4,
',',i4,
'):'
8386 $ ,/,
' Expected=',i12,
'; Received=',i12)
8388 10000
FORMAT(
' Invalid element at ',a1,
'A(',i4,
',',i4,
'):',/,
8389 $
' Expected=',i12,
'; Received=',i12)
8390 11000
FORMAT(
' Overwrite at position (',i4,
',',i4,
') of non-existent '
8391 $ ,a1,
'A array.',/,
' Expected=',i12,
'; Received=',i12)
8392 12000
FORMAT(
'PROCESS {',i4,
',',i4,
'} DONE ERROR REPORT FOR TEST#',
8394 13000
FORMAT(
'WARNING: There were more errors than could be recorded.',
8395 $ /,
'Increase MEMELTS to get complete listing.')
8403 SUBROUTINE dbtcheckin( NFTESTS, OUTNUM, MAXERR, NERR, IERR,
8405 INTEGER NFTESTS, OUTNUM, MAXERR, NERR
8406 INTEGER IERR(*), TFAILED(*)
8407 DOUBLE PRECISION DVAL(*)
8459 INTEGER IBTMYPROC, IBTNPROCS, IBTMSGID
8460 EXTERNAL IBTMYPROC, IBTNPROCS, IBTMSGID
8464 INTEGER K, NERR2, IAM, NPROCS, NTESTS
8469 nprocs = ibtnprocs()
8471 IF( iam .EQ. 0 )
THEN
8476 counting = nftests .GT. 0
8484 CALL dprinterrs(outnum, maxerr, nerr, ierr, dval, counting,
8487 DO 20 k = 1, nprocs-1
8488 CALL btsend(3, 0, k, k, ibtmsgid()+50)
8489 CALL btrecv(3, 1, nerr2, k, ibtmsgid()+50)
8490 IF( nerr2 .GT. 0 )
THEN
8492 CALL btrecv(3, nerr2*6, ierr, k, ibtmsgid()+51)
8493 CALL btrecv(6, nerr2*2, dval, k, ibtmsgid()+51)
8494 CALL dprinterrs(outnum, maxerr, nerr2, ierr, dval,
8495 $ counting, tfailed)
8504 nftests = nftests + tfailed(k)
8511 CALL btrecv(3, 0, k, 0, ibtmsgid()+50)
8512 CALL btsend(3, 1, nerr, 0, ibtmsgid()+50)
8513 IF( nerr .GT. 0 )
THEN
8514 CALL btsend(3, nerr*6, ierr, 0, ibtmsgid()+51)
8515 CALL btsend(6, nerr*2, dval, 0, ibtmsgid()+51)
8525 SUBROUTINE dinitmat(UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
8526 $ CHECKVAL, TESTNUM, MYROW, MYCOL)
8527 CHARACTER*1 UPLO, DIAG
8528 INTEGER M, N, LDA, IPRE, IPOST, TESTNUM, MYROW, MYCOL
8529 DOUBLE PRECISION CHECKVAL
8530 DOUBLE PRECISION MEM(*)
8537 CALL dgenmat( m, n, mem(ipre+1), lda, testnum, myrow, mycol )
8538 CALL dpadmat( uplo, diag, m, n, mem, lda, ipre, ipost, checkval )
8543 SUBROUTINE dgenmat( M, N, A, LDA, TESTNUM, MYROW, MYCOL )
8551 INTEGER M, N, LDA, TESTNUM, MYROW, MYCOL
8554 DOUBLE PRECISION A(LDA,N)
8584 DOUBLE PRECISION DBTRAN
8585 EXTERNAL DBTRAN, IBTNPROCS
8588 INTEGER I, J, NPROCS, SRC
8600 nprocs = ibtnprocs()
8601 src = myrow * nprocs + mycol
8602 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
8603 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
8604 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
8605 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
8609 a(i, j) = dbtran( iseed )
8618 DOUBLE PRECISION FUNCTION dbtran(ISEED)
8634 SUBROUTINE dpadmat( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
8642 CHARACTER*1 UPLO, DIAG
8643 INTEGER M, N, LDA, IPRE, IPOST
8644 DOUBLE PRECISION CHECKVAL
8647 DOUBLE PRECISION MEM( * )
8701 IF( ipre .GT. 0 )
THEN
8709 IF( ipost .GT. 0 )
THEN
8710 j = ipre + lda*n + 1
8711 DO 20 i = j, j+ipost-1
8718 IF( lda .GT. m )
THEN
8721 DO 30 i = k, k+lda-m-1
8732 IF( uplo .EQ.
'U' )
THEN
8734 IF( diag .EQ.
'U' )
THEN
8737 k = ipre + i + (j-1)*lda
8744 k = ipre + i + (j-1)*lda
8750 IF( diag .EQ.
'U' )
THEN
8752 DO 46 j = 1, i-(m-n)
8753 k = ipre + i + (j-1)*lda
8759 DO 48 j = 1, i-(m-n)-1
8760 k = ipre + i + (j-1)*lda
8766 ELSE IF( uplo .EQ.
'L' )
THEN
8768 IF( diag .EQ.
'U' )
THEN
8771 k = ipre + i + (j-1)*lda
8777 DO 52 j = n-m+i+1, n
8778 k = ipre + i + (j-1)*lda
8784 IF( uplo .EQ.
'U' )
THEN
8787 k = ipre + i + (j-1)*lda
8794 k = ipre + i + (j-1)*lda
8807 SUBROUTINE dchkpad( UPLO, DIAG, M, N, MEM, LDA, RSRC, CSRC,
8808 $ MYROW, MYCOL, IPRE, IPOST, CHECKVAL,
8809 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF )
8817 CHARACTER*1 UPLO, DIAG
8818 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, IPRE, IPOST
8819 INTEGER TESTNUM, MAXERR, NERR
8820 DOUBLE PRECISION CHECKVAL
8823 INTEGER ERRIBUF(6, MAXERR)
8824 DOUBLE PRECISION MEM(*), ERRDBUF(2, MAXERR)
8911 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
8912 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
8913 parameter( err_mat = 5 )
8921 INTEGER I, J, K, IRST, IRND, ICST, ICND, SRC, DEST
8926 NPROCS = ibtnprocs()
8927 src = rsrc * nprocs + csrc
8928 dest = myrow * nprocs + mycol
8932 IF( ipre .GT. 0 )
THEN
8934 IF( mem(i) .NE. checkval )
THEN
8936 IF( nerr .LE. maxerr )
THEN
8937 erribuf(1, nerr) = testnum
8938 erribuf(2, nerr) = src
8939 erribuf(3, nerr) = dest
8940 erribuf(4, nerr) = i
8941 erribuf(5, nerr) = ipre - i + 1
8942 erribuf(6, nerr) = err_pre
8943 errdbuf(1, nerr) = mem(i)
8944 errdbuf(2, nerr) = checkval
8952 IF( ipost .GT. 0 )
THEN
8953 j = ipre + lda*n + 1
8954 DO 20 i = j, j+ipost-1
8955 IF( mem(i) .NE. checkval )
THEN
8957 IF( nerr .LE. maxerr )
THEN
8958 erribuf(1, nerr) = testnum
8959 erribuf(2, nerr) = src
8960 erribuf(3, nerr) = dest
8961 erribuf(4, nerr) = i - j + 1
8962 erribuf(5, nerr) = j
8963 erribuf(6, nerr) = err_post
8964 errdbuf(1, nerr) = mem(i)
8965 errdbuf(2, nerr) = checkval
8973 IF( lda .GT. m )
THEN
8976 k = ipre + (j-1)*lda + i
8977 IF( mem(k) .NE. checkval)
THEN
8979 IF( nerr .LE. maxerr )
THEN
8980 erribuf(1, nerr) = testnum
8981 erribuf(2, nerr) = src
8982 erribuf(3, nerr) = dest
8983 erribuf(4, nerr) = i
8984 erribuf(5, nerr) = j
8985 erribuf(6, nerr) = err_gap
8986 errdbuf(1, nerr) = mem(k)
8987 errdbuf(2, nerr) = checkval
8997 IF( uplo .EQ.
'U' )
THEN
9004 ELSEIF( m .GT. n )
THEN
9010 IF( diag .EQ.
'U' )
THEN
9014 ELSE IF( uplo .EQ.
'L' )
THEN
9021 ELSEIF( m .GT. n )
THEN
9027 IF( diag .EQ.
'U' )
THEN
9035 DO 100 j = icst, icnd
9036 DO 105 i = irst, irnd
9037 IF( mem( ipre + (j-1)*lda + i ) .NE. checkval )
THEN
9039 IF( nerr .LE. maxerr )
THEN
9040 erribuf(1, nerr) = testnum
9041 erribuf(2, nerr) = src
9042 erribuf(3, nerr) = dest
9043 erribuf(4, nerr) = i
9044 erribuf(5, nerr) = j
9045 erribuf(6, nerr) = err_tri
9046 errdbuf(1, nerr) = mem( ipre + (j-1)*lda + i )
9047 errdbuf(2, nerr) = checkval
9054 IF( uplo .EQ.
'U' )
THEN
9068 SUBROUTINE dchkmat( UPLO, DIAG, M, N, A, LDA, RSRC, CSRC,
9069 $ MYROW, MYCOL, TESTNUM, MAXERR, NERR,
9070 $ ERRIBUF, ERRDBUF )
9078 CHARACTER*1 UPLO, DIAG
9079 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, TESTNUM
9080 INTEGER MAXERR, NERR
9083 INTEGER ERRIBUF(6, MAXERR)
9084 DOUBLE PRECISION A(LDA,N), ERRDBUF(2, MAXERR)
9163 INTEGER I, J, NPROCS, SRC, DEST
9165 DOUBLE PRECISION COMPVAL
9172 DOUBLE PRECISION DBTRAN
9173 EXTERNAL DBTRAN, IBTNPROCS
9177 NPROCS = ibtnprocs()
9178 src = rsrc * nprocs + csrc
9179 dest = myrow * nprocs + mycol
9183 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
9184 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
9185 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
9186 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
9194 compval = dbtran( iseed )
9201 IF( uplo .EQ.
'U' )
THEN
9203 IF( diag .EQ.
'U' )
THEN
9213 IF( diag .EQ.
'U' )
THEN
9214 IF( i .GE. m-n+j )
THEN
9218 IF( i .GT. m-n+j )
THEN
9223 ELSE IF( uplo .EQ.
'L' )
THEN
9225 IF( diag .EQ.
'U' )
THEN
9226 IF( j. ge. i+(n-m) )
THEN
9230 IF( j .GT. i+(n-m) )
THEN
9235 IF( diag .EQ.
'U' )
THEN
9252 IF( a(i,j) .NE. compval )
THEN
9254 IF( nerr .LE. maxerr )
THEN
9255 erribuf(1, nerr) = testnum
9256 erribuf(2, nerr) = src
9257 erribuf(3, nerr) = dest
9258 erribuf(4, nerr) = i
9259 erribuf(5, nerr) = j
9260 erribuf(6, nerr) = 5
9261 errdbuf(1, nerr) = a(i, j)
9262 errdbuf(2, nerr) = compval
9275 $ ERRIBUF, ERRDBUF, COUNTING, TFAILED )
9284 INTEGER OUTNUM, MAXERR, NERR
9287 INTEGER ERRIBUF(6, MAXERR), TFAILED(*)
9288 DOUBLE PRECISION ERRDBUF(2, MAXERR)
9336 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
9337 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
9338 parameter( err_mat = 5 )
9341 INTEGER IBTMYPROC, IBTNPROCS
9342 EXTERNAL ibtmyproc, ibtnprocs
9347 INTEGER OLDTEST, NPROCS, PROW, PCOL, I, ERRTYPE
9351 IF( (IBTMYPROC().NE.0) .OR. (NERR.LE.0) ) RETURN
9353 nprocs = ibtnprocs()
9354 prow = erribuf(3,1) / nprocs
9355 pcol = mod( erribuf(3,1), nprocs )
9356 IF( nerr .GT. maxerr )
WRITE(outnum,13000)
9358 DO 20 i = 1,
min( nerr, maxerr )
9359 IF( erribuf(1,i) .NE. oldtest )
THEN
9360 IF( oldtest .NE. -1 )
9361 $
WRITE(outnum,12000) prow, pcol, oldtest
9363 WRITE(outnum,1000) prow, pcol, erribuf(1,i)
9364 IF( counting ) tfailed( erribuf(1,i) ) = 1
9365 oldtest = erribuf(1, i)
9370 errtype = erribuf(6, i)
9371 IF( errtype .LT. -10 )
THEN
9372 errtype = -errtype - 10
9375 ELSE IF( errtype .LT. 0 )
THEN
9386 IF( erribuf(2, i) .EQ. -1 )
THEN
9387 WRITE(outnum,11000) erribuf(4,i), erribuf(5,i), mat,
9388 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
9389 ELSE IF( errtype .EQ. err_pre )
THEN
9390 WRITE(outnum,7000) erribuf(5,i), mat,
9391 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
9392 ELSE IF( errtype .EQ. err_post )
THEN
9393 WRITE(outnum,8000) erribuf(4,i), mat,
9394 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
9395 ELSE IF( errtype .EQ. err_gap )
THEN
9396 WRITE(outnum,9000) mat, erribuf(4,i), erribuf(5,i),
9397 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
9399 WRITE(outnum,10000) mat, erribuf(4,i), erribuf(5,i),
9400 $ int( errdbuf(2,i) ),
9401 $ int( errdbuf(1,i) )
9407 IF( errtype .EQ. err_pre )
THEN
9408 WRITE(outnum,2000) erribuf(5,i), errdbuf(2,i),
9410 ELSE IF( errtype .EQ. err_post )
THEN
9411 WRITE(outnum,3000) erribuf(4,i), errdbuf(2,i),
9413 ELSE IF( errtype .EQ. err_gap )
THEN
9414 WRITE(outnum,4000) erribuf(4,i), erribuf(5,i),
9415 $ errdbuf(2,i), errdbuf(1,i)
9416 ELSE IF( errtype .EQ. err_tri )
THEN
9417 WRITE(outnum,5000) erribuf(4,i), erribuf(5,i),
9418 $ errdbuf(2,i), errdbuf(1,i)
9420 WRITE(outnum,6000) erribuf(4,i), erribuf(5,i),
9421 $ errdbuf(2,i), errdbuf(1,i)
9425 WRITE(outnum,12000) prow, pcol, oldtest
9427 1000
FORMAT(
'PROCESS {',i4,
',',i4,
'} REPORTS ERRORS IN TEST#',i6,
':')
9428 2000
FORMAT(
' Buffer overwrite ',i4,
9429 $
' elements before the start of A:',/,
9430 $
' Expected=',g22.15,
9431 $
'; Received=',g22.15)
9432 3000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of A:',
9433 $ /,
' Expected=',g22.15,
9434 $
'; Received=',g22.15)
9435 4000
FORMAT(
' LDA-M gap overwrite at postion (',i4,
',',i4,
'):',/,
9436 $
' Expected=',g22.15,
9437 $
'; Received=',g22.15)
9438 5000
FORMAT(
' Complementory triangle overwrite at A(',i4,
',',i4,
9439 $
'):',/,
' Expected=',g22.15,
9440 $
'; Received=',g22.15)
9441 6000
FORMAT(
' Invalid element at A(',i4,
',',i4,
'):',/,
9442 $
' Expected=',g22.15,
9443 $
'; Received=',g22.15)
9444 7000
FORMAT(
' Buffer overwrite ',i4,
' elements before the start of ',
9445 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
9446 8000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of ',
9447 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
9449 9000
FORMAT(
' LD',a1,
'A-M gap overwrite at postion (',i4,
',',i4,
'):'
9450 $ ,/,
' Expected=',i12,
'; Received=',i12)
9452 10000
FORMAT(
' Invalid element at ',a1,
'A(',i4,
',',i4,
'):',/,
9453 $
' Expected=',i12,
'; Received=',i12)
9454 11000
FORMAT(
' Overwrite at position (',i4,
',',i4,
') of non-existent '
9455 $ ,a1,
'A array.',/,
' Expected=',i12,
'; Received=',i12)
9456 12000
FORMAT(
'PROCESS {',i4,
',',i4,
'} DONE ERROR REPORT FOR TEST#',
9458 13000
FORMAT(
'WARNING: There were more errors than could be recorded.',
9459 $ /,
'Increase MEMELTS to get complete listing.')
9467 SUBROUTINE cbtcheckin( NFTESTS, OUTNUM, MAXERR, NERR, IERR,
9469 INTEGER NFTESTS, OUTNUM, MAXERR, NERR
9470 INTEGER IERR(*), TFAILED(*)
9523 INTEGER IBTMYPROC, IBTNPROCS, IBTMSGID
9524 EXTERNAL IBTMYPROC, IBTNPROCS, IBTMSGID
9528 INTEGER K, NERR2, IAM, NPROCS, NTESTS
9533 nprocs = ibtnprocs()
9535 IF( iam .EQ. 0 )
THEN
9540 counting = nftests .GT. 0
9548 CALL cprinterrs(outnum, maxerr, nerr, ierr, cval, counting,
9551 DO 20 k = 1, nprocs-1
9552 CALL btsend(3, 0, k, k, ibtmsgid()+50)
9553 CALL btrecv(3, 1, nerr2, k, ibtmsgid()+50)
9554 IF( nerr2 .GT. 0 )
THEN
9556 CALL btrecv(3, nerr2*6, ierr, k, ibtmsgid()+51)
9557 CALL btrecv(5, nerr2*2, cval, k, ibtmsgid()+51)
9558 CALL cprinterrs(outnum, maxerr, nerr2, ierr, cval,
9559 $ counting, tfailed)
9568 nftests = nftests + tfailed(k)
9575 CALL btrecv(3, 0, k, 0, ibtmsgid()+50)
9576 CALL btsend(3, 1, nerr, 0, ibtmsgid()+50)
9577 IF( nerr .GT. 0 )
THEN
9578 CALL btsend(3, nerr*6, ierr, 0, ibtmsgid()+51)
9579 CALL btsend(5, nerr*2, cval, 0, ibtmsgid()+51)
9589 SUBROUTINE cinitmat(UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
9590 $ CHECKVAL, TESTNUM, MYROW, MYCOL)
9591 CHARACTER*1 UPLO, DIAG
9592 INTEGER M, N, LDA, IPRE, IPOST, TESTNUM, MYROW, MYCOL
9601 CALL cgenmat( m, n, mem(ipre+1), lda, testnum, myrow, mycol )
9602 CALL cpadmat( uplo, diag, m, n, mem, lda, ipre, ipost, checkval )
9607 SUBROUTINE cgenmat( M, N, A, LDA, TESTNUM, MYROW, MYCOL )
9615 INTEGER M, N, LDA, TESTNUM, MYROW, MYCOL
9649 EXTERNAL cbtran, ibtnprocs
9652 INTEGER I, J, NPROCS, SRC
9664 nprocs = ibtnprocs()
9665 src = myrow * nprocs + mycol
9666 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
9667 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
9668 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
9669 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
9673 a(i, j) = cbtran( iseed )
9682 COMPLEX FUNCTION cbtran(ISEED)
9696 SUBROUTINE cpadmat( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
9704 CHARACTER*1 UPLO, DIAG
9705 INTEGER M, N, LDA, IPRE, IPOST
9763 IF( ipre .GT. 0 )
THEN
9771 IF( ipost .GT. 0 )
THEN
9772 j = ipre + lda*n + 1
9773 DO 20 i = j, j+ipost-1
9780 IF( lda .GT. m )
THEN
9783 DO 30 i = k, k+lda-m-1
9794 IF( uplo .EQ.
'U' )
THEN
9796 IF( diag .EQ.
'U' )
THEN
9799 k = ipre + i + (j-1)*lda
9806 k = ipre + i + (j-1)*lda
9812 IF( diag .EQ.
'U' )
THEN
9814 DO 46 j = 1, i-(m-n)
9815 k = ipre + i + (j-1)*lda
9821 DO 48 j = 1, i-(m-n)-1
9822 k = ipre + i + (j-1)*lda
9828 ELSE IF( uplo .EQ.
'L' )
THEN
9830 IF( diag .EQ.
'U' )
THEN
9833 k = ipre + i + (j-1)*lda
9839 DO 52 j = n-m+i+1, n
9840 k = ipre + i + (j-1)*lda
9846 IF( uplo .EQ.
'U' )
THEN
9849 k = ipre + i + (j-1)*lda
9856 k = ipre + i + (j-1)*lda
9869 SUBROUTINE cchkpad( UPLO, DIAG, M, N, MEM, LDA, RSRC, CSRC,
9870 $ MYROW, MYCOL, IPRE, IPOST, CHECKVAL,
9871 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF )
9879 CHARACTER*1 UPLO, DIAG
9880 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, IPRE, IPOST
9881 INTEGER TESTNUM, MAXERR, NERR
9885 INTEGER ERRIBUF(6, MAXERR)
9886 COMPLEX MEM(*), ERRDBUF(2, MAXERR)
9973 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
9974 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
9975 parameter( err_mat = 5 )
9983 INTEGER I, J, K, IRST, IRND, ICST, ICND, SRC, DEST
9988 NPROCS = ibtnprocs()
9989 src = rsrc * nprocs + csrc
9990 dest = myrow * nprocs + mycol
9994 IF( ipre .GT. 0 )
THEN
9996 IF( mem(i) .NE. checkval )
THEN
9998 IF( nerr .LE. maxerr )
THEN
9999 erribuf(1, nerr) = testnum
10000 erribuf(2, nerr) = src
10001 erribuf(3, nerr) = dest
10002 erribuf(4, nerr) = i
10003 erribuf(5, nerr) = ipre - i + 1
10004 erribuf(6, nerr) = err_pre
10005 errdbuf(1, nerr) = mem(i)
10006 errdbuf(2, nerr) = checkval
10014 IF( ipost .GT. 0 )
THEN
10015 j = ipre + lda*n + 1
10016 DO 20 i = j, j+ipost-1
10017 IF( mem(i) .NE. checkval )
THEN
10019 IF( nerr .LE. maxerr )
THEN
10020 erribuf(1, nerr) = testnum
10021 erribuf(2, nerr) = src
10022 erribuf(3, nerr) = dest
10023 erribuf(4, nerr) = i - j + 1
10024 erribuf(5, nerr) = j
10025 erribuf(6, nerr) = err_post
10026 errdbuf(1, nerr) = mem(i)
10027 errdbuf(2, nerr) = checkval
10035 IF( lda .GT. m )
THEN
10038 k = ipre + (j-1)*lda + i
10039 IF( mem(k) .NE. checkval)
THEN
10041 IF( nerr .LE. maxerr )
THEN
10042 erribuf(1, nerr) = testnum
10043 erribuf(2, nerr) = src
10044 erribuf(3, nerr) = dest
10045 erribuf(4, nerr) = i
10046 erribuf(5, nerr) = j
10047 erribuf(6, nerr) = err_gap
10048 errdbuf(1, nerr) = mem(k)
10049 errdbuf(2, nerr) = checkval
10059 IF( uplo .EQ.
'U' )
THEN
10061 IF( m .LE. n )
THEN
10066 ELSEIF( m .GT. n )
THEN
10072 IF( diag .EQ.
'U' )
THEN
10076 ELSE IF( uplo .EQ.
'L' )
THEN
10078 IF( m .LE. n )
THEN
10083 ELSEIF( m .GT. n )
THEN
10089 IF( diag .EQ.
'U' )
THEN
10097 DO 100 j = icst, icnd
10098 DO 105 i = irst, irnd
10099 IF( mem( ipre + (j-1)*lda + i ) .NE. checkval )
THEN
10101 IF( nerr .LE. maxerr )
THEN
10102 erribuf(1, nerr) = testnum
10103 erribuf(2, nerr) = src
10104 erribuf(3, nerr) = dest
10105 erribuf(4, nerr) = i
10106 erribuf(5, nerr) = j
10107 erribuf(6, nerr) = err_tri
10108 errdbuf(1, nerr) = mem( ipre + (j-1)*lda + i )
10109 errdbuf(2, nerr) = checkval
10116 IF( uplo .EQ.
'U' )
THEN
10130 SUBROUTINE cchkmat( UPLO, DIAG, M, N, A, LDA, RSRC, CSRC,
10131 $ MYROW, MYCOL, TESTNUM, MAXERR, NERR,
10132 $ ERRIBUF, ERRDBUF )
10140 CHARACTER*1 UPLO, DIAG
10141 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, TESTNUM
10142 INTEGER MAXERR, NERR
10145 INTEGER ERRIBUF(6, MAXERR)
10146 COMPLEX A(LDA,N), ERRDBUF(2, MAXERR)
10225 INTEGER I, J, NPROCS, SRC, DEST
10235 EXTERNAL CBTRAN, IBTNPROCS
10239 NPROCS = ibtnprocs()
10240 src = rsrc * nprocs + csrc
10241 dest = myrow * nprocs + mycol
10245 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
10246 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
10247 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
10248 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
10256 compval = cbtran( iseed )
10263 IF( uplo .EQ.
'U' )
THEN
10264 IF( m .LE. n )
THEN
10265 IF( diag .EQ.
'U' )
THEN
10266 IF( i .GE. j )
THEN
10270 IF( i .GT. j )
THEN
10275 IF( diag .EQ.
'U' )
THEN
10276 IF( i .GE. m-n+j )
THEN
10280 IF( i .GT. m-n+j )
THEN
10285 ELSE IF( uplo .EQ.
'L' )
THEN
10286 IF( m .LE. n )
THEN
10287 IF( diag .EQ.
'U' )
THEN
10288 IF( j. ge. i+(n-m) )
THEN
10292 IF( j .GT. i+(n-m) )
THEN
10297 IF( diag .EQ.
'U' )
THEN
10298 IF( j .GE. i )
THEN
10302 IF( j .GT. i )
THEN
10314 IF( a(i,j) .NE. compval )
THEN
10316 IF( nerr .LE. maxerr )
THEN
10317 erribuf(1, nerr) = testnum
10318 erribuf(2, nerr) = src
10319 erribuf(3, nerr) = dest
10320 erribuf(4, nerr) = i
10321 erribuf(5, nerr) = j
10322 erribuf(6, nerr) = 5
10323 errdbuf(1, nerr) = a(i, j)
10324 errdbuf(2, nerr) = compval
10336 SUBROUTINE cprinterrs( OUTNUM, MAXERR, NERR,
10337 $ ERRIBUF, ERRDBUF, COUNTING, TFAILED )
10346 INTEGER OUTNUM, MAXERR, NERR
10349 INTEGER ERRIBUF(6, MAXERR), TFAILED(*)
10350 COMPLEX ERRDBUF(2, MAXERR)
10398 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
10399 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
10400 parameter( err_mat = 5 )
10403 INTEGER IBTMYPROC, IBTNPROCS
10404 EXTERNAL ibtmyproc, ibtnprocs
10409 INTEGER OLDTEST, NPROCS, PROW, PCOL, I, ERRTYPE
10413 IF( (ibtmyproc().NE.0) .OR. (nerr.LE.0) )
RETURN
10415 nprocs = ibtnprocs()
10416 prow = erribuf(3,1) / nprocs
10417 pcol = mod( erribuf(3,1), nprocs )
10418 IF( nerr .GT. maxerr )
WRITE(outnum,13000)
10420 DO 20 i = 1,
min( nerr, maxerr )
10421 IF( erribuf(1,i) .NE. oldtest )
THEN
10422 IF( oldtest .NE. -1 )
10423 $
WRITE(outnum,12000) prow, pcol, oldtest
10424 WRITE(outnum,*)
' '
10425 WRITE(outnum,1000) prow, pcol, erribuf(1,i)
10426 IF( counting ) tfailed( erribuf(1,i) ) = 1
10427 oldtest = erribuf(1, i)
10432 errtype = erribuf(6, i)
10433 IF( errtype .LT. -10 )
THEN
10434 errtype = -errtype - 10
10437 ELSE IF( errtype .LT. 0 )
THEN
10447 IF( matisint )
THEN
10448 IF( erribuf(2, i) .EQ. -1 )
THEN
10449 WRITE(outnum,11000) erribuf(4,i), erribuf(5,i), mat,
10450 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
10451 ELSE IF( errtype .EQ. err_pre )
THEN
10452 WRITE(outnum,7000) erribuf(5,i), mat,
10453 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
10454 ELSE IF( errtype .EQ. err_post )
THEN
10455 WRITE(outnum,8000) erribuf(4,i), mat,
10456 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
10457 ELSE IF( errtype .EQ. err_gap )
THEN
10458 WRITE(outnum,9000) mat, erribuf(4,i), erribuf(5,i),
10459 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
10461 WRITE(outnum,10000) mat, erribuf(4,i), erribuf(5,i),
10462 $ int( errdbuf(2,i) ),
10463 $ int( errdbuf(1,i) )
10469 IF( errtype .EQ. err_pre )
THEN
10470 WRITE(outnum,2000) erribuf(5,i),
10471 $ real( errdbuf(2,i) ), aimag( errdbuf(2,i) ),
10472 $ real( errdbuf(1,i) ), aimag( errdbuf(1,i) )
10473 ELSE IF( errtype .EQ. err_post )
THEN
10474 WRITE(outnum,3000) erribuf(4,i),
10475 $ real( errdbuf(2,i) ), aimag( errdbuf(2,i) ),
10476 $ real( errdbuf(1,i) ), aimag( errdbuf(1,i) )
10477 ELSE IF( errtype .EQ. err_gap )
THEN
10479 $ erribuf(4,i), erribuf(5,i),
10480 $ real( errdbuf(2,i) ), aimag( errdbuf(2,i) ),
10481 $ real( errdbuf(1,i) ), aimag( errdbuf(1,i) )
10482 ELSE IF( errtype .EQ. err_tri )
THEN
10483 WRITE(outnum,5000) erribuf(4,i), erribuf(5,i),
10484 $ real( errdbuf(2,i) ), aimag( errdbuf(2,i) ),
10485 $ real( errdbuf(1,i) ), aimag( errdbuf(1,i) )
10487 WRITE(outnum,6000) erribuf(4,i), erribuf(5,i),
10488 $ real( errdbuf(2,i) ), aimag( errdbuf(2,i) ),
10489 $ real( errdbuf(1,i) ), aimag( errdbuf(1,i) )
10493 WRITE(outnum,12000) prow, pcol, oldtest
10495 1000
FORMAT(
'PROCESS {',i4,
',',i4,
'} REPORTS ERRORS IN TEST#',i6,
':')
10496 2000
FORMAT(
' Buffer overwrite ',i4,
10497 $
' elements before the start of A:',/,
10498 $
' Expected=',
'[',g15.8,
',',g15.8,
']',
10499 $
'; Received=',
'[',g15.8,
',',g15.8,
']')
10500 3000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of A:',
10501 $ /,
' Expected=',
'[',g15.8,
',',g15.8,
']',
10502 $
'; Received=',
'[',g15.8,
',',g15.8,
']')
10503 4000
FORMAT(
' LDA-M gap overwrite at postion (',i4,
',',i4,
'):',/,
10504 $
' Expected=',
'[',g15.8,
',',g15.8,
']',
10505 $
'; Received=',
'[',g15.8,
',',g15.8,
']')
10506 5000
FORMAT(
' Complementory triangle overwrite at A(',i4,
',',i4,
10507 $
'):',/,
' Expected=',
'[',g15.8,
',',g15.8,
']',
10508 $
'; Received=',
'[',g15.8,
',',g15.8,
']')
10509 6000
FORMAT(
' Invalid element at A(',i4,
',',i4,
'):',/,
10510 $
' Expected=',
'[',g15.8,
',',g15.8,
']',
10511 $
'; Received=',
'[',g15.8,
',',g15.8,
']')
10512 7000
FORMAT(
' Buffer overwrite ',i4,
' elements before the start of ',
10513 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
10514 8000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of ',
10515 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
10517 9000
FORMAT(
' LD',a1,
'A-M gap overwrite at postion (',i4,
',',i4,
'):'
10518 $ ,/,
' Expected=',i12,
'; Received=',i12)
10520 10000
FORMAT(
' Invalid element at ',a1,
'A(',i4,
',',i4,
'):',/,
10521 $
' Expected=',i12,
'; Received=',i12)
10522 11000
FORMAT(
' Overwrite at position (',i4,
',',i4,
') of non-existent '
10523 $ ,a1,
'A array.',/,
' Expected=',i12,
'; Received=',i12)
10524 12000
FORMAT(
'PROCESS {',i4,
',',i4,
'} DONE ERROR REPORT FOR TEST#',
10526 13000
FORMAT(
'WARNING: There were more errors than could be recorded.',
10527 $ /,
'Increase MEMELTS to get complete listing.')
10535 SUBROUTINE zbtcheckin( NFTESTS, OUTNUM, MAXERR, NERR, IERR,
10537 INTEGER NFTESTS, OUTNUM, MAXERR, NERR
10538 INTEGER IERR(*), TFAILED(*)
10539 DOUBLE COMPLEX ZVAL(*)
10591 INTEGER IBTMYPROC, IBTNPROCS, IBTMSGID
10592 EXTERNAL IBTMYPROC, IBTNPROCS, IBTMSGID
10596 INTEGER K, NERR2, IAM, NPROCS, NTESTS
10601 nprocs = ibtnprocs()
10603 IF( iam .EQ. 0 )
THEN
10608 counting = nftests .GT. 0
10609 IF( counting )
THEN
10611 DO 10 k = 1, ntests
10616 CALL zprinterrs(outnum, maxerr, nerr, ierr, zval, counting,
10619 DO 20 k = 1, nprocs-1
10620 CALL btsend(3, 0, k, k, ibtmsgid()+50)
10621 CALL btrecv(3, 1, nerr2, k, ibtmsgid()+50)
10622 IF( nerr2 .GT. 0 )
THEN
10623 nerr = nerr + nerr2
10624 CALL btrecv(3, nerr2*6, ierr, k, ibtmsgid()+51)
10625 CALL btrecv(7, nerr2*2, zval, k, ibtmsgid()+51)
10626 CALL zprinterrs(outnum, maxerr, nerr2, ierr, zval,
10627 $ counting, tfailed)
10633 IF( counting )
THEN
10635 DO 30 k = 1, ntests
10636 nftests = nftests + tfailed(k)
10643 CALL btrecv(3, 0, k, 0, ibtmsgid()+50)
10644 CALL btsend(3, 1, nerr, 0, ibtmsgid()+50)
10645 IF( nerr .GT. 0 )
THEN
10646 CALL btsend(3, nerr*6, ierr, 0, ibtmsgid()+51)
10647 CALL btsend(7, nerr*2, zval, 0, ibtmsgid()+51)
10657 SUBROUTINE zinitmat(UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
10658 $ CHECKVAL, TESTNUM, MYROW, MYCOL)
10659 CHARACTER*1 UPLO, DIAG
10660 INTEGER M, N, LDA, IPRE, IPOST, TESTNUM, MYROW, MYCOL
10661 DOUBLE COMPLEX CHECKVAL
10662 DOUBLE COMPLEX MEM(*)
10665 EXTERNAL ZGENMAT, ZPADMAT
10669 CALL ZGENMAT( M, N, MEM(IPRE+1), LDA, TESTNUM, MYROW, MYCOL )
10670 CALL ZPADMAT( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST, CHECKVAL )
10675 SUBROUTINE zgenmat( M, N, A, LDA, TESTNUM, MYROW, MYCOL )
10683 INTEGER M, N, LDA, TESTNUM, MYROW, MYCOL
10686 DOUBLE COMPLEX A(LDA,N)
10716 DOUBLE COMPLEX ZBTRAN
10717 EXTERNAL zbtran, ibtnprocs
10720 INTEGER I, J, NPROCS, SRC
10732 nprocs = ibtnprocs()
10733 src = myrow * nprocs + mycol
10734 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
10735 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
10736 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
10737 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
10741 a(i, j) = zbtran( iseed )
10750 DOUBLE COMPLEX FUNCTION zbtran(ISEED)
10764 SUBROUTINE zpadmat( UPLO, DIAG, M, N, MEM, LDA, IPRE, IPOST,
10772 CHARACTER*1 UPLO, DIAG
10773 INTEGER M, N, LDA, IPRE, IPOST
10774 DOUBLE COMPLEX CHECKVAL
10777 DOUBLE COMPLEX MEM( * )
10831 IF( ipre .GT. 0 )
THEN
10833 mem( i ) = checkval
10839 IF( ipost .GT. 0 )
THEN
10840 j = ipre + lda*n + 1
10841 DO 20 i = j, j+ipost-1
10842 mem( i ) = checkval
10848 IF( lda .GT. m )
THEN
10851 DO 30 i = k, k+lda-m-1
10852 mem( i ) = checkval
10862 IF( uplo .EQ.
'U' )
THEN
10863 IF( m .LE. n )
THEN
10864 IF( diag .EQ.
'U' )
THEN
10867 k = ipre + i + (j-1)*lda
10868 mem( k ) = checkval
10874 k = ipre + i + (j-1)*lda
10875 mem( k ) = checkval
10880 IF( diag .EQ.
'U' )
THEN
10882 DO 46 j = 1, i-(m-n)
10883 k = ipre + i + (j-1)*lda
10884 mem( k ) = checkval
10889 DO 48 j = 1, i-(m-n)-1
10890 k = ipre + i + (j-1)*lda
10891 mem( k ) = checkval
10896 ELSE IF( uplo .EQ.
'L' )
THEN
10897 IF( m .LE. n )
THEN
10898 IF( diag .EQ.
'U' )
THEN
10901 k = ipre + i + (j-1)*lda
10902 mem( k ) = checkval
10907 DO 52 j = n-m+i+1, n
10908 k = ipre + i + (j-1)*lda
10909 mem( k ) = checkval
10914 IF( uplo .EQ.
'U' )
THEN
10917 k = ipre + i + (j-1)*lda
10918 mem( k ) = checkval
10924 k = ipre + i + (j-1)*lda
10925 mem( k ) = checkval
10937 SUBROUTINE zchkpad( UPLO, DIAG, M, N, MEM, LDA, RSRC, CSRC,
10938 $ MYROW, MYCOL, IPRE, IPOST, CHECKVAL,
10939 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF )
10947 CHARACTER*1 UPLO, DIAG
10948 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, IPRE, IPOST
10949 INTEGER TESTNUM, MAXERR, NERR
10950 DOUBLE COMPLEX CHECKVAL
10953 INTEGER ERRIBUF(6, MAXERR)
10954 DOUBLE COMPLEX MEM(*), ERRDBUF(2, MAXERR)
11041 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
11042 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
11043 parameter( err_mat = 5 )
11051 INTEGER I, J, K, IRST, IRND, ICST, ICND, SRC, DEST
11056 NPROCS = ibtnprocs()
11057 src = rsrc * nprocs + csrc
11058 dest = myrow * nprocs + mycol
11062 IF( ipre .GT. 0 )
THEN
11064 IF( mem(i) .NE. checkval )
THEN
11066 IF( nerr .LE. maxerr )
THEN
11067 erribuf(1, nerr) = testnum
11068 erribuf(2, nerr) = src
11069 erribuf(3, nerr) = dest
11070 erribuf(4, nerr) = i
11071 erribuf(5, nerr) = ipre - i + 1
11072 erribuf(6, nerr) = err_pre
11073 errdbuf(1, nerr) = mem(i)
11074 errdbuf(2, nerr) = checkval
11082 IF( ipost .GT. 0 )
THEN
11083 j = ipre + lda*n + 1
11084 DO 20 i = j, j+ipost-1
11085 IF( mem(i) .NE. checkval )
THEN
11087 IF( nerr .LE. maxerr )
THEN
11088 erribuf(1, nerr) = testnum
11089 erribuf(2, nerr) = src
11090 erribuf(3, nerr) = dest
11091 erribuf(4, nerr) = i - j + 1
11092 erribuf(5, nerr) = j
11093 erribuf(6, nerr) = err_post
11094 errdbuf(1, nerr) = mem(i)
11095 errdbuf(2, nerr) = checkval
11103 IF( lda .GT. m )
THEN
11106 k = ipre + (j-1)*lda + i
11107 IF( mem(k) .NE. checkval)
THEN
11109 IF( nerr .LE. maxerr )
THEN
11110 erribuf(1, nerr) = testnum
11111 erribuf(2, nerr) = src
11112 erribuf(3, nerr) = dest
11113 erribuf(4, nerr) = i
11114 erribuf(5, nerr) = j
11115 erribuf(6, nerr) = err_gap
11116 errdbuf(1, nerr) = mem(k)
11117 errdbuf(2, nerr) = checkval
11127 IF( uplo .EQ.
'U' )
THEN
11129 IF( m .LE. n )
THEN
11134 ELSEIF( m .GT. n )
THEN
11140 IF( diag .EQ.
'U' )
THEN
11144 ELSE IF( uplo .EQ.
'L' )
THEN
11146 IF( m .LE. n )
THEN
11151 ELSEIF( m .GT. n )
THEN
11157 IF( diag .EQ.
'U' )
THEN
11165 DO 100 j = icst, icnd
11166 DO 105 i = irst, irnd
11167 IF( mem( ipre + (j-1)*lda + i ) .NE. checkval )
THEN
11169 IF( nerr .LE. maxerr )
THEN
11170 erribuf(1, nerr) = testnum
11171 erribuf(2, nerr) = src
11172 erribuf(3, nerr) = dest
11173 erribuf(4, nerr) = i
11174 erribuf(5, nerr) = j
11175 erribuf(6, nerr) = err_tri
11176 errdbuf(1, nerr) = mem( ipre + (j-1)*lda + i )
11177 errdbuf(2, nerr) = checkval
11184 IF( uplo .EQ.
'U' )
THEN
11198 SUBROUTINE zchkmat( UPLO, DIAG, M, N, A, LDA, RSRC, CSRC,
11199 $ MYROW, MYCOL, TESTNUM, MAXERR, NERR,
11200 $ ERRIBUF, ERRDBUF )
11208 CHARACTER*1 UPLO, DIAG
11209 INTEGER M, N, LDA, RSRC, CSRC, MYROW, MYCOL, TESTNUM
11210 INTEGER MAXERR, NERR
11213 INTEGER ERRIBUF(6, MAXERR)
11214 DOUBLE COMPLEX A(LDA,N), ERRDBUF(2, MAXERR)
11293 INTEGER I, J, NPROCS, SRC, DEST
11295 DOUBLE COMPLEX COMPVAL
11302 DOUBLE COMPLEX ZBTRAN
11303 EXTERNAL ZBTRAN, IBTNPROCS
11307 NPROCS = ibtnprocs()
11308 src = rsrc * nprocs + csrc
11309 dest = myrow * nprocs + mycol
11313 iseed(1) = mod( 1002 + testnum*5 + src*3, 4096 )
11314 iseed(2) = mod( 2027 + testnum*7 + src, 4096 )
11315 iseed(3) = mod( 1234 + testnum + src*3, 4096 )
11316 iseed(4) = mod( 4311 + testnum*10 + src*2, 4096 )
11324 compval = zbtran( iseed )
11331 IF( uplo .EQ.
'U' )
THEN
11332 IF( m .LE. n )
THEN
11333 IF( diag .EQ.
'U' )
THEN
11334 IF( i .GE. j )
THEN
11338 IF( i .GT. j )
THEN
11343 IF( diag .EQ.
'U' )
THEN
11344 IF( i .GE. m-n+j )
THEN
11348 IF( i .GT. m-n+j )
THEN
11353 ELSE IF( uplo .EQ.
'L' )
THEN
11354 IF( m .LE. n )
THEN
11355 IF( diag .EQ.
'U' )
THEN
11356 IF( j. ge. i+(n-m) )
THEN
11360 IF( j .GT. i+(n-m) )
THEN
11365 IF( diag .EQ.
'U' )
THEN
11366 IF( j .GE. i )
THEN
11370 IF( j .GT. i )
THEN
11382 IF( a(i,j) .NE. compval )
THEN
11384 IF( nerr .LE. maxerr )
THEN
11385 erribuf(1, nerr) = testnum
11386 erribuf(2, nerr) = src
11387 erribuf(3, nerr) = dest
11388 erribuf(4, nerr) = i
11389 erribuf(5, nerr) = j
11390 erribuf(6, nerr) = 5
11391 errdbuf(1, nerr) = a(i, j)
11392 errdbuf(2, nerr) = compval
11404 SUBROUTINE zprinterrs( OUTNUM, MAXERR, NERR,
11405 $ ERRIBUF, ERRDBUF, COUNTING, TFAILED )
11414 INTEGER OUTNUM, MAXERR, NERR
11417 INTEGER ERRIBUF(6, MAXERR), TFAILED(*)
11418 DOUBLE COMPLEX ERRDBUF(2, MAXERR)
11466 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
11467 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
11468 parameter( err_mat = 5 )
11471 INTEGER IBTMYPROC, IBTNPROCS
11472 EXTERNAL ibtmyproc, ibtnprocs
11477 INTEGER OLDTEST, NPROCS, PROW, PCOL, I, ERRTYPE
11481 IF( (ibtmyproc().NE.0) .OR. (nerr.LE.0) )
RETURN
11483 nprocs = ibtnprocs()
11484 prow = erribuf(3,1) / nprocs
11485 pcol = mod( erribuf(3,1), nprocs )
11486 IF( nerr .GT. maxerr )
WRITE(outnum,13000)
11488 DO 20 i = 1,
min( nerr, maxerr )
11489 IF( erribuf(1,i) .NE. oldtest )
THEN
11490 IF( oldtest .NE. -1 )
11491 $
WRITE(outnum,12000) prow, pcol, oldtest
11492 WRITE(outnum,*)
' '
11493 WRITE(outnum,1000) prow, pcol, erribuf(1,i)
11494 IF( counting ) tfailed( erribuf(1,i) ) = 1
11495 oldtest = erribuf(1, i)
11500 errtype = erribuf(6, i)
11501 IF( errtype .LT. -10 )
THEN
11502 errtype = -errtype - 10
11505 ELSE IF( errtype .LT. 0 )
THEN
11515 IF( matisint )
THEN
11516 IF( erribuf(2, i) .EQ. -1 )
THEN
11517 WRITE(outnum,11000) erribuf(4,i), erribuf(5,i), mat,
11518 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
11519 ELSE IF( errtype .EQ. err_pre )
THEN
11520 WRITE(outnum,7000) erribuf(5,i), mat,
11521 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
11522 ELSE IF( errtype .EQ. err_post )
THEN
11523 WRITE(outnum,8000) erribuf(4,i), mat,
11524 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
11525 ELSE IF( errtype .EQ. err_gap )
THEN
11526 WRITE(outnum,9000) mat, erribuf(4,i), erribuf(5,i),
11527 $ int( errdbuf(2,i) ), int( errdbuf(1,i) )
11529 WRITE(outnum,10000) mat, erribuf(4,i), erribuf(5,i),
11530 $ int( errdbuf(2,i) ),
11531 $ int( errdbuf(1,i) )
11537 IF( errtype .EQ. err_pre )
THEN
11538 WRITE(outnum,2000) erribuf(5,i),
11539 $ real( errdbuf(2,i) ), dimag( errdbuf(2,i) ),
11540 $ real( errdbuf(1,i) ), dimag( errdbuf(1,i) )
11541 ELSE IF( errtype .EQ. err_post )
THEN
11542 WRITE(outnum,3000) erribuf(4,i),
11543 $ real( errdbuf(2,i) ), dimag( errdbuf(2,i) ),
11544 $ real( errdbuf(1,i) ), dimag( errdbuf(1,i) )
11545 ELSE IF( errtype .EQ. err_gap )
THEN
11547 $ erribuf(4,i), erribuf(5,i),
11548 $ real( errdbuf(2,i) ), dimag( errdbuf(2,i) ),
11549 $ real( errdbuf(1,i) ), dimag( errdbuf(1,i) )
11550 ELSE IF( errtype .EQ. err_tri )
THEN
11551 WRITE(outnum,5000) erribuf(4,i), erribuf(5,i),
11552 $ real( errdbuf(2,i) ), dimag( errdbuf(2,i) ),
11553 $ real( errdbuf(1,i) ), dimag( errdbuf(1,i) )
11555 WRITE(outnum,6000) erribuf(4,i), erribuf(5,i),
11556 $ real( errdbuf(2,i) ), dimag( errdbuf(2,i) ),
11557 $ real( errdbuf(1,i) ), dimag( errdbuf(1,i) )
11561 WRITE(outnum,12000) prow, pcol, oldtest
11563 1000
FORMAT(
'PROCESS {',i4,
',',i4,
'} REPORTS ERRORS IN TEST#',i6,
':')
11564 2000
FORMAT(
' Buffer overwrite ',i4,
11565 $
' elements before the start of A:',/,
11566 $
' Expected=',
'[',g22.15,
',',g22.15,
']',
11567 $
'; Received=',
'[',g22.15,
',',g22.15,
']')
11568 3000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of A:',
11569 $ /,
' Expected=',
'[',g22.15,
',',g22.15,
']',
11570 $
'; Received=',
'[',g22.15,
',',g22.15,
']')
11571 4000
FORMAT(
' LDA-M gap overwrite at postion (',i4,
',',i4,
'):',/,
11572 $
' Expected=',
'[',g22.15,
',',g22.15,
']',
11573 $
'; Received=',
'[',g22.15,
',',g22.15,
']')
11574 5000
FORMAT(
' Complementory triangle overwrite at A(',i4,
',',i4,
11575 $
'):',/,
' Expected=',
'[',g22.15,
',',g22.15,
']',
11576 $
'; Received=',
'[',g22.15,
',',g22.15,
']')
11577 6000
FORMAT(
' Invalid element at A(',i4,
',',i4,
'):',/,
11578 $
' Expected=',
'[',g22.15,
',',g22.15,
']',
11579 $
'; Received=',
'[',g22.15,
',',g22.15,
']')
11580 7000
FORMAT(
' Buffer overwrite ',i4,
' elements before the start of ',
11581 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
11582 8000
FORMAT(
' Buffer overwrite ',i4,
' elements after the end of ',
11583 $ a1,
'A:',/,
' Expected=',i12,
'; Received=',i12)
11585 9000
FORMAT(
' LD',a1,
'A-M gap overwrite at postion (',i4,
',',i4,
'):'
11586 $ ,/,
' Expected=',i12,
'; Received=',i12)
11588 10000
FORMAT(
' Invalid element at ',a1,
'A(',i4,
',',i4,
'):',/,
11589 $
' Expected=',i12,
'; Received=',i12)
11590 11000
FORMAT(
' Overwrite at position (',i4,
',',i4,
') of non-existent '
11591 $ ,a1,
'A array.',/,
' Expected=',i12,
'; Received=',i12)
11592 12000
FORMAT(
'PROCESS {',i4,
',',i4,
'} DONE ERROR REPORT FOR TEST#',
11594 13000
FORMAT(
'WARNING: There were more errors than could be recorded.',
11595 $ /,
'Increase MEMELTS to get complete listing.')
11603 SUBROUTINE isumtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
11604 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
11605 $ LDAD0, NDEST, RDEST0, CDEST0, NGRID,
11606 $ CONTEXT0, P0, Q0, ISEED, MEM, MEMLEN )
11614 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM,
11615 $ topscohrnt, topsrepeat, verb
11618 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
11619 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
11620 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
11621 INTEGER P0(NGRID), Q0(NGRID), ISEED(*)
11622 INTEGER MEM(MEMLEN)
11708 LOGICAL ALLPASS, LSAME
11709 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
11710 EXTERNAL allpass, lsame, ibtmyproc, ibtnprocs, ibtsizeof
11713 EXTERNAL blacs_gridinfo, igsum2d
11717 CHARACTER*1 SCOPE, TOP
11718 LOGICAL INGRID, TESTOK, ALLRCV
11719 INTEGER APTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I, IAM,
11720 $ IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC, ISIZE, ISTART,
11721 $ ISTOP, ITC, ITC1, ITC2, ITO, ITR, ITR1, ITR2, J, K, LDA,
11722 $ LDADST, LDASRC, M, MAXERR, MYCOL, MYROW, N, NERR, NFAIL,
11723 $ NPCOL, NPROW, NSKIP, PREAPTR, RDEST, RDEST2, SETWHAT,
11733 checkval = iam * checkval
11734 isize = ibtsizeof(
'I')
11738 IF( iam .EQ. 0 )
THEN
11739 WRITE(outnum, *)
' '
11740 WRITE(outnum, *)
' '
11741 WRITE(outnum, 1000 )
11742 IF( verb .GT. 0 )
THEN
11743 WRITE(outnum,*)
' '
11744 WRITE(outnum, 2000)
'NSCOPE:', nscope
11745 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
11746 WRITE(outnum, 2000)
'TReps :', topsrepeat
11747 WRITE(outnum, 2000)
'TCohr :', topscohrnt
11748 WRITE(outnum, 2000)
'NTOP :', ntop
11749 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
11750 WRITE(outnum, 2000)
'NMAT :', nmat
11751 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
11752 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
11753 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
11754 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
11755 WRITE(outnum, 2000)
'NDEST :', ndest
11756 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
11757 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
11758 WRITE(outnum, 2000)
'NGRIDS:', ngrid
11759 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
11760 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
11761 WRITE(outnum, 2000)
'VERB :', verb
11762 WRITE(outnum,*)
' '
11764 IF( verb .GT. 1 )
THEN
11769 IF (topsrepeat.EQ.0)
THEN
11772 ELSE IF (topsrepeat.EQ.1)
THEN
11783 DO 10 ima = 1, nmat
11785 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
11786 IF( k .GT. i ) i = k
11788 maxerr = ( isize * (memlen-i) ) / ( isize*2 + isize*6 )
11789 IF( maxerr .LT. 1 )
THEN
11790 WRITE(outnum,*)
'ERROR: Not enough memory to run SUM tests.'
11791 CALL blacs_abort(-1, 1)
11794 erriptr = errdptr + maxerr
11802 DO 90 igr = 1, ngrid
11806 context = context0(igr)
11807 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
11808 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
11810 DO 80 isc = 1, nscope
11811 scope = scope0(isc)
11812 DO 70 ito = 1, ntop
11818 IF( lsame(top,
'M') )
THEN
11820 IF( scope .EQ.
'R' )
THEN
11821 istart = -(npcol - 1)
11823 ELSE IF (scope .EQ.
'C')
THEN
11824 istart = -(nprow - 1)
11827 istart = -(nprow*npcol - 1)
11830 ELSE IF( lsame(top,
'T') )
THEN
11833 IF( scope .EQ.
'R' )
THEN
11835 ELSE IF (scope .EQ.
'C')
THEN
11838 istop = nprow*npcol - 1
11845 DO 60 ima = 1, nmat
11848 ldasrc = ldas0(ima)
11849 ldadst = ldad0(ima)
11853 aptr = preaptr + ipre
11855 DO 50 ide = 1, ndest
11856 testnum = testnum + 1
11857 rdest2 = rdest0(ide)
11858 cdest2 = cdest0(ide)
11863 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
11867 IF (topscohrnt.EQ.0)
THEN
11870 ELSE IF (topscohrnt.EQ.1)
THEN
11883 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
11888 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
11893 IF( verb .GT. 1 )
THEN
11894 IF( iam .EQ. 0 )
THEN
11895 WRITE(outnum, 6000)
11896 $ testnum,
'RUNNING', scope, top, m, n,
11897 $ ldasrc, ldadst, rdest2, cdest2,
11906 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
11907 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
11908 $ (scope .EQ.
'A') )
THEN
11911 DO 40 itr = itr1, itr2
11912 CALL blacs_set(context, 15, itr)
11913 DO 35 itc = itc1, itc2
11914 CALL blacs_set(context, 16, itc)
11915 DO 30 j = istart, istop
11916 IF( j.EQ.0)
GOTO 30
11918 $
CALL blacs_set(context, setwhat, j)
11923 CALL iinitmat(
'G',
'-', m, n, mem(preaptr),
11924 $ lda, ipre, ipost,
11925 $ checkval, testnum,
11928 CALL igsum2d(context, scope, top, m, n,
11929 $ mem(aptr), lda, rdest2,
11935 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
11936 $ .OR. allrcv )
THEN
11938 $ mem(preaptr), lda, rdest,
11939 $ cdest, myrow, mycol,
11940 $ ipre, ipost, checkval,
11941 $ testnum, maxerr, nerr,
11942 $ mem(erriptr),mem(errdptr))
11943 CALL ichksum(scope, context, m, n,
11945 $ testnum, maxerr, nerr,
11946 $ mem(erriptr),mem(errdptr),
11950 CALL blacs_set(context, 16, 0)
11952 CALL blacs_set(context, 15, 0)
11954 testok = ( k .EQ. nerr )
11958 IF( verb .GT. 1 )
THEN
11961 $ mem(erriptr), mem(errdptr), iseed)
11962 IF( iam .EQ. 0 )
THEN
11963 IF( testok .AND. nerr.EQ.i )
THEN
11964 WRITE(outnum,6000)testnum,
'PASSED ',
11965 $ scope, top, m, n, ldasrc,
11966 $ ldadst, rdest2, cdest2,
11970 WRITE(outnum,6000)testnum,
'FAILED ',
11971 $ scope, top, m, n, ldasrc,
11972 $ ldadst, rdest2, cdest2,
11987 IF( verb .LT. 2 )
THEN
11989 CALL ibtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
11990 $ mem(errdptr), iseed )
11992 IF( iam .EQ. 0 )
THEN
11993 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
11994 IF( nfail+nskip .EQ. 0 )
THEN
11995 WRITE(outnum, 7000 ) testnum
11997 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
12004 testok = allpass( (nfail.EQ.0) )
12006 1000
FORMAT(
'INTEGER SUM TESTS: BEGIN.' )
12007 2000
FORMAT(1x,a7,3x,10i6)
12008 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
12010 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD ',
12011 $
'RDEST CDEST P Q')
12012 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ',
12013 $
'----- ----- ---- ----')
12014 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,6i6,2i5)
12015 7000
FORMAT(
'INTEGER SUM TESTS: PASSED ALL',
12017 8000
FORMAT(
'INTEGER SUM TESTS:',i5,
' TESTS;',i5,
' PASSED,',
12018 $ i5,
' SKIPPED,',i5,
' FAILED.')
12026 INTEGER FUNCTION ibtabs(VAL)
12032 SUBROUTINE ichksum( SCOPE, ICTXT, M, N, A, LDA, TESTNUM, MAXERR,
12033 $ NERR, ERRIBUF, ERRDBUF, ISEED )
12037 INTEGER ICTXT, M, N, LDA, TESTNUM, MAXERR, NERR
12040 INTEGER ERRIBUF(6, MAXERR), ISEED(*)
12041 INTEGER A(LDA,*), ERRDBUF(2, MAXERR)
12044 INTEGER IBTMYPROC, IBTNPROCS
12046 EXTERNAL ibtmyproc, ibtnprocs, ibtran
12049 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, NODE, NNODES, DEST
12055 nprocs = ibtnprocs()
12056 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
12057 dest = myrow*nprocs + mycol
12061 IF( scope .EQ.
'R' )
THEN
12063 DO 10 i = 0, nnodes-1
12064 node = myrow * nprocs + i
12065 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12066 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12067 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12068 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12070 ELSE IF( scope .EQ.
'C' )
THEN
12072 DO 20 i = 0, nnodes-1
12073 node = i * nprocs + mycol
12074 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12075 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12076 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12077 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12080 nnodes = nprow * npcol
12081 DO 30 i = 0, nnodes-1
12082 node = (i / npcol) * nprocs + mod(i, npcol)
12083 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12084 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12085 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12086 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12093 DO 40 k = 0, nnodes-1
12094 ans = ans + ibtran( iseed(k*4+1) )
12104 IF( ans .NE. a(i,j) )
THEN
12106 IF( nerr .LE. maxerr )
THEN
12107 erribuf(1, nerr) = testnum
12108 erribuf(2, nerr) = nnodes
12109 erribuf(3, nerr) = dest
12110 erribuf(4, nerr) = i
12111 erribuf(5, nerr) = j
12112 erribuf(6, nerr) = 5
12113 errdbuf(1, nerr) = a(i,j)
12114 errdbuf(2, nerr) = ans
12127 SUBROUTINE ssumtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
12128 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
12129 $ LDAD0, NDEST, RDEST0, CDEST0, NGRID,
12130 $ CONTEXT0, P0, Q0, ISEED, MEM, MEMLEN )
12138 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM,
12139 $ topscohrnt, topsrepeat, verb
12142 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
12143 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
12144 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
12145 INTEGER P0(NGRID), Q0(NGRID), ISEED(*)
12232 LOGICAL ALLPASS, LSAME
12233 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
12234 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
12237 EXTERNAL blacs_gridinfo, sgsum2d
12241 CHARACTER*1 SCOPE, TOP
12242 LOGICAL INGRID, TESTOK, ALLRCV
12243 INTEGER APTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I, IAM,
12244 $ IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC, ISIZE, ISTART,
12245 $ ISTOP, ITC, ITC1, ITC2, ITO, ITR, ITR1, ITR2, J, K, LDA,
12246 $ LDADST, LDASRC, M, MAXERR, MYCOL, MYROW, N, NERR, NFAIL,
12247 $ NPCOL, NPROW, NSKIP, PREAPTR, RDEST, RDEST2, SETWHAT,
12257 checkval = iam * checkval
12258 isize = ibtsizeof(
'I')
12259 ssize = ibtsizeof(
'S')
12263 IF( iam .EQ. 0 )
THEN
12264 WRITE(outnum, *)
' '
12265 WRITE(outnum, *)
' '
12266 WRITE(outnum, 1000 )
12267 IF( verb .GT. 0 )
THEN
12268 WRITE(outnum,*)
' '
12269 WRITE(outnum, 2000)
'NSCOPE:', nscope
12270 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
12271 WRITE(outnum, 2000)
'TReps :', topsrepeat
12272 WRITE(outnum, 2000)
'TCohr :', topscohrnt
12273 WRITE(outnum, 2000)
'NTOP :', ntop
12274 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
12275 WRITE(outnum, 2000)
'NMAT :', nmat
12276 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
12277 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
12278 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
12279 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
12280 WRITE(outnum, 2000)
'NDEST :', ndest
12281 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
12282 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
12283 WRITE(outnum, 2000)
'NGRIDS:', ngrid
12284 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
12285 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
12286 WRITE(outnum, 2000)
'VERB :', verb
12287 WRITE(outnum,*)
' '
12289 IF( verb .GT. 1 )
THEN
12294 IF (topsrepeat.EQ.0)
THEN
12297 ELSE IF (topsrepeat.EQ.1)
THEN
12308 DO 10 ima = 1, nmat
12310 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
12311 IF( k .GT. i ) i = k
12313 maxerr = ( ssize * (memlen-i) ) / ( ssize*2 + isize*6 )
12314 IF( maxerr .LT. 1 )
THEN
12315 WRITE(outnum,*)
'ERROR: Not enough memory to run SUM tests.'
12316 CALL blacs_abort(-1, 1)
12319 erriptr = errdptr + maxerr
12327 DO 90 igr = 1, ngrid
12331 context = context0(igr)
12332 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
12333 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
12335 DO 80 isc = 1, nscope
12336 scope = scope0(isc)
12337 DO 70 ito = 1, ntop
12343 IF( lsame(top,
'M') )
THEN
12345 IF( scope .EQ.
'R' )
THEN
12346 istart = -(npcol - 1)
12348 ELSE IF (scope .EQ.
'C')
THEN
12349 istart = -(nprow - 1)
12352 istart = -(nprow*npcol - 1)
12355 ELSE IF( lsame(top,
'T') )
THEN
12358 IF( scope .EQ.
'R' )
THEN
12360 ELSE IF (scope .EQ.
'C')
THEN
12363 istop = nprow*npcol - 1
12370 DO 60 ima = 1, nmat
12373 ldasrc = ldas0(ima)
12374 ldadst = ldad0(ima)
12378 aptr = preaptr + ipre
12380 DO 50 ide = 1, ndest
12381 testnum = testnum + 1
12382 rdest2 = rdest0(ide)
12383 cdest2 = cdest0(ide)
12388 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
12392 IF (topscohrnt.EQ.0)
THEN
12395 ELSE IF (topscohrnt.EQ.1)
THEN
12408 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
12413 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
12418 IF( verb .GT. 1 )
THEN
12419 IF( iam .EQ. 0 )
THEN
12420 WRITE(outnum, 6000)
12421 $ testnum,
'RUNNING', scope, top, m, n,
12422 $ ldasrc, ldadst, rdest2, cdest2,
12431 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
12432 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
12433 $ (scope .EQ.
'A') )
THEN
12436 DO 40 itr = itr1, itr2
12437 CALL blacs_set(context, 15, itr)
12438 DO 35 itc = itc1, itc2
12439 CALL blacs_set(context, 16, itc)
12440 DO 30 j = istart, istop
12441 IF( j.EQ.0)
GOTO 30
12443 $
CALL blacs_set(context, setwhat, j)
12448 CALL sinitmat(
'G',
'-', m, n, mem(preaptr),
12449 $ lda, ipre, ipost,
12450 $ checkval, testnum,
12453 CALL sgsum2d(context, scope, top, m, n,
12454 $ mem(aptr), lda, rdest2,
12460 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
12461 $ .OR. allrcv )
THEN
12463 $ mem(preaptr), lda, rdest,
12464 $ cdest, myrow, mycol,
12465 $ ipre, ipost, checkval,
12466 $ testnum, maxerr, nerr,
12467 $ mem(erriptr),mem(errdptr))
12468 CALL schksum(scope, context, m, n,
12470 $ testnum, maxerr, nerr,
12471 $ mem(erriptr),mem(errdptr),
12475 CALL blacs_set(context, 16, 0)
12477 CALL blacs_set(context, 15, 0)
12479 testok = ( k .EQ. nerr )
12483 IF( verb .GT. 1 )
THEN
12486 $ mem(erriptr), mem(errdptr), iseed)
12487 IF( iam .EQ. 0 )
THEN
12488 IF( testok .AND. nerr.EQ.i )
THEN
12489 WRITE(outnum,6000)testnum,
'PASSED ',
12490 $ scope, top, m, n, ldasrc,
12491 $ ldadst, rdest2, cdest2,
12495 WRITE(outnum,6000)testnum,
'FAILED ',
12496 $ scope, top, m, n, ldasrc,
12497 $ ldadst, rdest2, cdest2,
12512 IF( verb .LT. 2 )
THEN
12514 CALL sbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
12515 $ mem(errdptr), iseed )
12517 IF( iam .EQ. 0 )
THEN
12518 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
12519 IF( nfail+nskip .EQ. 0 )
THEN
12520 WRITE(outnum, 7000 ) testnum
12522 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
12529 testok = allpass( (nfail.EQ.0) )
12531 1000
FORMAT(
'REAL SUM TESTS: BEGIN.' )
12532 2000
FORMAT(1x,a7,3x,10i6)
12533 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
12535 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD ',
12536 $
'RDEST CDEST P Q')
12537 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ',
12538 $
'----- ----- ---- ----')
12539 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,6i6,2i5)
12540 7000
FORMAT(
'REAL SUM TESTS: PASSED ALL',
12542 8000
FORMAT(
'REAL SUM TESTS:',i5,
' TESTS;',i5,
' PASSED,',
12543 $ i5,
' SKIPPED,',i5,
' FAILED.')
12551 REAL FUNCTION SBTABS(VAL)
12565 INTEGER i, iam, nnodes
12575 IF( eps .EQ. -22.0e0 )
THEN
12579 IF( iam .EQ. 0 )
THEN
12580 IF( nnodes .GT. 1 )
THEN
12581 DO 10 i = 1, nnodes-1
12583 IF( eps .LT. eps2 ) eps = eps2
12599 SUBROUTINE schksum( SCOPE, ICTXT, M, N, A, LDA, TESTNUM, MAXERR,
12600 $ NERR, ERRIBUF, ERRDBUF, ISEED )
12604 INTEGER ICTXT, M, N, LDA, TESTNUM, MAXERR, NERR
12607 INTEGER ERRIBUF(6, MAXERR), ISEED(*)
12608 REAL A(LDA,*), ERRDBUF(2, MAXERR)
12611 INTEGER IBTMYPROC, IBTNPROCS
12614 EXTERNAL ibtmyproc, ibtnprocs, sbteps, sbtran
12617 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, NODE, NNODES, DEST
12619 REAL ANS, EPS, ERRBND, POSNUM, NEGNUM, TMP
12623 nprocs = ibtnprocs()
12625 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
12626 dest = myrow*nprocs + mycol
12630 IF( scope .EQ.
'R' )
THEN
12632 DO 10 i = 0, nnodes-1
12633 node = myrow * nprocs + i
12634 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12635 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12636 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12637 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12639 ELSE IF( scope .EQ.
'C' )
THEN
12641 DO 20 i = 0, nnodes-1
12642 node = i * nprocs + mycol
12643 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12644 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12645 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12646 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12649 nnodes = nprow * npcol
12650 DO 30 i = 0, nnodes-1
12651 node = (i / npcol) * nprocs + mod(i, npcol)
12652 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
12653 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
12654 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
12655 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
12664 DO 40 k = 0, nnodes-1
12665 tmp = sbtran( iseed(k*4+1) )
12666 IF( tmp .LT. 0 )
THEN
12667 negnum = negnum + tmp
12669 posnum = posnum + tmp
12681 errbnd = 2 * eps * nnodes *
max( posnum, -negnum )
12682 IF( abs( ans - a(i,j) ) .GT. errbnd )
THEN
12684 IF( nerr .LE. maxerr )
THEN
12685 erribuf(1, nerr) = testnum
12686 erribuf(2, nerr) = nnodes
12687 erribuf(3, nerr) = dest
12688 erribuf(4, nerr) = i
12689 erribuf(5, nerr) = j
12690 erribuf(6, nerr) = 5
12691 errdbuf(1, nerr) = a(i,j)
12692 errdbuf(2, nerr) = ans
12705 SUBROUTINE dsumtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
12706 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
12707 $ LDAD0, NDEST, RDEST0, CDEST0, NGRID,
12708 $ CONTEXT0, P0, Q0, ISEED, MEM, MEMLEN )
12716 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM,
12717 $ TOPSCOHRNT, TOPSREPEAT, VERB
12720 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
12721 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
12722 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
12723 INTEGER P0(NGRID), Q0(NGRID), ISEED(*)
12724 DOUBLE PRECISION MEM(MEMLEN)
12810 LOGICAL ALLPASS, LSAME
12811 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
12812 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
12815 EXTERNAL blacs_gridinfo, dgsum2d
12819 CHARACTER*1 SCOPE, TOP
12820 LOGICAL INGRID, TESTOK, ALLRCV
12821 INTEGER APTR, CDEST, CDEST2, CONTEXT, DSIZE, ERRDPTR, ERRIPTR, I,
12822 $ IAM, IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC, ISIZE, ISTART,
12823 $ ISTOP, ITC, ITC1, ITC2, ITO, ITR, ITR1, ITR2, J, K, LDA,
12824 $ LDADST, LDASRC, M, MAXERR, MYCOL, MYROW, N, NERR, NFAIL,
12825 $ NPCOL, NPROW, NSKIP, PREAPTR, RDEST, RDEST2, SETWHAT,
12827 DOUBLE PRECISION CHECKVAL
12835 checkval = iam * checkval
12836 isize = ibtsizeof(
'I')
12837 dsize = ibtsizeof(
'D')
12841 IF( iam .EQ. 0 )
THEN
12842 WRITE(outnum, *)
' '
12843 WRITE(outnum, *)
' '
12844 WRITE(outnum, 1000 )
12845 IF( verb .GT. 0 )
THEN
12846 WRITE(outnum,*)
' '
12847 WRITE(outnum, 2000)
'NSCOPE:', nscope
12848 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
12849 WRITE(outnum, 2000)
'TReps :', topsrepeat
12850 WRITE(outnum, 2000)
'TCohr :', topscohrnt
12851 WRITE(outnum, 2000)
'NTOP :', ntop
12852 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
12853 WRITE(outnum, 2000)
'NMAT :', nmat
12854 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
12855 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
12856 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
12857 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
12858 WRITE(outnum, 2000)
'NDEST :', ndest
12859 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
12860 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
12861 WRITE(outnum, 2000)
'NGRIDS:', ngrid
12862 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
12863 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
12864 WRITE(outnum, 2000)
'VERB :', verb
12865 WRITE(outnum,*)
' '
12867 IF( verb .GT. 1 )
THEN
12872 IF (topsrepeat.EQ.0)
THEN
12875 ELSE IF (topsrepeat.EQ.1)
THEN
12886 DO 10 ima = 1, nmat
12888 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
12889 IF( k .GT. i ) i = k
12891 maxerr = ( dsize * (memlen-i) ) / ( dsize*2 + isize*6 )
12892 IF( maxerr .LT. 1 )
THEN
12893 WRITE(outnum,*)
'ERROR: Not enough memory to run SUM tests.'
12894 CALL blacs_abort(-1, 1)
12897 erriptr = errdptr + maxerr
12905 DO 90 igr = 1, ngrid
12909 context = context0(igr)
12910 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
12911 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
12913 DO 80 isc = 1, nscope
12914 scope = scope0(isc)
12915 DO 70 ito = 1, ntop
12921 IF( lsame(top,
'M') )
THEN
12923 IF( scope .EQ.
'R' )
THEN
12924 istart = -(npcol - 1)
12926 ELSE IF (scope .EQ.
'C')
THEN
12927 istart = -(nprow - 1)
12930 istart = -(nprow*npcol - 1)
12933 ELSE IF( lsame(top,
'T') )
THEN
12936 IF( scope .EQ.
'R' )
THEN
12938 ELSE IF (scope .EQ.
'C')
THEN
12941 istop = nprow*npcol - 1
12948 DO 60 ima = 1, nmat
12951 ldasrc = ldas0(ima)
12952 ldadst = ldad0(ima)
12956 aptr = preaptr + ipre
12958 DO 50 ide = 1, ndest
12959 testnum = testnum + 1
12960 rdest2 = rdest0(ide)
12961 cdest2 = cdest0(ide)
12966 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
12970 IF (topscohrnt.EQ.0)
THEN
12973 ELSE IF (topscohrnt.EQ.1)
THEN
12986 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
12991 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
12996 IF( verb .GT. 1 )
THEN
12997 IF( iam .EQ. 0 )
THEN
12998 WRITE(outnum, 6000)
12999 $ testnum,
'RUNNING', scope, top, m, n,
13000 $ ldasrc, ldadst, rdest2, cdest2,
13009 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
13010 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
13011 $ (scope .EQ.
'A') )
THEN
13014 DO 40 itr = itr1, itr2
13015 CALL blacs_set(context, 15, itr)
13016 DO 35 itc = itc1, itc2
13017 CALL blacs_set(context, 16, itc)
13018 DO 30 j = istart, istop
13019 IF( j.EQ.0)
GOTO 30
13021 $
CALL blacs_set(context, setwhat, j)
13026 CALL dinitmat(
'G',
'-', m, n, mem(preaptr),
13027 $ lda, ipre, ipost,
13028 $ checkval, testnum,
13031 CALL dgsum2d(context, scope, top, m, n,
13032 $ mem(aptr), lda, rdest2,
13038 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
13039 $ .OR. allrcv )
THEN
13041 $ mem(preaptr), lda, rdest,
13042 $ cdest, myrow, mycol,
13043 $ ipre, ipost, checkval,
13044 $ testnum, maxerr, nerr,
13045 $ mem(erriptr),mem(errdptr))
13046 CALL dchksum(scope, context, m, n,
13048 $ testnum, maxerr, nerr,
13049 $ mem(erriptr),mem(errdptr),
13053 CALL blacs_set(context, 16, 0)
13055 CALL blacs_set(context, 15, 0)
13057 testok = ( k .EQ. nerr )
13061 IF( verb .GT. 1 )
THEN
13064 $ mem(erriptr), mem(errdptr), iseed)
13065 IF( iam .EQ. 0 )
THEN
13066 IF( testok .AND. nerr.EQ.i )
THEN
13067 WRITE(outnum,6000)testnum,
'PASSED ',
13068 $ scope, top, m, n, ldasrc,
13069 $ ldadst, rdest2, cdest2,
13073 WRITE(outnum,6000)testnum,
'FAILED ',
13074 $ scope, top, m, n, ldasrc,
13075 $ ldadst, rdest2, cdest2,
13090 IF( verb .LT. 2 )
THEN
13092 CALL dbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
13093 $ mem(errdptr), iseed )
13095 IF( iam .EQ. 0 )
THEN
13096 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
13097 IF( nfail+nskip .EQ. 0 )
THEN
13098 WRITE(outnum, 7000 ) testnum
13100 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
13107 testok = allpass( (nfail.EQ.0) )
13109 1000
FORMAT(
'DOUBLE PRECISION SUM TESTS: BEGIN.' )
13110 2000
FORMAT(1x,a7,3x,10i6)
13111 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
13113 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD ',
13114 $
'RDEST CDEST P Q')
13115 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ',
13116 $
'----- ----- ---- ----')
13117 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,6i6,2i5)
13118 7000
FORMAT(
'DOUBLE PRECISION SUM TESTS: PASSED ALL',
13120 8000
FORMAT(
'DOUBLE PRECISION SUM TESTS:',i5,
' TESTS;',i5,
' PASSED,',
13121 $ i5,
' SKIPPED,',i5,
' FAILED.')
13129 DOUBLE PRECISION FUNCTION dbtabs(VAL)
13130 DOUBLE PRECISION val
13135 DOUBLE PRECISION FUNCTION dbteps()
13143 INTEGER i, iam, nnodes
13144 DOUBLE PRECISION eps, eps2
13153 IF( eps .EQ. -22.0d0 )
THEN
13157 IF( iam .EQ. 0 )
THEN
13158 IF( nnodes .GT. 1 )
THEN
13159 DO 10 i = 1, nnodes-1
13161 IF( eps .LT. eps2 ) eps = eps2
13177 SUBROUTINE dchksum( SCOPE, ICTXT, M, N, A, LDA, TESTNUM, MAXERR,
13178 $ NERR, ERRIBUF, ERRDBUF, ISEED )
13182 INTEGER ICTXT, M, N, LDA, TESTNUM, MAXERR, NERR
13185 INTEGER ERRIBUF(6, MAXERR), ISEED(*)
13186 DOUBLE PRECISION A(LDA,*), ERRDBUF(2, MAXERR)
13189 INTEGER IBTMYPROC, IBTNPROCS
13190 DOUBLE PRECISION DBTEPS
13191 DOUBLE PRECISION DBTRAN
13192 EXTERNAL ibtmyproc, ibtnprocs, dbteps, dbtran
13195 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, NODE, NNODES, DEST
13197 DOUBLE PRECISION ANS, EPS, ERRBND, POSNUM, NEGNUM, TMP
13201 nprocs = ibtnprocs()
13203 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
13204 dest = myrow*nprocs + mycol
13208 IF( scope .EQ.
'R' )
THEN
13210 DO 10 i = 0, nnodes-1
13211 node = myrow * nprocs + i
13212 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13213 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13214 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13215 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13217 ELSE IF( scope .EQ.
'C' )
THEN
13219 DO 20 i = 0, nnodes-1
13220 node = i * nprocs + mycol
13221 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13222 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13223 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13224 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13227 nnodes = nprow * npcol
13228 DO 30 i = 0, nnodes-1
13229 node = (i / npcol) * nprocs + mod(i, npcol)
13230 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13231 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13232 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13233 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13242 DO 40 k = 0, nnodes-1
13243 tmp = dbtran( iseed(k*4+1) )
13244 IF( tmp .LT. 0 )
THEN
13245 negnum = negnum + tmp
13247 posnum = posnum + tmp
13259 errbnd = 2 * eps * nnodes *
max( posnum, -negnum )
13260 IF( abs( ans - a(i,j) ) .GT. errbnd )
THEN
13262 IF( nerr .LE. maxerr )
THEN
13263 erribuf(1, nerr) = testnum
13264 erribuf(2, nerr) = nnodes
13265 erribuf(3, nerr) = dest
13266 erribuf(4, nerr) = i
13267 erribuf(5, nerr) = j
13268 erribuf(6, nerr) = 5
13269 errdbuf(1, nerr) = a(i,j)
13270 errdbuf(2, nerr) = ans
13283 SUBROUTINE csumtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
13284 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
13285 $ LDAD0, NDEST, RDEST0, CDEST0, NGRID,
13286 $ CONTEXT0, P0, Q0, ISEED, MEM, MEMLEN )
13294 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM,
13295 $ TOPSCOHRNT, TOPSREPEAT, VERB
13298 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
13299 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
13300 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
13301 INTEGER P0(NGRID), Q0(NGRID), ISEED(*)
13302 COMPLEX MEM(MEMLEN)
13388 LOGICAL ALLPASS, LSAME
13389 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
13390 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
13393 EXTERNAL BLACS_GRIDINFO, CGSUM2D
13394 EXTERNAL CINITMAT, CCHKPAD, CBTCHECKIN
13397 CHARACTER*1 SCOPE, TOP
13398 LOGICAL INGRID, TESTOK, ALLRCV
13399 INTEGER APTR, CDEST, CDEST2, CONTEXT, CSIZE, ERRDPTR, ERRIPTR, I,
13400 $ iam, ide, igr, ima, ipad, ipost, ipre, isc, isize, istart,
13401 $ istop, itc, itc1, itc2, ito, itr, itr1, itr2, j, k, lda,
13402 $ ldadst, ldasrc, m, maxerr, mycol, myrow, n, nerr, nfail,
13403 $ npcol, nprow, nskip, preaptr, rdest, rdest2, setwhat,
13411 CHECKVAL =
cmplx( -0.91e0, -0.71e0 )
13413 checkval = iam * checkval
13414 isize = ibtsizeof(
'I')
13415 csize = ibtsizeof(
'C')
13419 IF( iam .EQ. 0 )
THEN
13420 WRITE(outnum, *)
' '
13421 WRITE(outnum, *)
' '
13422 WRITE(outnum, 1000 )
13423 IF( verb .GT. 0 )
THEN
13424 WRITE(outnum,*)
' '
13425 WRITE(outnum, 2000)
'NSCOPE:', nscope
13426 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
13427 WRITE(outnum, 2000)
'TReps :', topsrepeat
13428 WRITE(outnum, 2000)
'TCohr :', topscohrnt
13429 WRITE(outnum, 2000)
'NTOP :', ntop
13430 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
13431 WRITE(outnum, 2000)
'NMAT :', nmat
13432 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
13433 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
13434 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
13435 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
13436 WRITE(outnum, 2000)
'NDEST :', ndest
13437 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
13438 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
13439 WRITE(outnum, 2000)
'NGRIDS:', ngrid
13440 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
13441 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
13442 WRITE(outnum, 2000)
'VERB :', verb
13443 WRITE(outnum,*)
' '
13445 IF( verb .GT. 1 )
THEN
13450 IF (topsrepeat.EQ.0)
THEN
13453 ELSE IF (topsrepeat.EQ.1)
THEN
13464 DO 10 ima = 1, nmat
13466 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
13467 IF( k .GT. i ) i = k
13469 maxerr = ( csize * (memlen-i) ) / ( csize*2 + isize*6 )
13470 IF( maxerr .LT. 1 )
THEN
13471 WRITE(outnum,*)
'ERROR: Not enough memory to run SUM tests.'
13472 CALL blacs_abort(-1, 1)
13475 erriptr = errdptr + maxerr
13483 DO 90 igr = 1, ngrid
13487 context = context0(igr)
13488 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
13489 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
13491 DO 80 isc = 1, nscope
13492 scope = scope0(isc)
13493 DO 70 ito = 1, ntop
13499 IF( lsame(top,
'M') )
THEN
13501 IF( scope .EQ.
'R' )
THEN
13502 istart = -(npcol - 1)
13504 ELSE IF (scope .EQ.
'C')
THEN
13505 istart = -(nprow - 1)
13508 istart = -(nprow*npcol - 1)
13511 ELSE IF( lsame(top,
'T') )
THEN
13514 IF( scope .EQ.
'R' )
THEN
13516 ELSE IF (scope .EQ.
'C')
THEN
13519 istop = nprow*npcol - 1
13526 DO 60 ima = 1, nmat
13529 ldasrc = ldas0(ima)
13530 ldadst = ldad0(ima)
13534 aptr = preaptr + ipre
13536 DO 50 ide = 1, ndest
13537 testnum = testnum + 1
13538 rdest2 = rdest0(ide)
13539 cdest2 = cdest0(ide)
13544 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
13548 IF (topscohrnt.EQ.0)
THEN
13551 ELSE IF (topscohrnt.EQ.1)
THEN
13564 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
13569 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
13574 IF( verb .GT. 1 )
THEN
13575 IF( iam .EQ. 0 )
THEN
13576 WRITE(outnum, 6000)
13577 $ testnum,
'RUNNING', scope, top, m, n,
13578 $ ldasrc, ldadst, rdest2, cdest2,
13587 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
13588 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
13589 $ (scope .EQ.
'A') )
THEN
13592 DO 40 itr = itr1, itr2
13593 CALL blacs_set(context, 15, itr)
13594 DO 35 itc = itc1, itc2
13595 CALL blacs_set(context, 16, itc)
13596 DO 30 j = istart, istop
13597 IF( j.EQ.0)
GOTO 30
13599 $
CALL blacs_set(context, setwhat, j)
13604 CALL cinitmat(
'G',
'-', m, n, mem(preaptr),
13605 $ lda, ipre, ipost,
13606 $ checkval, testnum,
13609 CALL cgsum2d(context, scope, top, m, n,
13610 $ mem(aptr), lda, rdest2,
13616 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
13617 $ .OR. allrcv )
THEN
13618 CALL cchkpad(
'G',
'-', m, n,
13619 $ mem(preaptr), lda, rdest,
13620 $ cdest, myrow, mycol,
13621 $ ipre, ipost, checkval,
13622 $ testnum, maxerr, nerr,
13623 $ mem(erriptr),mem(errdptr))
13624 CALL cchksum(scope, context, m, n,
13626 $ testnum, maxerr, nerr,
13627 $ mem(erriptr),mem(errdptr),
13631 CALL blacs_set(context, 16, 0)
13633 CALL blacs_set(context, 15, 0)
13635 testok = ( k .EQ. nerr )
13639 IF( verb .GT. 1 )
THEN
13641 CALL cbtcheckin(0, outnum, maxerr, nerr,
13642 $ mem(erriptr), mem(errdptr), iseed)
13643 IF( iam .EQ. 0 )
THEN
13644 IF( testok .AND. nerr.EQ.i )
THEN
13645 WRITE(outnum,6000)testnum,
'PASSED ',
13646 $ scope, top, m, n, ldasrc,
13647 $ ldadst, rdest2, cdest2,
13651 WRITE(outnum,6000)testnum,
'FAILED ',
13652 $ scope, top, m, n, ldasrc,
13653 $ ldadst, rdest2, cdest2,
13668 IF( verb .LT. 2 )
THEN
13670 CALL cbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
13671 $ mem(errdptr), iseed )
13673 IF( iam .EQ. 0 )
THEN
13674 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
13675 IF( nfail+nskip .EQ. 0 )
THEN
13676 WRITE(outnum, 7000 ) testnum
13678 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
13685 testok = allpass( (nfail.EQ.0) )
13687 1000
FORMAT(
'COMPLEX SUM TESTS: BEGIN.' )
13688 2000
FORMAT(1x,a7,3x,10i6)
13689 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
13691 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD ',
13692 $
'RDEST CDEST P Q')
13693 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ',
13694 $
'----- ----- ---- ----')
13695 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,6i6,2i5)
13696 7000
FORMAT(
'COMPLEX SUM TESTS: PASSED ALL',
13698 8000
FORMAT(
'COMPLEX SUM TESTS:',i5,
' TESTS;',i5,
' PASSED,',
13699 $ i5,
' SKIPPED,',i5,
' FAILED.')
13707 REAL FUNCTION CBTABS(VAL)
13709 cbtabs = abs( real(val) ) + abs( aimag(val) )
13713 SUBROUTINE cchksum( SCOPE, ICTXT, M, N, A, LDA, TESTNUM, MAXERR,
13714 $ NERR, ERRIBUF, ERRDBUF, ISEED )
13718 INTEGER ICTXT, M, N, LDA, TESTNUM, MAXERR, NERR
13721 INTEGER ERRIBUF(6, MAXERR), ISEED(*)
13722 COMPLEX A(LDA,*), ERRDBUF(2, MAXERR)
13725 INTEGER IBTMYPROC, IBTNPROCS
13728 EXTERNAL IBTMYPROC, IBTNPROCS, SBTEPS, CBTRAN
13732 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, NODE, NNODES, DEST
13735 REAL EPS, ERRBND, RPOSNUM, RNEGNUM, IPOSNUM, INEGNUM
13739 nprocs = ibtnprocs()
13741 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
13742 dest = myrow*nprocs + mycol
13746 IF( scope .EQ.
'R' )
THEN
13748 DO 10 i = 0, nnodes-1
13749 node = myrow * nprocs + i
13750 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13751 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13752 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13753 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13755 ELSE IF( scope .EQ.
'C' )
THEN
13757 DO 20 i = 0, nnodes-1
13758 node = i * nprocs + mycol
13759 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13760 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13761 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13762 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13765 nnodes = nprow * npcol
13766 DO 30 i = 0, nnodes-1
13767 node = (i / npcol) * nprocs + mod(i, npcol)
13768 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
13769 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
13770 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
13771 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
13782 DO 40 k = 0, nnodes-1
13783 tmp = cbtran( iseed(k*4+1) )
13784 IF( real( tmp ) .LT. 0 )
THEN
13785 rnegnum = rnegnum + real( tmp )
13787 rposnum = rposnum + real( tmp )
13789 IF( aimag( tmp ) .LT. 0 )
THEN
13790 inegnum = inegnum + aimag( tmp )
13792 iposnum = iposnum + aimag( tmp )
13805 errbnd = 2 * eps * nnodes *
max( rposnum, -rnegnum )
13806 numok = ( real(tmp) .LE. errbnd )
13807 errbnd = 2 * eps * nnodes *
max( iposnum, -inegnum )
13808 numok = numok .AND. ( aimag(tmp) .LE. errbnd )
13809 IF( .NOT.numok )
THEN
13811 IF( nerr .LE. maxerr )
THEN
13812 erribuf(1, nerr) = testnum
13813 erribuf(2, nerr) = nnodes
13814 erribuf(3, nerr) = dest
13815 erribuf(4, nerr) = i
13816 erribuf(5, nerr) = j
13817 erribuf(6, nerr) = 5
13818 errdbuf(1, nerr) = a(i,j)
13819 errdbuf(2, nerr) = ans
13832 SUBROUTINE zsumtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
13833 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
13834 $ LDAD0, NDEST, RDEST0, CDEST0, NGRID,
13835 $ CONTEXT0, P0, Q0, ISEED, MEM, MEMLEN )
13843 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM,
13844 $ topscohrnt, topsrepeat, verb
13847 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
13848 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT)
13849 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
13850 INTEGER P0(NGRID), Q0(NGRID), ISEED(*)
13851 DOUBLE COMPLEX MEM(MEMLEN)
13937 LOGICAL ALLPASS, LSAME
13938 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
13939 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
13942 EXTERNAL BLACS_GRIDINFO, ZGSUM2D
13943 EXTERNAL ZINITMAT, ZCHKPAD, ZBTCHECKIN
13946 CHARACTER*1 SCOPE, TOP
13947 LOGICAL INGRID, TESTOK, ALLRCV
13948 INTEGER APTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I, IAM,
13949 $ IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC, ISIZE, ISTART,
13950 $ ISTOP, ITC, ITC1, ITC2, ITO, ITR, ITR1, ITR2, J, K, LDA,
13951 $ LDADST, LDASRC, M, MAXERR, MYCOL, MYROW, N, NERR, NFAIL,
13952 $ npcol, nprow, nskip, preaptr, rdest, rdest2, setwhat,
13954 DOUBLE COMPLEX CHECKVAL
13960 checkval = dcmplx( -9.11d0, -9.21d0 )
13962 checkval = iam * checkval
13963 isize = ibtsizeof(
'I')
13964 zsize = ibtsizeof(
'Z')
13968 IF( iam .EQ. 0 )
THEN
13969 WRITE(outnum, *)
' '
13970 WRITE(outnum, *)
' '
13971 WRITE(outnum, 1000 )
13972 IF( verb .GT. 0 )
THEN
13973 WRITE(outnum,*)
' '
13974 WRITE(outnum, 2000)
'NSCOPE:', nscope
13975 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
13976 WRITE(outnum, 2000)
'TReps :', topsrepeat
13977 WRITE(outnum, 2000)
'TCohr :', topscohrnt
13978 WRITE(outnum, 2000)
'NTOP :', ntop
13979 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
13980 WRITE(outnum, 2000)
'NMAT :', nmat
13981 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
13982 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
13983 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
13984 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
13985 WRITE(outnum, 2000)
'NDEST :', ndest
13986 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
13987 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
13988 WRITE(outnum, 2000)
'NGRIDS:', ngrid
13989 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
13990 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
13991 WRITE(outnum, 2000)
'VERB :', verb
13992 WRITE(outnum,*)
' '
13994 IF( verb .GT. 1 )
THEN
13999 IF (topsrepeat.EQ.0)
THEN
14002 ELSE IF (topsrepeat.EQ.1)
THEN
14013 DO 10 ima = 1, nmat
14015 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
14016 IF( k .GT. i ) i = k
14018 maxerr = ( zsize * (memlen-i) ) / ( zsize*2 + isize*6 )
14019 IF( maxerr .LT. 1 )
THEN
14020 WRITE(outnum,*)
'ERROR: Not enough memory to run SUM tests.'
14021 CALL blacs_abort(-1, 1)
14024 erriptr = errdptr + maxerr
14032 DO 90 igr = 1, ngrid
14036 context = context0(igr)
14037 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
14038 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
14040 DO 80 isc = 1, nscope
14041 scope = scope0(isc)
14042 DO 70 ito = 1, ntop
14048 IF( lsame(top,
'M') )
THEN
14050 IF( scope .EQ.
'R' )
THEN
14051 istart = -(npcol - 1)
14053 ELSE IF (scope .EQ.
'C')
THEN
14054 istart = -(nprow - 1)
14057 istart = -(nprow*npcol - 1)
14060 ELSE IF( lsame(top,
'T') )
THEN
14063 IF( scope .EQ.
'R' )
THEN
14065 ELSE IF (scope .EQ.
'C')
THEN
14068 istop = nprow*npcol - 1
14075 DO 60 ima = 1, nmat
14078 ldasrc = ldas0(ima)
14079 ldadst = ldad0(ima)
14083 aptr = preaptr + ipre
14085 DO 50 ide = 1, ndest
14086 testnum = testnum + 1
14087 rdest2 = rdest0(ide)
14088 cdest2 = cdest0(ide)
14093 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
14097 IF (topscohrnt.EQ.0)
THEN
14100 ELSE IF (topscohrnt.EQ.1)
THEN
14113 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
14118 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
14123 IF( verb .GT. 1 )
THEN
14124 IF( iam .EQ. 0 )
THEN
14125 WRITE(outnum, 6000)
14126 $ testnum,
'RUNNING', scope, top, m, n,
14127 $ ldasrc, ldadst, rdest2, cdest2,
14136 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
14137 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
14138 $ (scope .EQ.
'A') )
THEN
14141 DO 40 itr = itr1, itr2
14142 CALL blacs_set(context, 15, itr)
14143 DO 35 itc = itc1, itc2
14144 CALL blacs_set(context, 16, itc)
14145 DO 30 j = istart, istop
14146 IF( j.EQ.0)
GOTO 30
14148 $
CALL blacs_set(context, setwhat, j)
14153 CALL zinitmat(
'G',
'-', m, n, mem(preaptr),
14154 $ lda, ipre, ipost,
14155 $ checkval, testnum,
14158 CALL zgsum2d(context, scope, top, m, n,
14159 $ mem(aptr), lda, rdest2,
14165 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
14166 $ .OR. allrcv )
THEN
14167 CALL zchkpad(
'G',
'-', m, n,
14168 $ mem(preaptr), lda, rdest,
14169 $ cdest, myrow, mycol,
14170 $ ipre, ipost, checkval,
14171 $ testnum, maxerr, nerr,
14172 $ mem(erriptr),mem(errdptr))
14173 CALL zchksum(scope, context, m, n,
14175 $ testnum, maxerr, nerr,
14176 $ mem(erriptr),mem(errdptr),
14180 CALL blacs_set(context, 16, 0)
14182 CALL blacs_set(context, 15, 0)
14184 testok = ( k .EQ. nerr )
14188 IF( verb .GT. 1 )
THEN
14190 CALL zbtcheckin(0, outnum, maxerr, nerr,
14191 $ mem(erriptr), mem(errdptr), iseed)
14192 IF( iam .EQ. 0 )
THEN
14193 IF( testok .AND. nerr.EQ.i )
THEN
14194 WRITE(outnum,6000)testnum,
'PASSED ',
14195 $ scope, top, m, n, ldasrc,
14196 $ ldadst, rdest2, cdest2,
14200 WRITE(outnum,6000)testnum,
'FAILED ',
14201 $ scope, top, m, n, ldasrc,
14202 $ ldadst, rdest2, cdest2,
14217 IF( verb .LT. 2 )
THEN
14219 CALL zbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
14220 $ mem(errdptr), iseed )
14222 IF( iam .EQ. 0 )
THEN
14223 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
14224 IF( nfail+nskip .EQ. 0 )
THEN
14225 WRITE(outnum, 7000 ) testnum
14227 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
14234 testok = allpass( (nfail.EQ.0) )
14236 1000
FORMAT(
'DOUBLE COMPLEX SUM TESTS: BEGIN.' )
14237 2000
FORMAT(1x,a7,3x,10i6)
14238 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
14240 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD ',
14241 $
'RDEST CDEST P Q')
14242 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ',
14243 $
'----- ----- ---- ----')
14244 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,6i6,2i5)
14245 7000
FORMAT(
'DOUBLE COMPLEX SUM TESTS: PASSED ALL',
14247 8000
FORMAT(
'DOUBLE COMPLEX SUM TESTS:',i5,
' TESTS;',i5,
' PASSED,',
14248 $ i5,
' SKIPPED,',i5,
' FAILED.')
14256 DOUBLE PRECISION FUNCTION zbtabs(VAL)
14258 zbtabs = abs( dble(val) ) + abs( dimag(val) )
14262 SUBROUTINE zchksum( SCOPE, ICTXT, M, N, A, LDA, TESTNUM, MAXERR,
14263 $ NERR, ERRIBUF, ERRDBUF, ISEED )
14267 INTEGER ICTXT, M, N, LDA, TESTNUM, MAXERR, NERR
14270 INTEGER ERRIBUF(6, MAXERR), ISEED(*)
14271 DOUBLE COMPLEX A(LDA,*), ERRDBUF(2, MAXERR)
14274 INTEGER IBTMYPROC, IBTNPROCS
14275 DOUBLE PRECISION DBTEPS
14276 DOUBLE COMPLEX ZBTRAN
14277 EXTERNAL IBTMYPROC, IBTNPROCS, DBTEPS, ZBTRAN
14281 INTEGER NPROCS, NPROW, NPCOL, MYROW, MYCOL, NODE, NNODES, DEST
14283 DOUBLE COMPLEX ANS, TMP
14284 DOUBLE PRECISION EPS, ERRBND, RPOSNUM, RNEGNUM, IPOSNUM, INEGNUM
14288 nprocs = ibtnprocs()
14290 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
14291 dest = myrow*nprocs + mycol
14295 IF( scope .EQ.
'R' )
THEN
14297 DO 10 i = 0, nnodes-1
14298 node = myrow * nprocs + i
14299 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
14300 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
14301 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
14302 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
14304 ELSE IF( scope .EQ.
'C' )
THEN
14306 DO 20 i = 0, nnodes-1
14307 node = i * nprocs + mycol
14308 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
14309 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
14310 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
14311 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
14314 nnodes = nprow * npcol
14315 DO 30 i = 0, nnodes-1
14316 node = (i / npcol) * nprocs + mod(i, npcol)
14317 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
14318 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
14319 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
14320 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
14331 DO 40 k = 0, nnodes-1
14332 tmp = zbtran( iseed(k*4+1) )
14333 IF( dble( tmp ) .LT. 0 )
THEN
14334 rnegnum = rnegnum + dble( tmp )
14336 rposnum = rposnum + dble( tmp )
14338 IF( dimag( tmp ) .LT. 0 )
THEN
14339 inegnum = inegnum + dimag( tmp )
14341 iposnum = iposnum + dimag( tmp )
14354 errbnd = 2 * eps * nnodes *
max( rposnum, -rnegnum )
14355 numok = ( dble(tmp) .LE. errbnd )
14356 errbnd = 2 * eps * nnodes *
max( iposnum, -inegnum )
14357 numok = numok .AND. ( dimag(tmp) .LE. errbnd )
14358 IF( .NOT.numok )
THEN
14360 IF( nerr .LE. maxerr )
THEN
14361 erribuf(1, nerr) = testnum
14362 erribuf(2, nerr) = nnodes
14363 erribuf(3, nerr) = dest
14364 erribuf(4, nerr) = i
14365 erribuf(5, nerr) = j
14366 erribuf(6, nerr) = 5
14367 errdbuf(1, nerr) = a(i,j)
14368 errdbuf(2, nerr) = ans
14381 SUBROUTINE iamxtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
14382 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
14383 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
14384 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
14393 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
14394 $ topscohrnt, topsrepeat, verb
14397 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
14398 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
14399 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
14400 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
14401 INTEGER MEM(MEMLEN)
14500 LOGICAL ALLPASS, LSAME
14501 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
14502 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
14505 EXTERNAL blacs_gridinfo, igamx2d
14509 CHARACTER*1 SCOPE, TOP
14510 LOGICAL INGRID, TESTOK, ALLRCV
14511 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
14512 $ IAM, ICHECKVAL, IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC,
14513 $ ISIZE, ISTART, ISTOP, ITC, ITC1, ITC2, ITO, ITR, ITR1,
14514 $ ITR2, J, K, LDA, LDADST, LDASRC, LDI, M, MAXERR, MYCOL,
14515 $ MYROW, N, NERR, NFAIL, NPCOL, NPROW, NSKIP, PREAPTR,
14516 $ RAPTR, RDEST, RDEST2, SETWHAT, TESTNUM, VALPTR
14525 checkval = iam * checkval
14526 isize = ibtsizeof(
'I')
14531 IF( iam .EQ. 0 )
THEN
14532 WRITE(outnum, *)
' '
14533 WRITE(outnum, *)
' '
14534 WRITE(outnum, 1000 )
14535 IF( verb .GT. 0 )
THEN
14536 WRITE(outnum,*)
' '
14537 WRITE(outnum, 2000)
'NSCOPE:', nscope
14538 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
14539 WRITE(outnum, 2000)
'TReps :', topsrepeat
14540 WRITE(outnum, 2000)
'TCohr :', topscohrnt
14541 WRITE(outnum, 2000)
'NTOP :', ntop
14542 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
14543 WRITE(outnum, 2000)
'NMAT :', nmat
14544 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
14545 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
14546 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
14547 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
14548 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
14549 WRITE(outnum, 2000)
'NDEST :', ndest
14550 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
14551 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
14552 WRITE(outnum, 2000)
'NGRIDS:', ngrid
14553 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
14554 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
14555 WRITE(outnum, 2000)
'VERB :', verb
14556 WRITE(outnum,*)
' '
14558 IF( verb .GT. 1 )
THEN
14563 IF (topsrepeat.EQ.0)
THEN
14566 ELSE IF (topsrepeat.EQ.1)
THEN
14577 DO 10 ima = 1, nmat
14579 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
14580 IF( k .GT. i ) i = k
14582 i = i + ibtnprocs()
14583 maxerr = ( isize * (memlen-i) ) / ( isize*2 + isize*6 )
14584 IF( maxerr .LT. 1 )
THEN
14585 WRITE(outnum,*)
'ERROR: Not enough memory to run MAX tests.'
14586 CALL blacs_abort(-1, 1)
14589 erriptr = errdptr + maxerr
14597 DO 90 igr = 1, ngrid
14601 context = context0(igr)
14602 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
14603 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
14605 DO 80 isc = 1, nscope
14606 scope = scope0(isc)
14607 DO 70 ito = 1, ntop
14613 IF( lsame(top,
'M') )
THEN
14615 IF( scope .EQ.
'R' )
THEN
14616 istart = -(npcol - 1)
14618 ELSE IF (scope .EQ.
'C')
THEN
14619 istart = -(nprow - 1)
14622 istart = -(nprow*npcol - 1)
14625 ELSE IF( lsame(top,
'T') )
THEN
14628 IF( scope .EQ.
'R' )
THEN
14630 ELSE IF (scope .EQ.
'C')
THEN
14633 istop = nprow*npcol - 1
14640 DO 60 ima = 1, nmat
14643 ldasrc = ldas0(ima)
14644 ldadst = ldad0(ima)
14649 aptr = preaptr + ipre
14651 DO 50 ide = 1, ndest
14652 testnum = testnum + 1
14653 rdest2 = rdest0(ide)
14654 cdest2 = cdest0(ide)
14659 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
14663 IF (topscohrnt.EQ.0)
THEN
14666 ELSE IF (topscohrnt.EQ.1)
THEN
14679 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
14684 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
14689 valptr = aptr + ipost + n * lda
14690 IF( verb .GT. 1 )
THEN
14691 IF( iam .EQ. 0 )
THEN
14692 WRITE(outnum, 6000)
14693 $ testnum,
'RUNNING', scope, top, m, n,
14694 $ ldasrc, ldadst, ldi, rdest2, cdest2,
14703 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
14704 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
14705 $ (scope .EQ.
'A') )
THEN
14708 DO 40 itr = itr1, itr2
14709 CALL blacs_set(context, 15, itr)
14710 DO 35 itc = itc1, itc2
14711 CALL blacs_set(context, 16, itc)
14712 DO 30 j = istart, istop
14713 IF( j.EQ.0)
GOTO 30
14715 $
CALL blacs_set(context, setwhat, j)
14720 CALL iinitmat(
'G',
'-', m, n, mem(preaptr),
14721 $ lda, ipre, ipost,
14722 $ checkval, testnum,
14727 IF( ldi .NE. -1 )
THEN
14728 DO 15 i = 1, n*ldi + ipre + ipost
14729 rmem(i) = icheckval
14730 cmem(i) = icheckval
14735 DO 20 i = 1, ipre+ipost
14736 rmem(i) = icheckval
14737 cmem(i) = icheckval
14743 CALL igamx2d(context, scope, top, m, n,
14744 $ mem(aptr), lda, rmem(raptr),
14745 $ cmem(captr), ldi,
14751 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
14752 $ .OR. allrcv )
THEN
14754 $ mem(preaptr), lda, rdest,
14755 $ cdest, myrow, mycol,
14756 $ ipre, ipost, checkval,
14757 $ testnum, maxerr, nerr,
14758 $ mem(erriptr),mem(errdptr))
14759 CALL ichkamx(scope, context, m, n,
14761 $ rmem(raptr), cmem(captr),
14762 $ ldi, testnum, maxerr,nerr,
14763 $ mem(erriptr),mem(errdptr),
14764 $ iseed, mem(valptr))
14765 CALL ircchk(ipre, ipost, icheckval,
14766 $ m, n, rmem, cmem, ldi,
14767 $ myrow, mycol, testnum,
14769 $ mem(erriptr), mem(errdptr))
14772 CALL blacs_set(context, 16, 0)
14774 CALL blacs_set(context, 15, 0)
14776 testok = ( k .EQ. nerr )
14780 IF( verb .GT. 1 )
THEN
14783 $ mem(erriptr), mem(errdptr), iseed)
14784 IF( iam .EQ. 0 )
THEN
14785 IF( testok .AND. nerr.EQ.i )
THEN
14786 WRITE(outnum,6000)testnum,
'PASSED ',
14787 $ scope, top, m, n, ldasrc,
14788 $ ldadst, ldi, rdest2, cdest2,
14792 WRITE(outnum,6000)testnum,
'FAILED ',
14793 $ scope, top, m, n, ldasrc,
14794 $ ldadst, ldi, rdest2, cdest2,
14809 IF( verb .LT. 2 )
THEN
14811 CALL ibtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
14812 $ mem(errdptr), iseed )
14814 IF( iam .EQ. 0 )
THEN
14815 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
14816 IF( nfail+nskip .EQ. 0 )
THEN
14817 WRITE(outnum, 7000 ) testnum
14819 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
14826 testok = allpass( (nfail.EQ.0) )
14828 1000
FORMAT(
'INTEGER AMX TESTS: BEGIN.' )
14829 2000
FORMAT(1x,a7,3x,10i6)
14830 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
14832 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
14833 $
'RDEST CDEST P Q')
14834 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
14835 $
'----- ----- ---- ----')
14836 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
14837 7000
FORMAT(
'INTEGER AMX TESTS: PASSED ALL',
14839 8000
FORMAT(
'INTEGER AMX TESTS:',i5,
' TESTS;',i5,
' PASSED,',
14840 $ i5,
' SKIPPED,',i5,
' FAILED.')
14848 SUBROUTINE ibtspcoord( SCOPE, PNUM, MYROW, MYCOL, NPCOL,
14851 INTEGER PNUM, MYROW, MYCOL, NPCOL, PROW, PCOL
14853 IF( scope .EQ.
'R' )
THEN
14856 ELSE IF( scope .EQ.
'C' )
THEN
14860 prow = pnum / npcol
14861 pcol = mod( pnum, npcol )
14869 INTEGER FUNCTION ibtspnum( SCOPE, PROW, PCOL, NPCOL )
14871 INTEGER prow, pcol, npcol
14872 if( scope .EQ.
'R' ) then
14874 ELSE IF( scope .EQ.
'C' )
THEN
14886 SUBROUTINE ircchk( IPRE, IPOST, PADVAL, M, N, RA, CA, LDI, MYROW,
14887 $ MYCOL, TESTNUM, MAXERR, NERR,
14888 $ ERRIBUF, ERRDBUF )
14891 INTEGER IPRE, IPOST, PADVAL, M, N, LDI, MYROW, MYCOL, TESTNUM
14892 INTEGER MAXERR, NERR
14895 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR)
14896 INTEGER ERRDBUF(2, MAXERR)
14899 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
14900 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
14901 parameter( err_mat = 5 )
14908 INTEGER I, J, K, IAM
14912 iam = myrow * ibtnprocs() + mycol
14916 IF( ldi .NE. -1 )
THEN
14917 IF( ipre .GT. 0 )
THEN
14919 IF( ra(i) .NE. padval )
THEN
14921 IF( nerr .LE. maxerr )
THEN
14922 erribuf(1, nerr) = testnum
14923 erribuf(2, nerr) = ldi
14924 erribuf(3, nerr) = iam
14925 erribuf(4, nerr) = i
14926 erribuf(5, nerr) = ipre - i + 1
14927 erribuf(6, nerr) = -err_pre
14928 errdbuf(1, nerr) = int( ra(i) )
14929 errdbuf(2, nerr) = int( padval )
14932 IF( ca(i) .NE. padval )
THEN
14934 IF( nerr .LE. maxerr )
THEN
14935 erribuf(1, nerr) = testnum
14936 erribuf(2, nerr) = ldi
14937 erribuf(3, nerr) = iam
14938 erribuf(4, nerr) = i
14939 erribuf(5, nerr) = ipre - i + 1
14940 erribuf(6, nerr) = -10 - err_pre
14941 errdbuf(1, nerr) = int( ca(i) )
14942 errdbuf(2, nerr) = int( padval )
14950 IF( ipost .GT. 0 )
THEN
14952 DO 20 i = k+1, k+ipost
14953 IF( ra(i) .NE. padval )
THEN
14955 IF( nerr .LE. maxerr )
THEN
14956 erribuf(1, nerr) = testnum
14957 erribuf(2, nerr) = ldi
14958 erribuf(3, nerr) = iam
14959 erribuf(4, nerr) = i - k
14960 erribuf(5, nerr) = i
14961 erribuf(6, nerr) = -err_post
14962 errdbuf(1, nerr) = int( ra(i) )
14963 errdbuf(2, nerr) = int( padval )
14966 IF( ca(i) .NE. padval )
THEN
14968 IF( nerr .LE. maxerr )
THEN
14969 erribuf(1, nerr) = testnum
14970 erribuf(2, nerr) = ldi
14971 erribuf(3, nerr) = iam
14972 erribuf(4, nerr) = i - k
14973 erribuf(5, nerr) = i
14974 erribuf(6, nerr) = -10 - err_post
14975 errdbuf(1, nerr) = int( ca(i) )
14976 errdbuf(2, nerr) = int( padval )
14984 IF( ldi .GT. m )
THEN
14988 k = ipre + (j-1)*ldi + i
14989 IF( ra(k) .NE. padval)
THEN
14991 IF( nerr .LE. maxerr )
THEN
14992 erribuf(1, nerr) = testnum
14993 erribuf(2, nerr) = ldi
14994 erribuf(3, nerr) = iam
14995 erribuf(4, nerr) = i
14996 erribuf(5, nerr) = j
14997 erribuf(6, nerr) = -err_gap
14998 errdbuf(1, nerr) = int( ra(k) )
14999 errdbuf(2, nerr) = int( padval )
15002 IF( ca(k) .NE. padval)
THEN
15004 IF( nerr .LE. maxerr )
THEN
15005 erribuf(1, nerr) = testnum
15006 erribuf(2, nerr) = ldi
15007 erribuf(3, nerr) = iam
15008 erribuf(4, nerr) = i
15009 erribuf(5, nerr) = j
15010 erribuf(6, nerr) = -10 - err_gap
15011 errdbuf(1, nerr) = int( ca(k) )
15012 errdbuf(2, nerr) = int( padval )
15022 DO 50 i = 1, ipre+ipost
15023 IF( ra(i) .NE. padval)
THEN
15025 IF( nerr .LE. maxerr )
THEN
15026 erribuf(1, nerr) = testnum
15027 erribuf(2, nerr) = ldi
15028 erribuf(3, nerr) = iam
15029 erribuf(4, nerr) = i
15030 erribuf(5, nerr) = ipre+ipost
15031 erribuf(6, nerr) = -err_pre
15032 errdbuf(1, nerr) = int( ra(i) )
15033 errdbuf(2, nerr) = int( padval )
15036 IF( ca(i) .NE. padval)
THEN
15038 IF( nerr .LE. maxerr )
THEN
15039 erribuf(1, nerr) = testnum
15040 erribuf(2, nerr) = ldi
15041 erribuf(3, nerr) = iam
15042 erribuf(4, nerr) = i
15043 erribuf(5, nerr) = ipre+ipost
15044 erribuf(6, nerr) = -10 - err_pre
15045 errdbuf(1, nerr) = int( ca(i) )
15046 errdbuf(2, nerr) = int( padval )
15055 SUBROUTINE ichkamx( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
15056 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
15061 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
15064 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
15065 INTEGER A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
15068 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM, IBTRAN, IBTABS
15069 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, ibtran
15077 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
15078 INTEGER IAMX, I, J, K, H, DEST, NODE
15082 nprocs = ibtnprocs()
15083 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
15084 dest = myrow*nprocs + mycol
15088 IF( scope .EQ.
'R' )
THEN
15090 DO 10 i = 0, nnodes-1
15091 node = myrow * nprocs + i
15092 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15093 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15094 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15095 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15097 ELSE IF( scope .EQ.
'C' )
THEN
15099 DO 20 i = 0, nnodes-1
15100 node = i * nprocs + mycol
15101 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15102 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15103 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15104 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15107 nnodes = nprow * npcol
15108 DO 30 i = 0, nnodes-1
15109 node = (i / npcol) * nprocs + mod(i, npcol)
15110 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15111 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15112 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15113 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15120 vals(1) = ibtran( iseed )
15122 IF( nnodes .GT. 1 )
THEN
15123 DO 40 k = 1, nnodes-1
15124 vals(k+1) = ibtran( iseed(k*4+1) )
15125 IF( ibtabs( vals(k+1) ) .GT. ibtabs( vals(iamx) ) )
15132 IF( a(i,j) .NE. vals(iamx) )
THEN
15136 IF( ldi .NE. -1 )
THEN
15140 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
15141 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
15142 error = ibtabs( vals(k) ).NE.ibtabs( vals(iamx) )
15143 IF( .NOT.error ) iamx = k
15152 error = ( ibtabs( a(i,j) ) .NE. ibtabs( vals(iamx) ) )
15153 IF( .NOT.error )
THEN
15154 DO 50 k = 1, nnodes
15155 IF( vals(k) .EQ. a(i,j) )
GOTO 60
15166 erribuf(1, nerr) = testnum
15167 erribuf(2, nerr) = nnodes
15168 erribuf(3, nerr) = dest
15169 erribuf(4, nerr) = i
15170 erribuf(5, nerr) = j
15171 erribuf(6, nerr) = 5
15172 errdbuf(1, nerr) = a(i,j)
15173 errdbuf(2, nerr) = vals(iamx)
15179 IF( ldi .NE. -1 )
THEN
15180 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
15181 IF( k.NE.iamx )
THEN
15187 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
15190 error = ( vals(k) .NE. vals(iamx) )
15193 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
15194 $ npcol, ramx, camx )
15195 IF( ramx .NE. ra(h) )
THEN
15197 erribuf(1, nerr) = testnum
15198 erribuf(2, nerr) = nnodes
15199 erribuf(3, nerr) = dest
15200 erribuf(4, nerr) = i
15201 erribuf(5, nerr) = j
15202 erribuf(6, nerr) = -5
15203 errdbuf(1, nerr) = ra(h)
15204 errdbuf(2, nerr) = ramx
15206 IF( camx .NE. ca(h) )
THEN
15208 erribuf(1, nerr) = testnum
15209 erribuf(2, nerr) = nnodes
15210 erribuf(3, nerr) = dest
15211 erribuf(4, nerr) = i
15212 erribuf(5, nerr) = j
15213 erribuf(6, nerr) = -15
15214 errdbuf(1, nerr) = ca(h)
15215 errdbuf(2, nerr) = camx
15230 SUBROUTINE samxtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
15231 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
15232 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
15233 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
15242 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
15243 $ topscohrnt, topsrepeat, verb
15246 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
15247 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
15248 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
15249 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
15349 LOGICAL ALLPASS, LSAME
15350 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
15351 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
15354 EXTERNAL BLACS_GRIDINFO, SGAMX2D
15355 EXTERNAL SINITMAT, SCHKPAD, SBTCHECKIN
15358 CHARACTER*1 SCOPE, TOP
15359 LOGICAL INGRID, TESTOK, ALLRCV
15360 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
15361 $ iam, icheckval, ide, igr, ima, ipad, ipost, ipre, isc,
15362 $ isize, istart, istop, itc, itc1, itc2, ito, itr, itr1,
15363 $ itr2, j, k, lda, ldadst, ldasrc, ldi, m, maxerr, mycol,
15364 $ myrow, n, nerr, nfail, npcol, nprow, nskip, preaptr,
15365 $ raptr, rdest, rdest2, setwhat, ssize, testnum, valptr
15374 checkval = iam * checkval
15375 isize = ibtsizeof(
'I')
15376 ssize = ibtsizeof(
'S')
15381 IF( iam .EQ. 0 )
THEN
15382 WRITE(outnum, *)
' '
15383 WRITE(outnum, *)
' '
15384 WRITE(outnum, 1000 )
15385 IF( verb .GT. 0 )
THEN
15386 WRITE(outnum,*)
' '
15387 WRITE(outnum, 2000)
'NSCOPE:', nscope
15388 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
15389 WRITE(outnum, 2000)
'TReps :', topsrepeat
15390 WRITE(outnum, 2000)
'TCohr :', topscohrnt
15391 WRITE(outnum, 2000)
'NTOP :', ntop
15392 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
15393 WRITE(outnum, 2000)
'NMAT :', nmat
15394 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
15395 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
15396 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
15397 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
15398 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
15399 WRITE(outnum, 2000)
'NDEST :', ndest
15400 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
15401 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
15402 WRITE(outnum, 2000)
'NGRIDS:', ngrid
15403 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
15404 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
15405 WRITE(outnum, 2000)
'VERB :', verb
15406 WRITE(outnum,*)
' '
15408 IF( verb .GT. 1 )
THEN
15413 IF (topsrepeat.EQ.0)
THEN
15416 ELSE IF (topsrepeat.EQ.1)
THEN
15427 DO 10 ima = 1, nmat
15429 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
15430 IF( k .GT. i ) i = k
15432 i = i + ibtnprocs()
15433 maxerr = ( ssize * (memlen-i) ) / ( ssize*2 + isize*6 )
15434 IF( maxerr .LT. 1 )
THEN
15435 WRITE(outnum,*)
'ERROR: Not enough memory to run MAX tests.'
15436 CALL blacs_abort(-1, 1)
15439 erriptr = errdptr + maxerr
15447 DO 90 igr = 1, ngrid
15451 context = context0(igr)
15452 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
15453 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
15455 DO 80 isc = 1, nscope
15456 scope = scope0(isc)
15457 DO 70 ito = 1, ntop
15463 IF( lsame(top,
'M') )
THEN
15465 IF( scope .EQ.
'R' )
THEN
15466 istart = -(npcol - 1)
15468 ELSE IF (scope .EQ.
'C')
THEN
15469 istart = -(nprow - 1)
15472 istart = -(nprow*npcol - 1)
15475 ELSE IF( lsame(top,
'T') )
THEN
15478 IF( scope .EQ.
'R' )
THEN
15480 ELSE IF (scope .EQ.
'C')
THEN
15483 istop = nprow*npcol - 1
15490 DO 60 ima = 1, nmat
15493 ldasrc = ldas0(ima)
15494 ldadst = ldad0(ima)
15499 aptr = preaptr + ipre
15501 DO 50 ide = 1, ndest
15502 testnum = testnum + 1
15503 rdest2 = rdest0(ide)
15504 cdest2 = cdest0(ide)
15509 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
15513 IF (topscohrnt.EQ.0)
THEN
15516 ELSE IF (topscohrnt.EQ.1)
THEN
15529 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
15534 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
15539 valptr = aptr + ipost + n * lda
15540 IF( verb .GT. 1 )
THEN
15541 IF( iam .EQ. 0 )
THEN
15542 WRITE(outnum, 6000)
15543 $ testnum,
'RUNNING', scope, top, m, n,
15544 $ ldasrc, ldadst, ldi, rdest2, cdest2,
15553 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
15554 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
15555 $ (scope .EQ.
'A') )
THEN
15558 DO 40 itr = itr1, itr2
15559 CALL blacs_set(context, 15, itr)
15560 DO 35 itc = itc1, itc2
15561 CALL blacs_set(context, 16, itc)
15562 DO 30 j = istart, istop
15563 IF( j.EQ.0)
GOTO 30
15565 $
CALL blacs_set(context, setwhat, j)
15570 CALL sinitmat(
'G',
'-', m, n, mem(preaptr),
15571 $ lda, ipre, ipost,
15572 $ checkval, testnum,
15577 IF( ldi .NE. -1 )
THEN
15578 DO 15 i = 1, n*ldi + ipre + ipost
15579 rmem(i) = icheckval
15580 cmem(i) = icheckval
15585 DO 20 i = 1, ipre+ipost
15586 rmem(i) = icheckval
15587 cmem(i) = icheckval
15593 CALL sgamx2d(context, scope, top, m, n,
15594 $ mem(aptr), lda, rmem(raptr),
15595 $ cmem(captr), ldi,
15601 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
15602 $ .OR. allrcv )
THEN
15603 CALL schkpad(
'G',
'-', m, n,
15604 $ mem(preaptr), lda, rdest,
15605 $ cdest, myrow, mycol,
15606 $ ipre, ipost, checkval,
15607 $ testnum, maxerr, nerr,
15608 $ mem(erriptr),mem(errdptr))
15609 CALL schkamx(scope, context, m, n,
15611 $ rmem(raptr), cmem(captr),
15612 $ ldi, testnum, maxerr,nerr,
15613 $ mem(erriptr),mem(errdptr),
15614 $ iseed, mem(valptr))
15615 CALL srcchk(ipre, ipost, icheckval,
15616 $ m, n, rmem, cmem, ldi,
15617 $ myrow, mycol, testnum,
15619 $ mem(erriptr), mem(errdptr))
15622 CALL blacs_set(context, 16, 0)
15624 CALL blacs_set(context, 15, 0)
15626 testok = ( k .EQ. nerr )
15630 IF( verb .GT. 1 )
THEN
15632 CALL sbtcheckin(0, outnum, maxerr, nerr,
15633 $ mem(erriptr), mem(errdptr), iseed)
15634 IF( iam .EQ. 0 )
THEN
15635 IF( testok .AND. nerr.EQ.i )
THEN
15636 WRITE(outnum,6000)testnum,
'PASSED ',
15637 $ scope, top, m, n, ldasrc,
15638 $ ldadst, ldi, rdest2, cdest2,
15642 WRITE(outnum,6000)testnum,
'FAILED ',
15643 $ scope, top, m, n, ldasrc,
15644 $ ldadst, ldi, rdest2, cdest2,
15659 IF( verb .LT. 2 )
THEN
15661 CALL sbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
15662 $ mem(errdptr), iseed )
15664 IF( iam .EQ. 0 )
THEN
15665 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
15666 IF( nfail+nskip .EQ. 0 )
THEN
15667 WRITE(outnum, 7000 ) testnum
15669 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
15676 testok = allpass( (nfail.EQ.0) )
15678 1000
FORMAT(
'REAL AMX TESTS: BEGIN.' )
15679 2000
FORMAT(1x,a7,3x,10i6)
15680 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
15682 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
15683 $
'RDEST CDEST P Q')
15684 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
15685 $
'----- ----- ---- ----')
15686 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
15687 7000
FORMAT(
'REAL AMX TESTS: PASSED ALL',
15689 8000
FORMAT(
'REAL AMX TESTS:',i5,
' TESTS;',i5,
' PASSED,',
15690 $ i5,
' SKIPPED,',i5,
' FAILED.')
15698 SUBROUTINE srcchk( IPRE, IPOST, PADVAL, M, N, RA, CA, LDI, MYROW,
15699 $ MYCOL, TESTNUM, MAXERR, NERR,
15700 $ ERRIBUF, ERRDBUF )
15703 INTEGER IPRE, IPOST, PADVAL, M, N, LDI, MYROW, MYCOL, TESTNUM
15704 INTEGER MAXERR, NERR
15707 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR)
15708 REAL ERRDBUF(2, MAXERR)
15711 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
15712 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
15713 parameter( err_mat = 5 )
15720 INTEGER I, J, K, IAM
15724 iam = myrow * ibtnprocs() + mycol
15728 IF( ldi .NE. -1 )
THEN
15729 IF( ipre .GT. 0 )
THEN
15731 IF( ra(i) .NE. padval )
THEN
15733 IF( nerr .LE. maxerr )
THEN
15734 erribuf(1, nerr) = testnum
15735 erribuf(2, nerr) = ldi
15736 erribuf(3, nerr) = iam
15737 erribuf(4, nerr) = i
15738 erribuf(5, nerr) = ipre - i + 1
15739 erribuf(6, nerr) = -err_pre
15740 errdbuf(1, nerr) = real( ra(i) )
15741 errdbuf(2, nerr) = real( padval )
15744 IF( ca(i) .NE. padval )
THEN
15746 IF( nerr .LE. maxerr )
THEN
15747 erribuf(1, nerr) = testnum
15748 erribuf(2, nerr) = ldi
15749 erribuf(3, nerr) = iam
15750 erribuf(4, nerr) = i
15751 erribuf(5, nerr) = ipre - i + 1
15752 erribuf(6, nerr) = -10 - err_pre
15753 errdbuf(1, nerr) = real( ca(i) )
15754 errdbuf(2, nerr) = real( padval )
15762 IF( ipost .GT. 0 )
THEN
15764 DO 20 i = k+1, k+ipost
15765 IF( ra(i) .NE. padval )
THEN
15767 IF( nerr .LE. maxerr )
THEN
15768 erribuf(1, nerr) = testnum
15769 erribuf(2, nerr) = ldi
15770 erribuf(3, nerr) = iam
15771 erribuf(4, nerr) = i - k
15772 erribuf(5, nerr) = i
15773 erribuf(6, nerr) = -err_post
15774 errdbuf(1, nerr) = real( ra(i) )
15775 errdbuf(2, nerr) = real( padval )
15778 IF( ca(i) .NE. padval )
THEN
15780 IF( nerr .LE. maxerr )
THEN
15781 erribuf(1, nerr) = testnum
15782 erribuf(2, nerr) = ldi
15783 erribuf(3, nerr) = iam
15784 erribuf(4, nerr) = i - k
15785 erribuf(5, nerr) = i
15786 erribuf(6, nerr) = -10 - err_post
15787 errdbuf(1, nerr) = real( ca(i) )
15788 errdbuf(2, nerr) = real( padval )
15796 IF( ldi .GT. m )
THEN
15800 k = ipre + (j-1)*ldi + i
15801 IF( ra(k) .NE. padval)
THEN
15803 IF( nerr .LE. maxerr )
THEN
15804 erribuf(1, nerr) = testnum
15805 erribuf(2, nerr) = ldi
15806 erribuf(3, nerr) = iam
15807 erribuf(4, nerr) = i
15808 erribuf(5, nerr) = j
15809 erribuf(6, nerr) = -err_gap
15810 errdbuf(1, nerr) = real( ra(k) )
15811 errdbuf(2, nerr) = real( padval )
15814 IF( ca(k) .NE. padval)
THEN
15816 IF( nerr .LE. maxerr )
THEN
15817 erribuf(1, nerr) = testnum
15818 erribuf(2, nerr) = ldi
15819 erribuf(3, nerr) = iam
15820 erribuf(4, nerr) = i
15821 erribuf(5, nerr) = j
15822 erribuf(6, nerr) = -10 - err_gap
15823 errdbuf(1, nerr) = real( ca(k) )
15824 errdbuf(2, nerr) = real( padval )
15834 DO 50 i = 1, ipre+ipost
15835 IF( ra(i) .NE. padval)
THEN
15837 IF( nerr .LE. maxerr )
THEN
15838 erribuf(1, nerr) = testnum
15839 erribuf(2, nerr) = ldi
15840 erribuf(3, nerr) = iam
15841 erribuf(4, nerr) = i
15842 erribuf(5, nerr) = ipre+ipost
15843 erribuf(6, nerr) = -err_pre
15844 errdbuf(1, nerr) = real( ra(i) )
15845 errdbuf(2, nerr) = real( padval )
15848 IF( ca(i) .NE. padval)
THEN
15850 IF( nerr .LE. maxerr )
THEN
15851 erribuf(1, nerr) = testnum
15852 erribuf(2, nerr) = ldi
15853 erribuf(3, nerr) = iam
15854 erribuf(4, nerr) = i
15855 erribuf(5, nerr) = ipre+ipost
15856 erribuf(6, nerr) = -10 - err_pre
15857 errdbuf(1, nerr) = real( ca(i) )
15858 errdbuf(2, nerr) = real( padval )
15867 SUBROUTINE schkamx( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
15868 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
15873 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
15876 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
15877 REAL A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
15880 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
15881 REAL SBTEPS, SBTABS
15883 EXTERNAL IBTMYPROC, IBTNPROCS, IBTSPNUM, SBTRAN, SBTEPS, SBTABS
15890 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
15891 INTEGER IAMX, I, J, K, H, DEST, NODE
15896 nprocs = ibtnprocs()
15898 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
15899 dest = myrow*nprocs + mycol
15903 IF( scope .EQ.
'R' )
THEN
15905 DO 10 i = 0, nnodes-1
15906 node = myrow * nprocs + i
15907 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15908 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15909 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15910 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15912 ELSE IF( scope .EQ.
'C' )
THEN
15914 DO 20 i = 0, nnodes-1
15915 node = i * nprocs + mycol
15916 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15917 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15918 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15919 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15922 nnodes = nprow * npcol
15923 DO 30 i = 0, nnodes-1
15924 node = (i / npcol) * nprocs + mod(i, npcol)
15925 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
15926 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
15927 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
15928 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
15935 vals(1) = sbtran( iseed )
15937 IF( nnodes .GT. 1 )
THEN
15938 DO 40 k = 1, nnodes-1
15939 vals(k+1) = sbtran( iseed(k*4+1) )
15940 IF( sbtabs( vals(k+1) ) .GT. sbtabs( vals(iamx) ) )
15947 IF( a(i,j) .NE. vals(iamx) )
THEN
15951 IF( ldi .NE. -1 )
THEN
15955 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
15956 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
15957 error = sbtabs( vals(k) ).NE.sbtabs( vals(iamx) )
15958 IF( .NOT.error ) iamx = k
15967 error = ( sbtabs( a(i,j) ) .NE. sbtabs( vals(iamx) ) )
15968 IF( .NOT.error )
THEN
15969 DO 50 k = 1, nnodes
15970 IF( vals(k) .EQ. a(i,j) )
GOTO 60
15981 erribuf(1, nerr) = testnum
15982 erribuf(2, nerr) = nnodes
15983 erribuf(3, nerr) = dest
15984 erribuf(4, nerr) = i
15985 erribuf(5, nerr) = j
15986 erribuf(6, nerr) = 5
15987 errdbuf(1, nerr) = a(i,j)
15988 errdbuf(2, nerr) = vals(iamx)
15994 IF( ldi .NE. -1 )
THEN
15995 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
15996 IF( k.NE.iamx )
THEN
16002 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
16005 error = ( vals(k) .NE. vals(iamx) )
16008 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
16009 $ npcol, ramx, camx )
16010 IF( ramx .NE. ra(h) )
THEN
16012 erribuf(1, nerr) = testnum
16013 erribuf(2, nerr) = nnodes
16014 erribuf(3, nerr) = dest
16015 erribuf(4, nerr) = i
16016 erribuf(5, nerr) = j
16017 erribuf(6, nerr) = -5
16018 errdbuf(1, nerr) = ra(h)
16019 errdbuf(2, nerr) = ramx
16021 IF( camx .NE. ca(h) )
THEN
16023 erribuf(1, nerr) = testnum
16024 erribuf(2, nerr) = nnodes
16025 erribuf(3, nerr) = dest
16026 erribuf(4, nerr) = i
16027 erribuf(5, nerr) = j
16028 erribuf(6, nerr) = -15
16029 errdbuf(1, nerr) = ca(h)
16030 errdbuf(2, nerr) = camx
16045 SUBROUTINE damxtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
16046 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
16047 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
16048 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
16057 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
16058 $ TOPSCOHRNT, TOPSREPEAT, VERB
16061 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
16062 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
16063 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
16064 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
16065 DOUBLE PRECISION MEM(MEMLEN)
16164 LOGICAL ALLPASS, LSAME
16165 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
16166 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
16169 EXTERNAL blacs_gridinfo, dgamx2d
16173 CHARACTER*1 SCOPE, TOP
16174 LOGICAL INGRID, TESTOK, ALLRCV
16175 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, DSIZE, ERRDPTR,
16176 $ ERRIPTR, I, IAM, ICHECKVAL, IDE, IGR, IMA, IPAD, IPOST,
16177 $ IPRE, ISC, ISIZE, ISTART, ISTOP, ITC, ITC1, ITC2, ITO,
16178 $ ITR, ITR1, ITR2, J, K, LDA, LDADST, LDASRC, LDI, M,
16179 $ MAXERR, MYCOL, MYROW, N, NERR, NFAIL, NPCOL, NPROW, NSKIP,
16180 $ PREAPTR, RAPTR, RDEST, RDEST2, SETWHAT, TESTNUM, VALPTR
16181 DOUBLE PRECISION CHECKVAL
16189 checkval = iam * checkval
16190 isize = ibtsizeof(
'I')
16191 dsize = ibtsizeof(
'D')
16196 IF( iam .EQ. 0 )
THEN
16197 WRITE(outnum, *)
' '
16198 WRITE(outnum, *)
' '
16199 WRITE(outnum, 1000 )
16200 IF( verb .GT. 0 )
THEN
16201 WRITE(outnum,*)
' '
16202 WRITE(outnum, 2000)
'NSCOPE:', nscope
16203 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
16204 WRITE(outnum, 2000)
'TReps :', topsrepeat
16205 WRITE(outnum, 2000)
'TCohr :', topscohrnt
16206 WRITE(outnum, 2000)
'NTOP :', ntop
16207 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
16208 WRITE(outnum, 2000)
'NMAT :', nmat
16209 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
16210 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
16211 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
16212 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
16213 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
16214 WRITE(outnum, 2000)
'NDEST :', ndest
16215 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
16216 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
16217 WRITE(outnum, 2000)
'NGRIDS:', ngrid
16218 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
16219 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
16220 WRITE(outnum, 2000)
'VERB :', verb
16221 WRITE(outnum,*)
' '
16223 IF( verb .GT. 1 )
THEN
16228 IF (topsrepeat.EQ.0)
THEN
16231 ELSE IF (topsrepeat.EQ.1)
THEN
16242 DO 10 ima = 1, nmat
16244 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
16245 IF( k .GT. i ) i = k
16247 i = i + ibtnprocs()
16248 maxerr = ( dsize * (memlen-i) ) / ( dsize*2 + isize*6 )
16249 IF( maxerr .LT. 1 )
THEN
16250 WRITE(outnum,*)
'ERROR: Not enough memory to run MAX tests.'
16251 CALL blacs_abort(-1, 1)
16254 erriptr = errdptr + maxerr
16262 DO 90 igr = 1, ngrid
16266 context = context0(igr)
16267 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
16268 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
16270 DO 80 isc = 1, nscope
16271 scope = scope0(isc)
16272 DO 70 ito = 1, ntop
16278 IF( lsame(top,
'M') )
THEN
16280 IF( scope .EQ.
'R' )
THEN
16281 istart = -(npcol - 1)
16283 ELSE IF (scope .EQ.
'C')
THEN
16284 istart = -(nprow - 1)
16287 istart = -(nprow*npcol - 1)
16290 ELSE IF( lsame(top,
'T') )
THEN
16293 IF( scope .EQ.
'R' )
THEN
16295 ELSE IF (scope .EQ.
'C')
THEN
16298 istop = nprow*npcol - 1
16305 DO 60 ima = 1, nmat
16308 ldasrc = ldas0(ima)
16309 ldadst = ldad0(ima)
16314 aptr = preaptr + ipre
16316 DO 50 ide = 1, ndest
16317 testnum = testnum + 1
16318 rdest2 = rdest0(ide)
16319 cdest2 = cdest0(ide)
16324 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
16328 IF (topscohrnt.EQ.0)
THEN
16331 ELSE IF (topscohrnt.EQ.1)
THEN
16344 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
16349 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
16354 valptr = aptr + ipost + n * lda
16355 IF( verb .GT. 1 )
THEN
16356 IF( iam .EQ. 0 )
THEN
16357 WRITE(outnum, 6000)
16358 $ testnum,
'RUNNING', scope, top, m, n,
16359 $ ldasrc, ldadst, ldi, rdest2, cdest2,
16368 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
16369 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
16370 $ (scope .EQ.
'A') )
THEN
16373 DO 40 itr = itr1, itr2
16374 CALL blacs_set(context, 15, itr)
16375 DO 35 itc = itc1, itc2
16376 CALL blacs_set(context, 16, itc)
16377 DO 30 j = istart, istop
16378 IF( j.EQ.0)
GOTO 30
16380 $
CALL blacs_set(context, setwhat, j)
16385 CALL dinitmat(
'G',
'-', m, n, mem(preaptr),
16386 $ lda, ipre, ipost,
16387 $ checkval, testnum,
16392 IF( ldi .NE. -1 )
THEN
16393 DO 15 i = 1, n*ldi + ipre + ipost
16394 rmem(i) = icheckval
16395 cmem(i) = icheckval
16400 DO 20 i = 1, ipre+ipost
16401 rmem(i) = icheckval
16402 cmem(i) = icheckval
16408 CALL dgamx2d(context, scope, top, m, n,
16409 $ mem(aptr), lda, rmem(raptr),
16410 $ cmem(captr), ldi,
16416 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
16417 $ .OR. allrcv )
THEN
16419 $ mem(preaptr), lda, rdest,
16420 $ cdest, myrow, mycol,
16421 $ ipre, ipost, checkval,
16422 $ testnum, maxerr, nerr,
16423 $ mem(erriptr),mem(errdptr))
16424 CALL dchkamx(scope, context, m, n,
16426 $ rmem(raptr), cmem(captr),
16427 $ ldi, testnum, maxerr,nerr,
16428 $ mem(erriptr),mem(errdptr),
16429 $ iseed, mem(valptr))
16430 CALL drcchk(ipre, ipost, icheckval,
16431 $ m, n, rmem, cmem, ldi,
16432 $ myrow, mycol, testnum,
16434 $ mem(erriptr), mem(errdptr))
16437 CALL blacs_set(context, 16, 0)
16439 CALL blacs_set(context, 15, 0)
16441 testok = ( k .EQ. nerr )
16445 IF( verb .GT. 1 )
THEN
16448 $ mem(erriptr), mem(errdptr), iseed)
16449 IF( iam .EQ. 0 )
THEN
16450 IF( testok .AND. nerr.EQ.i )
THEN
16451 WRITE(outnum,6000)testnum,
'PASSED ',
16452 $ scope, top, m, n, ldasrc,
16453 $ ldadst, ldi, rdest2, cdest2,
16457 WRITE(outnum,6000)testnum,
'FAILED ',
16458 $ scope, top, m, n, ldasrc,
16459 $ ldadst, ldi, rdest2, cdest2,
16474 IF( verb .LT. 2 )
THEN
16476 CALL dbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
16477 $ mem(errdptr), iseed )
16479 IF( iam .EQ. 0 )
THEN
16480 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
16481 IF( nfail+nskip .EQ. 0 )
THEN
16482 WRITE(outnum, 7000 ) testnum
16484 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
16491 testok = allpass( (nfail.EQ.0) )
16493 1000
FORMAT(
'DOUBLE PRECISION AMX TESTS: BEGIN.' )
16494 2000
FORMAT(1x,a7,3x,10i6)
16495 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
16497 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
16498 $
'RDEST CDEST P Q')
16499 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
16500 $
'----- ----- ---- ----')
16501 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
16502 7000
FORMAT(
'DOUBLE PRECISION AMX TESTS: PASSED ALL',
16504 8000
FORMAT(
'DOUBLE PRECISION AMX TESTS:',i5,
' TESTS;',i5,
' PASSED,',
16505 $ i5,
' SKIPPED,',i5,
' FAILED.')
16513 SUBROUTINE drcchk( IPRE, IPOST, PADVAL, M, N, RA, CA, LDI, MYROW,
16514 $ MYCOL, TESTNUM, MAXERR, NERR,
16515 $ ERRIBUF, ERRDBUF )
16518 INTEGER IPRE, IPOST, PADVAL, M, N, LDI, MYROW, MYCOL, TESTNUM
16519 INTEGER MAXERR, NERR
16522 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR)
16523 DOUBLE PRECISION ERRDBUF(2, MAXERR)
16526 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
16527 parameter( err_pre = 1, err_post = 2, err_gap = 3, err_tri = 4 )
16528 parameter( err_mat = 5 )
16535 INTEGER I, J, K, IAM
16539 iam = myrow * ibtnprocs() + mycol
16543 IF( ldi .NE. -1 )
THEN
16544 IF( ipre .GT. 0 )
THEN
16546 IF( ra(i) .NE. padval )
THEN
16548 IF( nerr .LE. maxerr )
THEN
16549 erribuf(1, nerr) = testnum
16550 erribuf(2, nerr) = ldi
16551 erribuf(3, nerr) = iam
16552 erribuf(4, nerr) = i
16553 erribuf(5, nerr) = ipre - i + 1
16554 erribuf(6, nerr) = -err_pre
16555 errdbuf(1, nerr) = dble( ra(i) )
16556 errdbuf(2, nerr) = dble( padval )
16559 IF( ca(i) .NE. padval )
THEN
16561 IF( nerr .LE. maxerr )
THEN
16562 erribuf(1, nerr) = testnum
16563 erribuf(2, nerr) = ldi
16564 erribuf(3, nerr) = iam
16565 erribuf(4, nerr) = i
16566 erribuf(5, nerr) = ipre - i + 1
16567 erribuf(6, nerr) = -10 - err_pre
16568 errdbuf(1, nerr) = dble( ca(i) )
16569 errdbuf(2, nerr) = dble( padval )
16577 IF( ipost .GT. 0 )
THEN
16579 DO 20 i = k+1, k+ipost
16580 IF( ra(i) .NE. padval )
THEN
16582 IF( nerr .LE. maxerr )
THEN
16583 erribuf(1, nerr) = testnum
16584 erribuf(2, nerr) = ldi
16585 erribuf(3, nerr) = iam
16586 erribuf(4, nerr) = i - k
16587 erribuf(5, nerr) = i
16588 erribuf(6, nerr) = -err_post
16589 errdbuf(1, nerr) = dble( ra(i) )
16590 errdbuf(2, nerr) = dble( padval )
16593 IF( ca(i) .NE. padval )
THEN
16595 IF( nerr .LE. maxerr )
THEN
16596 erribuf(1, nerr) = testnum
16597 erribuf(2, nerr) = ldi
16598 erribuf(3, nerr) = iam
16599 erribuf(4, nerr) = i - k
16600 erribuf(5, nerr) = i
16601 erribuf(6, nerr) = -10 - err_post
16602 errdbuf(1, nerr) = dble( ca(i) )
16603 errdbuf(2, nerr) = dble( padval )
16611 IF( ldi .GT. m )
THEN
16615 k = ipre + (j-1)*ldi + i
16616 IF( ra(k) .NE. padval)
THEN
16618 IF( nerr .LE. maxerr )
THEN
16619 erribuf(1, nerr) = testnum
16620 erribuf(2, nerr) = ldi
16621 erribuf(3, nerr) = iam
16622 erribuf(4, nerr) = i
16623 erribuf(5, nerr) = j
16624 erribuf(6, nerr) = -err_gap
16625 errdbuf(1, nerr) = dble( ra(k) )
16626 errdbuf(2, nerr) = dble( padval )
16629 IF( ca(k) .NE. padval)
THEN
16631 IF( nerr .LE. maxerr )
THEN
16632 erribuf(1, nerr) = testnum
16633 erribuf(2, nerr) = ldi
16634 erribuf(3, nerr) = iam
16635 erribuf(4, nerr) = i
16636 erribuf(5, nerr) = j
16637 erribuf(6, nerr) = -10 - err_gap
16638 errdbuf(1, nerr) = dble( ca(k) )
16639 errdbuf(2, nerr) = dble( padval )
16649 DO 50 i = 1, ipre+ipost
16650 IF( ra(i) .NE. padval)
THEN
16652 IF( nerr .LE. maxerr )
THEN
16653 erribuf(1, nerr) = testnum
16654 erribuf(2, nerr) = ldi
16655 erribuf(3, nerr) = iam
16656 erribuf(4, nerr) = i
16657 erribuf(5, nerr) = ipre+ipost
16658 erribuf(6, nerr) = -err_pre
16659 errdbuf(1, nerr) = dble( ra(i) )
16660 errdbuf(2, nerr) = dble( padval )
16663 IF( ca(i) .NE. padval)
THEN
16665 IF( nerr .LE. maxerr )
THEN
16666 erribuf(1, nerr) = testnum
16667 erribuf(2, nerr) = ldi
16668 erribuf(3, nerr) = iam
16669 erribuf(4, nerr) = i
16670 erribuf(5, nerr) = ipre+ipost
16671 erribuf(6, nerr) = -10 - err_pre
16672 errdbuf(1, nerr) = dble( ca(i) )
16673 errdbuf(2, nerr) = dble( padval )
16682 SUBROUTINE dchkamx( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
16683 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
16688 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
16691 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
16692 DOUBLE PRECISION A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
16695 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
16696 DOUBLE PRECISION DBTEPS, DBTABS
16697 DOUBLE PRECISION DBTRAN
16698 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, dbtran, dbteps, dbtabs
16705 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
16706 INTEGER IAMX, I, J, K, H, DEST, NODE
16707 DOUBLE PRECISION EPS
16711 nprocs = ibtnprocs()
16713 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
16714 dest = myrow*nprocs + mycol
16718 IF( scope .EQ.
'R' )
THEN
16720 DO 10 i = 0, nnodes-1
16721 node = myrow * nprocs + i
16722 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
16723 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
16724 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
16725 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
16727 ELSE IF( scope .EQ.
'C' )
THEN
16729 DO 20 i = 0, nnodes-1
16730 node = i * nprocs + mycol
16731 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
16732 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
16733 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
16734 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
16737 nnodes = nprow * npcol
16738 DO 30 i = 0, nnodes-1
16739 node = (i / npcol) * nprocs + mod(i, npcol)
16740 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
16741 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
16742 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
16743 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
16750 vals(1) = dbtran( iseed )
16752 IF( nnodes .GT. 1 )
THEN
16753 DO 40 k = 1, nnodes-1
16754 vals(k+1) = dbtran( iseed(k*4+1) )
16755 IF( dbtabs( vals(k+1) ) .GT. dbtabs( vals(iamx) ) )
16762 IF( a(i,j) .NE. vals(iamx) )
THEN
16766 IF( ldi .NE. -1 )
THEN
16770 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
16771 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
16772 error = dbtabs( vals(k) ).NE.dbtabs( vals(iamx) )
16773 IF( .NOT.error ) iamx = k
16782 error = ( dbtabs( a(i,j) ) .NE. dbtabs( vals(iamx) ) )
16783 IF( .NOT.error )
THEN
16784 DO 50 k = 1, nnodes
16785 IF( vals(k) .EQ. a(i,j) )
GOTO 60
16796 erribuf(1, nerr) = testnum
16797 erribuf(2, nerr) = nnodes
16798 erribuf(3, nerr) = dest
16799 erribuf(4, nerr) = i
16800 erribuf(5, nerr) = j
16801 erribuf(6, nerr) = 5
16802 errdbuf(1, nerr) = a(i,j)
16803 errdbuf(2, nerr) = vals(iamx)
16809 IF( ldi .NE. -1 )
THEN
16810 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
16811 IF( k.NE.iamx )
THEN
16817 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
16820 error = ( vals(k) .NE. vals(iamx) )
16823 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
16824 $ npcol, ramx, camx )
16825 IF( ramx .NE. ra(h) )
THEN
16827 erribuf(1, nerr) = testnum
16828 erribuf(2, nerr) = nnodes
16829 erribuf(3, nerr) = dest
16830 erribuf(4, nerr) = i
16831 erribuf(5, nerr) = j
16832 erribuf(6, nerr) = -5
16833 errdbuf(1, nerr) = ra(h)
16834 errdbuf(2, nerr) = ramx
16836 IF( camx .NE. ca(h) )
THEN
16838 erribuf(1, nerr) = testnum
16839 erribuf(2, nerr) = nnodes
16840 erribuf(3, nerr) = dest
16841 erribuf(4, nerr) = i
16842 erribuf(5, nerr) = j
16843 erribuf(6, nerr) = -15
16844 errdbuf(1, nerr) = ca(h)
16845 errdbuf(2, nerr) = camx
16860 SUBROUTINE camxtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
16861 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
16862 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
16863 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
16872 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
16873 $ topscohrnt, topsrepeat, verb
16876 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
16877 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
16878 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
16879 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
16880 COMPLEX MEM(MEMLEN)
16979 LOGICAL ALLPASS, LSAME
16980 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
16981 EXTERNAL allpass, lsame, ibtmyproc, ibtnprocs, ibtsizeof
16984 EXTERNAL blacs_gridinfo, cgamx2d
16988 CHARACTER*1 SCOPE, TOP
16989 LOGICAL INGRID, TESTOK, ALLRCV
16990 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, CSIZE, ERRDPTR,
16991 $ ERRIPTR, I, IAM, ICHECKVAL, IDE, IGR, IMA, IPAD, IPOST,
16992 $ ipre, isc, isize, istart, istop, itc, itc1, itc2, ito,
16993 $ itr, itr1, itr2, j, k, lda, ldadst, ldasrc, ldi, m,
16994 $ maxerr, mycol, myrow, n, nerr, nfail, npcol, nprow, nskip,
16995 $ preaptr, raptr, rdest, rdest2, setwhat, testnum, valptr
17002 CHECKVAL =
cmplx( -0.91e0, -0.71e0 )
17004 checkval = iam * checkval
17005 isize = ibtsizeof(
'I')
17006 csize = ibtsizeof(
'C')
17011 IF( iam .EQ. 0 )
THEN
17012 WRITE(outnum, *)
' '
17013 WRITE(outnum, *)
' '
17014 WRITE(outnum, 1000 )
17015 IF( verb .GT. 0 )
THEN
17016 WRITE(outnum,*)
' '
17017 WRITE(outnum, 2000)
'NSCOPE:', nscope
17018 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
17019 WRITE(outnum, 2000)
'TReps :', topsrepeat
17020 WRITE(outnum, 2000)
'TCohr :', topscohrnt
17021 WRITE(outnum, 2000)
'NTOP :', ntop
17022 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
17023 WRITE(outnum, 2000)
'NMAT :', nmat
17024 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
17025 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
17026 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
17027 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
17028 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
17029 WRITE(outnum, 2000)
'NDEST :', ndest
17030 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
17031 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
17032 WRITE(outnum, 2000)
'NGRIDS:', ngrid
17033 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
17034 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
17035 WRITE(outnum, 2000)
'VERB :', verb
17036 WRITE(outnum,*)
' '
17038 IF( verb .GT. 1 )
THEN
17043 IF (topsrepeat.EQ.0)
THEN
17046 ELSE IF (topsrepeat.EQ.1)
THEN
17057 DO 10 ima = 1, nmat
17059 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
17060 IF( k .GT. i ) i = k
17062 i = i + ibtnprocs()
17063 maxerr = ( csize * (memlen-i) ) / ( csize*2 + isize*6 )
17064 IF( maxerr .LT. 1 )
THEN
17065 WRITE(outnum,*)
'ERROR: Not enough memory to run MAX tests.'
17066 CALL blacs_abort(-1, 1)
17069 erriptr = errdptr + maxerr
17077 DO 90 igr = 1, ngrid
17081 context = context0(igr)
17082 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
17083 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
17085 DO 80 isc = 1, nscope
17086 scope = scope0(isc)
17087 DO 70 ito = 1, ntop
17093 IF( lsame(top,
'M') )
THEN
17095 IF( scope .EQ.
'R' )
THEN
17096 istart = -(npcol - 1)
17098 ELSE IF (scope .EQ.
'C')
THEN
17099 istart = -(nprow - 1)
17102 istart = -(nprow*npcol - 1)
17105 ELSE IF( lsame(top,
'T') )
THEN
17108 IF( scope .EQ.
'R' )
THEN
17110 ELSE IF (scope .EQ.
'C')
THEN
17113 istop = nprow*npcol - 1
17120 DO 60 ima = 1, nmat
17123 ldasrc = ldas0(ima)
17124 ldadst = ldad0(ima)
17129 aptr = preaptr + ipre
17131 DO 50 ide = 1, ndest
17132 testnum = testnum + 1
17133 rdest2 = rdest0(ide)
17134 cdest2 = cdest0(ide)
17139 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
17143 IF (topscohrnt.EQ.0)
THEN
17146 ELSE IF (topscohrnt.EQ.1)
THEN
17159 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
17164 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
17169 valptr = aptr + ipost + n * lda
17170 IF( verb .GT. 1 )
THEN
17171 IF( iam .EQ. 0 )
THEN
17172 WRITE(outnum, 6000)
17173 $ testnum,
'RUNNING', scope, top, m, n,
17174 $ ldasrc, ldadst, ldi, rdest2, cdest2,
17183 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
17184 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
17185 $ (scope .EQ.
'A') )
THEN
17188 DO 40 itr = itr1, itr2
17189 CALL blacs_set(context, 15, itr)
17190 DO 35 itc = itc1, itc2
17191 CALL blacs_set(context, 16, itc)
17192 DO 30 j = istart, istop
17193 IF( j.EQ.0)
GOTO 30
17195 $
CALL blacs_set(context, setwhat, j)
17200 CALL cinitmat(
'G',
'-', m, n, mem(preaptr),
17201 $ lda, ipre, ipost,
17202 $ checkval, testnum,
17207 IF( ldi .NE. -1 )
THEN
17208 DO 15 i = 1, n*ldi + ipre + ipost
17209 rmem(i) = icheckval
17210 cmem(i) = icheckval
17215 DO 20 i = 1, ipre+ipost
17216 rmem(i) = icheckval
17217 cmem(i) = icheckval
17223 CALL cgamx2d(context, scope, top, m, n,
17224 $ mem(aptr), lda, rmem(raptr),
17225 $ cmem(captr), ldi,
17231 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
17232 $ .OR. allrcv )
THEN
17234 $ mem(preaptr), lda, rdest,
17235 $ cdest, myrow, mycol,
17236 $ ipre, ipost, checkval,
17237 $ testnum, maxerr, nerr,
17238 $ mem(erriptr),mem(errdptr))
17239 CALL cchkamx(scope, context, m, n,
17241 $ rmem(raptr), cmem(captr),
17242 $ ldi, testnum, maxerr,nerr,
17243 $ mem(erriptr),mem(errdptr),
17244 $ iseed, mem(valptr))
17245 CALL crcchk(ipre, ipost, icheckval,
17246 $ m, n, rmem, cmem, ldi,
17247 $ myrow, mycol, testnum,
17249 $ mem(erriptr), mem(errdptr))
17252 CALL blacs_set(context, 16, 0)
17254 CALL blacs_set(context, 15, 0)
17256 testok = ( k .EQ. nerr )
17260 IF( verb .GT. 1 )
THEN
17263 $ mem(erriptr), mem(errdptr), iseed)
17264 IF( iam .EQ. 0 )
THEN
17265 IF( testok .AND. nerr.EQ.i )
THEN
17266 WRITE(outnum,6000)testnum,
'PASSED ',
17267 $ scope, top, m, n, ldasrc,
17268 $ ldadst, ldi, rdest2, cdest2,
17272 WRITE(outnum,6000)testnum,
'FAILED ',
17273 $ scope, top, m, n, ldasrc,
17274 $ ldadst, ldi, rdest2, cdest2,
17289 IF( verb .LT. 2 )
THEN
17291 CALL cbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
17292 $ mem(errdptr), iseed )
17294 IF( iam .EQ. 0 )
THEN
17295 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
17296 IF( nfail+nskip .EQ. 0 )
THEN
17297 WRITE(outnum, 7000 ) testnum
17299 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
17306 testok = allpass( (nfail.EQ.0) )
17308 1000
FORMAT(
'COMPLEX AMX TESTS: BEGIN.' )
17309 2000
FORMAT(1x,a7,3x,10i6)
17310 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
17312 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
17313 $
'RDEST CDEST P Q')
17314 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
17315 $
'----- ----- ---- ----')
17316 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
17317 7000
FORMAT(
'COMPLEX AMX TESTS: PASSED ALL',
17319 8000
FORMAT(
'COMPLEX AMX TESTS:',i5,
' TESTS;',i5,
' PASSED,',
17320 $ i5,
' SKIPPED,',i5,
' FAILED.')
17328 SUBROUTINE crcchk( IPRE, IPOST, PADVAL, M, N, RA, CA, LDI, MYROW,
17329 $ MYCOL, TESTNUM, MAXERR, NERR,
17330 $ ERRIBUF, ERRDBUF )
17333 INTEGER IPRE, IPOST, PADVAL, M, N, LDI, MYROW, MYCOL, TESTNUM
17334 INTEGER MAXERR, NERR
17337 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR)
17338 COMPLEX ERRDBUF(2, MAXERR)
17341 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
17342 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
17343 parameter( err_mat = 5 )
17350 INTEGER I, J, K, IAM
17354 iam = myrow * ibtnprocs() + mycol
17358 IF( ldi .NE. -1 )
THEN
17359 IF( ipre .GT. 0 )
THEN
17361 IF( ra(i) .NE. padval )
THEN
17363 IF( nerr .LE. maxerr )
THEN
17364 erribuf(1, nerr) = testnum
17365 erribuf(2, nerr) = ldi
17366 erribuf(3, nerr) = iam
17367 erribuf(4, nerr) = i
17368 erribuf(5, nerr) = ipre - i + 1
17369 erribuf(6, nerr) = -err_pre
17370 errdbuf(1, nerr) =
cmplx( ra(i) )
17371 errdbuf(2, nerr) =
cmplx( padval )
17374 IF( ca(i) .NE. padval )
THEN
17376 IF( nerr .LE. maxerr )
THEN
17377 erribuf(1, nerr) = testnum
17378 erribuf(2, nerr) = ldi
17379 erribuf(3, nerr) = iam
17380 erribuf(4, nerr) = i
17381 erribuf(5, nerr) = ipre - i + 1
17382 erribuf(6, nerr) = -10 - err_pre
17383 errdbuf(1, nerr) =
cmplx( ca(i) )
17384 errdbuf(2, nerr) =
cmplx( padval )
17392 IF( ipost .GT. 0 )
THEN
17394 DO 20 i = k+1, k+ipost
17395 IF( ra(i) .NE. padval )
THEN
17397 IF( nerr .LE. maxerr )
THEN
17398 erribuf(1, nerr) = testnum
17399 erribuf(2, nerr) = ldi
17400 erribuf(3, nerr) = iam
17401 erribuf(4, nerr) = i - k
17402 erribuf(5, nerr) = i
17403 erribuf(6, nerr) = -err_post
17404 errdbuf(1, nerr) =
cmplx( ra(i) )
17405 errdbuf(2, nerr) =
cmplx( padval )
17408 IF( ca(i) .NE. padval )
THEN
17410 IF( nerr .LE. maxerr )
THEN
17411 erribuf(1, nerr) = testnum
17412 erribuf(2, nerr) = ldi
17413 erribuf(3, nerr) = iam
17414 erribuf(4, nerr) = i - k
17415 erribuf(5, nerr) = i
17416 erribuf(6, nerr) = -10 - err_post
17417 errdbuf(1, nerr) =
cmplx( ca(i) )
17418 errdbuf(2, nerr) =
cmplx( padval )
17426 IF( ldi .GT. m )
THEN
17430 k = ipre + (j-1)*ldi + i
17431 IF( ra(k) .NE. padval)
THEN
17433 IF( nerr .LE. maxerr )
THEN
17434 erribuf(1, nerr) = testnum
17435 erribuf(2, nerr) = ldi
17436 erribuf(3, nerr) = iam
17437 erribuf(4, nerr) = i
17438 erribuf(5, nerr) = j
17439 erribuf(6, nerr) = -err_gap
17440 errdbuf(1, nerr) =
cmplx( ra(k) )
17441 errdbuf(2, nerr) =
cmplx( padval )
17444 IF( ca(k) .NE. padval)
THEN
17446 IF( nerr .LE. maxerr )
THEN
17447 erribuf(1, nerr) = testnum
17448 erribuf(2, nerr) = ldi
17449 erribuf(3, nerr) = iam
17450 erribuf(4, nerr) = i
17451 erribuf(5, nerr) = j
17452 erribuf(6, nerr) = -10 - err_gap
17453 errdbuf(1, nerr) =
cmplx( ca(k) )
17454 errdbuf(2, nerr) =
cmplx( padval )
17464 DO 50 i = 1, ipre+ipost
17465 IF( ra(i) .NE. padval)
THEN
17467 IF( nerr .LE. maxerr )
THEN
17468 erribuf(1, nerr) = testnum
17469 erribuf(2, nerr) = ldi
17470 erribuf(3, nerr) = iam
17471 erribuf(4, nerr) = i
17472 erribuf(5, nerr) = ipre+ipost
17473 erribuf(6, nerr) = -err_pre
17474 errdbuf(1, nerr) =
cmplx( ra(i) )
17475 errdbuf(2, nerr) =
cmplx( padval )
17478 IF( ca(i) .NE. padval)
THEN
17480 IF( nerr .LE. maxerr )
THEN
17481 erribuf(1, nerr) = testnum
17482 erribuf(2, nerr) = ldi
17483 erribuf(3, nerr) = iam
17484 erribuf(4, nerr) = i
17485 erribuf(5, nerr) = ipre+ipost
17486 erribuf(6, nerr) = -10 - err_pre
17487 errdbuf(1, nerr) =
cmplx( ca(i) )
17488 errdbuf(2, nerr) =
cmplx( padval )
17497 SUBROUTINE cchkamx( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
17498 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
17503 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
17506 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
17507 COMPLEX A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
17510 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
17511 REAL SBTEPS, CBTABS
17513 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, cbtran, sbteps, cbtabs
17520 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
17521 INTEGER IAMX, I, J, K, H, DEST, NODE
17526 nprocs = ibtnprocs()
17528 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
17529 dest = myrow*nprocs + mycol
17533 IF( scope .EQ.
'R' )
THEN
17535 DO 10 i = 0, nnodes-1
17536 node = myrow * nprocs + i
17537 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
17538 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
17539 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
17540 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
17542 ELSE IF( scope .EQ.
'C' )
THEN
17544 DO 20 i = 0, nnodes-1
17545 node = i * nprocs + mycol
17546 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
17547 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
17548 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
17549 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
17552 nnodes = nprow * npcol
17553 DO 30 i = 0, nnodes-1
17554 node = (i / npcol) * nprocs + mod(i, npcol)
17555 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
17556 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
17557 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
17558 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
17565 vals(1) = cbtran( iseed )
17567 IF( nnodes .GT. 1 )
THEN
17568 DO 40 k = 1, nnodes-1
17569 vals(k+1) = cbtran( iseed(k*4+1) )
17570 IF( cbtabs( vals(k+1) ) .GT. cbtabs( vals(iamx) ) )
17577 IF( a(i,j) .NE. vals(iamx) )
THEN
17581 IF( ldi .NE. -1 )
THEN
17585 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
17586 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
17587 error = abs( cbtabs(vals(k)) - cbtabs(vals(iamx)) )
17589 IF( .NOT.error ) iamx = k
17598 error = abs( cbtabs(a(i,j)) - cbtabs(vals(iamx)) )
17600 IF( .NOT.error )
THEN
17601 DO 50 k = 1, nnodes
17602 IF( vals(k) .EQ. a(i,j) )
GOTO 60
17613 erribuf(1, nerr) = testnum
17614 erribuf(2, nerr) = nnodes
17615 erribuf(3, nerr) = dest
17616 erribuf(4, nerr) = i
17617 erribuf(5, nerr) = j
17618 erribuf(6, nerr) = 5
17619 errdbuf(1, nerr) = a(i,j)
17620 errdbuf(2, nerr) = vals(iamx)
17626 IF( ldi .NE. -1 )
THEN
17627 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
17628 IF( k.NE.iamx )
THEN
17634 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
17637 error = ( vals(k) .NE. vals(iamx) )
17640 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
17641 $ npcol, ramx, camx )
17642 IF( ramx .NE. ra(h) )
THEN
17644 erribuf(1, nerr) = testnum
17645 erribuf(2, nerr) = nnodes
17646 erribuf(3, nerr) = dest
17647 erribuf(4, nerr) = i
17648 erribuf(5, nerr) = j
17649 erribuf(6, nerr) = -5
17650 errdbuf(1, nerr) = ra(h)
17651 errdbuf(2, nerr) = ramx
17653 IF( camx .NE. ca(h) )
THEN
17655 erribuf(1, nerr) = testnum
17656 erribuf(2, nerr) = nnodes
17657 erribuf(3, nerr) = dest
17658 erribuf(4, nerr) = i
17659 erribuf(5, nerr) = j
17660 erribuf(6, nerr) = -15
17661 errdbuf(1, nerr) = ca(h)
17662 errdbuf(2, nerr) = camx
17677 SUBROUTINE zamxtest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
17678 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
17679 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
17680 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
17689 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
17690 $ topscohrnt, topsrepeat, verb
17693 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
17694 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
17695 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
17696 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
17697 DOUBLE COMPLEX MEM(MEMLEN)
17796 LOGICAL ALLPASS, LSAME
17797 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
17798 EXTERNAL allpass, lsame, ibtmyproc, ibtnprocs, ibtsizeof
17801 EXTERNAL blacs_gridinfo, zgamx2d
17805 CHARACTER*1 SCOPE, TOP
17806 LOGICAL INGRID, TESTOK, ALLRCV
17807 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
17808 $ iam, icheckval, ide, igr, ima, ipad, ipost, ipre, isc,
17809 $ isize, istart, istop, itc, itc1, itc2, ito, itr, itr1,
17810 $ itr2, j, k, lda, ldadst, ldasrc, ldi, m, maxerr, mycol,
17811 $ myrow, n, nerr, nfail, npcol, nprow, nskip, preaptr,
17812 $ raptr, rdest, rdest2, setwhat, testnum, valptr, zsize
17813 DOUBLE COMPLEX CHECKVAL
17819 checkval = dcmplx( -9.11d0, -9.21d0 )
17821 checkval = iam * checkval
17822 isize = ibtsizeof(
'I')
17823 zsize = ibtsizeof(
'Z')
17828 IF( iam .EQ. 0 )
THEN
17829 WRITE(outnum, *)
' '
17830 WRITE(outnum, *)
' '
17831 WRITE(outnum, 1000 )
17832 IF( verb .GT. 0 )
THEN
17833 WRITE(outnum,*)
' '
17834 WRITE(outnum, 2000)
'NSCOPE:', nscope
17835 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
17836 WRITE(outnum, 2000)
'TReps :', topsrepeat
17837 WRITE(outnum, 2000)
'TCohr :', topscohrnt
17838 WRITE(outnum, 2000)
'NTOP :', ntop
17839 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
17840 WRITE(outnum, 2000)
'NMAT :', nmat
17841 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
17842 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
17843 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
17844 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
17845 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
17846 WRITE(outnum, 2000)
'NDEST :', ndest
17847 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
17848 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
17849 WRITE(outnum, 2000)
'NGRIDS:', ngrid
17850 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
17851 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
17852 WRITE(outnum, 2000)
'VERB :', verb
17853 WRITE(outnum,*)
' '
17855 IF( verb .GT. 1 )
THEN
17860 IF (topsrepeat.EQ.0)
THEN
17863 ELSE IF (topsrepeat.EQ.1)
THEN
17874 DO 10 ima = 1, nmat
17876 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
17877 IF( k .GT. i ) i = k
17879 i = i + ibtnprocs()
17880 maxerr = ( zsize * (memlen-i) ) / ( zsize*2 + isize*6 )
17881 IF( maxerr .LT. 1 )
THEN
17882 WRITE(outnum,*)
'ERROR: Not enough memory to run MAX tests.'
17883 CALL blacs_abort(-1, 1)
17886 erriptr = errdptr + maxerr
17894 DO 90 igr = 1, ngrid
17898 context = context0(igr)
17899 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
17900 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
17902 DO 80 isc = 1, nscope
17903 scope = scope0(isc)
17904 DO 70 ito = 1, ntop
17910 IF( lsame(top,
'M') )
THEN
17912 IF( scope .EQ.
'R' )
THEN
17913 istart = -(npcol - 1)
17915 ELSE IF (scope .EQ.
'C')
THEN
17916 istart = -(nprow - 1)
17919 istart = -(nprow*npcol - 1)
17922 ELSE IF( lsame(top,
'T') )
THEN
17925 IF( scope .EQ.
'R' )
THEN
17927 ELSE IF (scope .EQ.
'C')
THEN
17930 istop = nprow*npcol - 1
17937 DO 60 ima = 1, nmat
17940 ldasrc = ldas0(ima)
17941 ldadst = ldad0(ima)
17946 aptr = preaptr + ipre
17948 DO 50 ide = 1, ndest
17949 testnum = testnum + 1
17950 rdest2 = rdest0(ide)
17951 cdest2 = cdest0(ide)
17956 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
17960 IF (topscohrnt.EQ.0)
THEN
17963 ELSE IF (topscohrnt.EQ.1)
THEN
17976 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
17981 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
17986 valptr = aptr + ipost + n * lda
17987 IF( verb .GT. 1 )
THEN
17988 IF( iam .EQ. 0 )
THEN
17989 WRITE(outnum, 6000)
17990 $ testnum,
'RUNNING', scope, top, m, n,
17991 $ ldasrc, ldadst, ldi, rdest2, cdest2,
18000 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
18001 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
18002 $ (scope .EQ.
'A') )
THEN
18005 DO 40 itr = itr1, itr2
18006 CALL blacs_set(context, 15, itr)
18007 DO 35 itc = itc1, itc2
18008 CALL blacs_set(context, 16, itc)
18009 DO 30 j = istart, istop
18010 IF( j.EQ.0)
GOTO 30
18012 $
CALL blacs_set(context, setwhat, j)
18017 CALL zinitmat(
'G',
'-', m, n, mem(preaptr),
18018 $ lda, ipre, ipost,
18019 $ checkval, testnum,
18024 IF( ldi .NE. -1 )
THEN
18025 DO 15 i = 1, n*ldi + ipre + ipost
18026 rmem(i) = icheckval
18027 cmem(i) = icheckval
18032 DO 20 i = 1, ipre+ipost
18033 rmem(i) = icheckval
18034 cmem(i) = icheckval
18040 CALL zgamx2d(context, scope, top, m, n,
18041 $ mem(aptr), lda, rmem(raptr),
18042 $ cmem(captr), ldi,
18048 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
18049 $ .OR. allrcv )
THEN
18051 $ mem(preaptr), lda, rdest,
18052 $ cdest, myrow, mycol,
18053 $ ipre, ipost, checkval,
18054 $ testnum, maxerr, nerr,
18055 $ mem(erriptr),mem(errdptr))
18056 CALL zchkamx(scope, context, m, n,
18058 $ rmem(raptr), cmem(captr),
18059 $ ldi, testnum, maxerr,nerr,
18060 $ mem(erriptr),mem(errdptr),
18061 $ iseed, mem(valptr))
18062 CALL zrcchk(ipre, ipost, icheckval,
18063 $ m, n, rmem, cmem, ldi,
18064 $ myrow, mycol, testnum,
18066 $ mem(erriptr), mem(errdptr))
18069 CALL blacs_set(context, 16, 0)
18071 CALL blacs_set(context, 15, 0)
18073 testok = ( k .EQ. nerr )
18077 IF( verb .GT. 1 )
THEN
18080 $ mem(erriptr), mem(errdptr), iseed)
18081 IF( iam .EQ. 0 )
THEN
18082 IF( testok .AND. nerr.EQ.i )
THEN
18083 WRITE(outnum,6000)testnum,
'PASSED ',
18084 $ scope, top, m, n, ldasrc,
18085 $ ldadst, ldi, rdest2, cdest2,
18089 WRITE(outnum,6000)testnum,
'FAILED ',
18090 $ scope, top, m, n, ldasrc,
18091 $ ldadst, ldi, rdest2, cdest2,
18106 IF( verb .LT. 2 )
THEN
18108 CALL zbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
18109 $ mem(errdptr), iseed )
18111 IF( iam .EQ. 0 )
THEN
18112 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
18113 IF( nfail+nskip .EQ. 0 )
THEN
18114 WRITE(outnum, 7000 ) testnum
18116 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
18123 testok = allpass( (nfail.EQ.0) )
18125 1000
FORMAT(
'DOUBLE COMPLEX AMX TESTS: BEGIN.' )
18126 2000
FORMAT(1x,a7,3x,10i6)
18127 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
18129 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
18130 $
'RDEST CDEST P Q')
18131 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
18132 $
'----- ----- ---- ----')
18133 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
18134 7000
FORMAT(
'DOUBLE COMPLEX AMX TESTS: PASSED ALL',
18136 8000
FORMAT(
'DOUBLE COMPLEX AMX TESTS:',i5,
' TESTS;',i5,
' PASSED,',
18137 $ i5,
' SKIPPED,',i5,
' FAILED.')
18145 SUBROUTINE zrcchk( IPRE, IPOST, PADVAL, M, N, RA, CA, LDI, MYROW,
18146 $ MYCOL, TESTNUM, MAXERR, NERR,
18147 $ ERRIBUF, ERRDBUF )
18150 INTEGER IPRE, IPOST, PADVAL, M, N, LDI, MYROW, MYCOL, TESTNUM
18151 INTEGER MAXERR, NERR
18154 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR)
18155 DOUBLE COMPLEX ERRDBUF(2, MAXERR)
18158 INTEGER ERR_PRE, ERR_POST, ERR_GAP, ERR_TRI, ERR_MAT
18159 PARAMETER( ERR_PRE = 1, err_post = 2, err_gap = 3, err_tri = 4 )
18160 parameter( err_mat = 5 )
18167 INTEGER I, J, K, IAM
18171 iam = myrow * ibtnprocs() + mycol
18175 IF( ldi .NE. -1 )
THEN
18176 IF( ipre .GT. 0 )
THEN
18178 IF( ra(i) .NE. padval )
THEN
18180 IF( nerr .LE. maxerr )
THEN
18181 erribuf(1, nerr) = testnum
18182 erribuf(2, nerr) = ldi
18183 erribuf(3, nerr) = iam
18184 erribuf(4, nerr) = i
18185 erribuf(5, nerr) = ipre - i + 1
18186 erribuf(6, nerr) = -err_pre
18187 errdbuf(1, nerr) = dcmplx( ra(i) )
18188 errdbuf(2, nerr) = dcmplx( padval )
18191 IF( ca(i) .NE. padval )
THEN
18193 IF( nerr .LE. maxerr )
THEN
18194 erribuf(1, nerr) = testnum
18195 erribuf(2, nerr) = ldi
18196 erribuf(3, nerr) = iam
18197 erribuf(4, nerr) = i
18198 erribuf(5, nerr) = ipre - i + 1
18199 erribuf(6, nerr) = -10 - err_pre
18200 errdbuf(1, nerr) = dcmplx( ca(i) )
18201 errdbuf(2, nerr) = dcmplx( padval )
18209 IF( ipost .GT. 0 )
THEN
18211 DO 20 i = k+1, k+ipost
18212 IF( ra(i) .NE. padval )
THEN
18214 IF( nerr .LE. maxerr )
THEN
18215 erribuf(1, nerr) = testnum
18216 erribuf(2, nerr) = ldi
18217 erribuf(3, nerr) = iam
18218 erribuf(4, nerr) = i - k
18219 erribuf(5, nerr) = i
18220 erribuf(6, nerr) = -err_post
18221 errdbuf(1, nerr) = dcmplx( ra(i) )
18222 errdbuf(2, nerr) = dcmplx( padval )
18225 IF( ca(i) .NE. padval )
THEN
18227 IF( nerr .LE. maxerr )
THEN
18228 erribuf(1, nerr) = testnum
18229 erribuf(2, nerr) = ldi
18230 erribuf(3, nerr) = iam
18231 erribuf(4, nerr) = i - k
18232 erribuf(5, nerr) = i
18233 erribuf(6, nerr) = -10 - err_post
18234 errdbuf(1, nerr) = dcmplx( ca(i) )
18235 errdbuf(2, nerr) = dcmplx( padval )
18243 IF( ldi .GT. m )
THEN
18247 k = ipre + (j-1)*ldi + i
18248 IF( ra(k) .NE. padval)
THEN
18250 IF( nerr .LE. maxerr )
THEN
18251 erribuf(1, nerr) = testnum
18252 erribuf(2, nerr) = ldi
18253 erribuf(3, nerr) = iam
18254 erribuf(4, nerr) = i
18255 erribuf(5, nerr) = j
18256 erribuf(6, nerr) = -err_gap
18257 errdbuf(1, nerr) = dcmplx( ra(k) )
18258 errdbuf(2, nerr) = dcmplx( padval )
18261 IF( ca(k) .NE. padval)
THEN
18263 IF( nerr .LE. maxerr )
THEN
18264 erribuf(1, nerr) = testnum
18265 erribuf(2, nerr) = ldi
18266 erribuf(3, nerr) = iam
18267 erribuf(4, nerr) = i
18268 erribuf(5, nerr) = j
18269 erribuf(6, nerr) = -10 - err_gap
18270 errdbuf(1, nerr) = dcmplx( ca(k) )
18271 errdbuf(2, nerr) = dcmplx( padval )
18281 DO 50 i = 1, ipre+ipost
18282 IF( ra(i) .NE. padval)
THEN
18284 IF( nerr .LE. maxerr )
THEN
18285 erribuf(1, nerr) = testnum
18286 erribuf(2, nerr) = ldi
18287 erribuf(3, nerr) = iam
18288 erribuf(4, nerr) = i
18289 erribuf(5, nerr) = ipre+ipost
18290 erribuf(6, nerr) = -err_pre
18291 errdbuf(1, nerr) = dcmplx( ra(i) )
18292 errdbuf(2, nerr) = dcmplx( padval )
18295 IF( ca(i) .NE. padval)
THEN
18297 IF( nerr .LE. maxerr )
THEN
18298 erribuf(1, nerr) = testnum
18299 erribuf(2, nerr) = ldi
18300 erribuf(3, nerr) = iam
18301 erribuf(4, nerr) = i
18302 erribuf(5, nerr) = ipre+ipost
18303 erribuf(6, nerr) = -10 - err_pre
18304 errdbuf(1, nerr) = dcmplx( ca(i) )
18305 errdbuf(2, nerr) = dcmplx( padval )
18314 SUBROUTINE zchkamx( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
18315 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
18320 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
18323 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
18324 DOUBLE COMPLEX A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
18327 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
18328 DOUBLE PRECISION DBTEPS, ZBTABS
18329 DOUBLE COMPLEX ZBTRAN
18330 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, zbtran, dbteps, zbtabs
18337 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMX, CAMX
18338 INTEGER IAMX, I, J, K, H, DEST, NODE
18339 DOUBLE PRECISION EPS
18343 nprocs = ibtnprocs()
18345 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
18346 dest = myrow*nprocs + mycol
18350 IF( scope .EQ.
'R' )
THEN
18352 DO 10 i = 0, nnodes-1
18353 node = myrow * nprocs + i
18354 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18355 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18356 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18357 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18359 ELSE IF( scope .EQ.
'C' )
THEN
18361 DO 20 i = 0, nnodes-1
18362 node = i * nprocs + mycol
18363 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18364 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18365 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18366 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18369 nnodes = nprow * npcol
18370 DO 30 i = 0, nnodes-1
18371 node = (i / npcol) * nprocs + mod(i, npcol)
18372 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18373 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
18374 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
18375 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
18382 vals(1) = zbtran( iseed )
18384 IF( nnodes .GT. 1 )
THEN
18385 DO 40 k = 1, nnodes-1
18386 vals(k+1) = zbtran( iseed(k*4+1) )
18387 IF( zbtabs( vals(k+1) ) .GT. zbtabs( vals(iamx) ) )
18394 IF( a(i,j) .NE. vals(iamx) )
THEN
18398 IF( ldi .NE. -1 )
THEN
18402 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
18403 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
18404 error = abs( zbtabs(vals(k)) - zbtabs(vals(iamx)) )
18406 IF( .NOT.error ) iamx = k
18415 error = abs( zbtabs(a(i,j)) - zbtabs(vals(iamx)) )
18417 IF( .NOT.error )
THEN
18418 DO 50 k = 1, nnodes
18419 IF( vals(k) .EQ. a(i,j) )
GOTO 60
18430 erribuf(1, nerr) = testnum
18431 erribuf(2, nerr) = nnodes
18432 erribuf(3, nerr) = dest
18433 erribuf(4, nerr) = i
18434 erribuf(5, nerr) = j
18435 erribuf(6, nerr) = 5
18436 errdbuf(1, nerr) = a(i,j)
18437 errdbuf(2, nerr) = vals(iamx)
18443 IF( ldi .NE. -1 )
THEN
18444 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
18445 IF( k.NE.iamx )
THEN
18451 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
18454 error = ( vals(k) .NE. vals(iamx) )
18457 CALL ibtspcoord( scope, iamx-1, myrow, mycol,
18458 $ npcol, ramx, camx )
18459 IF( ramx .NE. ra(h) )
THEN
18461 erribuf(1, nerr) = testnum
18462 erribuf(2, nerr) = nnodes
18463 erribuf(3, nerr) = dest
18464 erribuf(4, nerr) = i
18465 erribuf(5, nerr) = j
18466 erribuf(6, nerr) = -5
18467 errdbuf(1, nerr) = ra(h)
18468 errdbuf(2, nerr) = ramx
18470 IF( camx .NE. ca(h) )
THEN
18472 erribuf(1, nerr) = testnum
18473 erribuf(2, nerr) = nnodes
18474 erribuf(3, nerr) = dest
18475 erribuf(4, nerr) = i
18476 erribuf(5, nerr) = j
18477 erribuf(6, nerr) = -15
18478 errdbuf(1, nerr) = ca(h)
18479 errdbuf(2, nerr) = camx
18494 SUBROUTINE iamntest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
18495 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
18496 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
18497 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
18506 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
18507 $ topscohrnt, topsrepeat, verb
18510 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
18511 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
18512 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
18513 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
18514 INTEGER MEM(MEMLEN)
18613 LOGICAL ALLPASS, LSAME
18614 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
18615 EXTERNAL allpass, lsame, ibtmyproc, ibtnprocs, ibtsizeof
18618 EXTERNAL blacs_gridinfo, igamn2d
18622 CHARACTER*1 SCOPE, TOP
18623 LOGICAL INGRID, TESTOK, ALLRCV
18624 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
18625 $ iam, icheckval, ide, igr, ima, ipad, ipost, ipre, isc,
18626 $ isize, istart, istop, itc, itc1, itc2, ito, itr, itr1,
18627 $ itr2, j, k, lda, ldadst, ldasrc, ldi, m, maxerr, mycol,
18628 $ myrow, n, nerr, nfail, npcol, nprow, nskip, preaptr,
18629 $ raptr, rdest, rdest2, setwhat, testnum, valptr
18638 checkval = iam * checkval
18639 isize = ibtsizeof(
'I')
18644 IF( iam .EQ. 0 )
THEN
18645 WRITE(outnum, *)
' '
18646 WRITE(outnum, *)
' '
18647 WRITE(outnum, 1000 )
18648 IF( verb .GT. 0 )
THEN
18649 WRITE(outnum,*)
' '
18650 WRITE(outnum, 2000)
'NSCOPE:', nscope
18651 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
18652 WRITE(outnum, 2000)
'TReps :', topsrepeat
18653 WRITE(outnum, 2000)
'TCohr :', topscohrnt
18654 WRITE(outnum, 2000)
'NTOP :', ntop
18655 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
18656 WRITE(outnum, 2000)
'NMAT :', nmat
18657 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
18658 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
18659 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
18660 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
18661 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
18662 WRITE(outnum, 2000)
'NDEST :', ndest
18663 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
18664 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
18665 WRITE(outnum, 2000)
'NGRIDS:', ngrid
18666 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
18667 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
18668 WRITE(outnum, 2000)
'VERB :', verb
18669 WRITE(outnum,*)
' '
18671 IF( verb .GT. 1 )
THEN
18676 IF (topsrepeat.EQ.0)
THEN
18679 ELSE IF (topsrepeat.EQ.1)
THEN
18690 DO 10 ima = 1, nmat
18692 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
18693 IF( k .GT. i ) i = k
18695 i = i + ibtnprocs()
18696 maxerr = ( isize * (memlen-i) ) / ( isize*2 + isize*6 )
18697 IF( maxerr .LT. 1 )
THEN
18698 WRITE(outnum,*)
'ERROR: Not enough memory to run MIN tests.'
18699 CALL blacs_abort(-1, 1)
18702 erriptr = errdptr + maxerr
18710 DO 90 igr = 1, ngrid
18714 context = context0(igr)
18715 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
18716 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
18718 DO 80 isc = 1, nscope
18719 scope = scope0(isc)
18720 DO 70 ito = 1, ntop
18726 IF( lsame(top,
'M') )
THEN
18728 IF( scope .EQ.
'R' )
THEN
18729 istart = -(npcol - 1)
18731 ELSE IF (scope .EQ.
'C')
THEN
18732 istart = -(nprow - 1)
18735 istart = -(nprow*npcol - 1)
18738 ELSE IF( lsame(top,
'T') )
THEN
18741 IF( scope .EQ.
'R' )
THEN
18743 ELSE IF (scope .EQ.
'C')
THEN
18746 istop = nprow*npcol - 1
18753 DO 60 ima = 1, nmat
18756 ldasrc = ldas0(ima)
18757 ldadst = ldad0(ima)
18762 aptr = preaptr + ipre
18764 DO 50 ide = 1, ndest
18765 testnum = testnum + 1
18766 rdest2 = rdest0(ide)
18767 cdest2 = cdest0(ide)
18772 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
18776 IF (topscohrnt.EQ.0)
THEN
18779 ELSE IF (topscohrnt.EQ.1)
THEN
18792 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
18797 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
18802 valptr = aptr + ipost + n * lda
18803 IF( verb .GT. 1 )
THEN
18804 IF( iam .EQ. 0 )
THEN
18805 WRITE(outnum, 6000)
18806 $ testnum,
'RUNNING', scope, top, m, n,
18807 $ ldasrc, ldadst, ldi, rdest2, cdest2,
18816 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
18817 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
18818 $ (scope .EQ.
'A') )
THEN
18821 DO 40 itr = itr1, itr2
18822 CALL blacs_set(context, 15, itr)
18823 DO 35 itc = itc1, itc2
18824 CALL blacs_set(context, 16, itc)
18825 DO 30 j = istart, istop
18826 IF( j.EQ.0)
GOTO 30
18828 $
CALL blacs_set(context, setwhat, j)
18833 CALL iinitmat(
'G',
'-', m, n, mem(preaptr),
18834 $ lda, ipre, ipost,
18835 $ checkval, testnum,
18840 IF( ldi .NE. -1 )
THEN
18841 DO 15 i = 1, n*ldi + ipre + ipost
18842 rmem(i) = icheckval
18843 cmem(i) = icheckval
18848 DO 20 i = 1, ipre+ipost
18849 rmem(i) = icheckval
18850 cmem(i) = icheckval
18856 CALL igamn2d(context, scope, top, m, n,
18857 $ mem(aptr), lda, rmem(raptr),
18858 $ cmem(captr), ldi,
18864 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
18865 $ .OR. allrcv )
THEN
18867 $ mem(preaptr), lda, rdest,
18868 $ cdest, myrow, mycol,
18869 $ ipre, ipost, checkval,
18870 $ testnum, maxerr, nerr,
18871 $ mem(erriptr),mem(errdptr))
18872 CALL ichkamn(scope, context, m, n,
18874 $ rmem(raptr), cmem(captr),
18875 $ ldi, testnum, maxerr,nerr,
18876 $ mem(erriptr),mem(errdptr),
18877 $ iseed, mem(valptr))
18878 CALL ircchk(ipre, ipost, icheckval,
18879 $ m, n, rmem, cmem, ldi,
18880 $ myrow, mycol, testnum,
18882 $ mem(erriptr), mem(errdptr))
18885 CALL blacs_set(context, 16, 0)
18887 CALL blacs_set(context, 15, 0)
18889 testok = ( k .EQ. nerr )
18893 IF( verb .GT. 1 )
THEN
18896 $ mem(erriptr), mem(errdptr), iseed)
18897 IF( iam .EQ. 0 )
THEN
18898 IF( testok .AND. nerr.EQ.i )
THEN
18899 WRITE(outnum,6000)testnum,
'PASSED ',
18900 $ scope, top, m, n, ldasrc,
18901 $ ldadst, ldi, rdest2, cdest2,
18905 WRITE(outnum,6000)testnum,
'FAILED ',
18906 $ scope, top, m, n, ldasrc,
18907 $ ldadst, ldi, rdest2, cdest2,
18922 IF( verb .LT. 2 )
THEN
18924 CALL ibtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
18925 $ mem(errdptr), iseed )
18927 IF( iam .EQ. 0 )
THEN
18928 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
18929 IF( nfail+nskip .EQ. 0 )
THEN
18930 WRITE(outnum, 7000 ) testnum
18932 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
18939 testok = allpass( (nfail.EQ.0) )
18941 1000
FORMAT(
'INTEGER AMN TESTS: BEGIN.' )
18942 2000
FORMAT(1x,a7,3x,10i6)
18943 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
18945 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
18946 $
'RDEST CDEST P Q')
18947 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
18948 $
'----- ----- ---- ----')
18949 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
18950 7000
FORMAT(
'INTEGER AMN TESTS: PASSED ALL',
18952 8000
FORMAT(
'INTEGER AMN TESTS:',i5,
' TESTS;',i5,
' PASSED,',
18953 $ i5,
' SKIPPED,',i5,
' FAILED.')
18961 SUBROUTINE ichkamn( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
18962 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
18967 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
18970 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
18971 INTEGER A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
18974 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM, IBTRAN, IBTABS
18975 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, ibtran
18983 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMN, CAMN
18984 INTEGER IAMN, I, J, K, H, DEST, NODE
18988 nprocs = ibtnprocs()
18989 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
18990 dest = myrow*nprocs + mycol
18994 IF( scope .EQ.
'R' )
THEN
18996 DO 10 i = 0, nnodes-1
18997 node = myrow * nprocs + i
18998 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
18999 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19000 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19001 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19003 ELSE IF( scope .EQ.
'C' )
THEN
19005 DO 20 i = 0, nnodes-1
19006 node = i * nprocs + mycol
19007 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
19008 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19009 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19010 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19013 nnodes = nprow * npcol
19014 DO 30 i = 0, nnodes-1
19015 node = (i / npcol) * nprocs + mod(i, npcol)
19016 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
19017 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19018 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19019 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19026 vals(1) = ibtran( iseed )
19028 IF( nnodes .GT. 1 )
THEN
19029 DO 40 k = 1, nnodes-1
19030 vals(k+1) = ibtran( iseed(k*4+1) )
19031 IF( ibtabs( vals(k+1) ) .LT. ibtabs( vals(iamn) ) )
19038 IF( a(i,j) .NE. vals(iamn) )
THEN
19042 IF( ldi .NE. -1 )
THEN
19046 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
19047 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
19048 error = ibtabs( vals(k) ).NE.ibtabs( vals(iamn) )
19049 IF( .NOT.error ) iamn = k
19058 error = ( ibtabs( a(i,j) ) .NE. ibtabs( vals(iamn) ) )
19059 IF( .NOT.error )
THEN
19060 DO 50 k = 1, nnodes
19061 IF( vals(k) .EQ. a(i,j) )
GOTO 60
19072 erribuf(1, nerr) = testnum
19073 erribuf(2, nerr) = nnodes
19074 erribuf(3, nerr) = dest
19075 erribuf(4, nerr) = i
19076 erribuf(5, nerr) = j
19077 erribuf(6, nerr) = 5
19078 errdbuf(1, nerr) = a(i,j)
19079 errdbuf(2, nerr) = vals(iamn)
19085 IF( ldi .NE. -1 )
THEN
19086 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
19087 IF( k.NE.iamn )
THEN
19093 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
19096 error = ( vals(k) .NE. vals(iamn) )
19099 CALL ibtspcoord( scope, iamn-1, myrow, mycol,
19100 $ npcol, ramn, camn )
19101 IF( ramn .NE. ra(h) )
THEN
19103 erribuf(1, nerr) = testnum
19104 erribuf(2, nerr) = nnodes
19105 erribuf(3, nerr) = dest
19106 erribuf(4, nerr) = i
19107 erribuf(5, nerr) = j
19108 erribuf(6, nerr) = -5
19109 errdbuf(1, nerr) = ra(h)
19110 errdbuf(2, nerr) = ramn
19112 IF( camn .NE. ca(h) )
THEN
19114 erribuf(1, nerr) = testnum
19115 erribuf(2, nerr) = nnodes
19116 erribuf(3, nerr) = dest
19117 erribuf(4, nerr) = i
19118 erribuf(5, nerr) = j
19119 erribuf(6, nerr) = -15
19120 errdbuf(1, nerr) = ca(h)
19121 errdbuf(2, nerr) = camn
19136 SUBROUTINE samntest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
19137 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
19138 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
19139 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
19148 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
19149 $ TOPSCOHRNT, TOPSREPEAT, VERB
19152 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
19153 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
19154 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
19155 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
19255 LOGICAL ALLPASS, LSAME
19256 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
19257 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
19260 EXTERNAL blacs_gridinfo, sgamn2d
19264 CHARACTER*1 SCOPE, TOP
19265 LOGICAL INGRID, TESTOK, ALLRCV
19266 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
19267 $ iam, icheckval, ide, igr, ima, ipad, ipost, ipre, isc,
19268 $ isize, istart, istop, itc, itc1, itc2, ito, itr, itr1,
19269 $ itr2, j, k, lda, ldadst, ldasrc, ldi, m, maxerr, mycol,
19270 $ myrow, n, nerr, nfail, npcol, nprow, nskip, preaptr,
19271 $ raptr, rdest, rdest2, setwhat, ssize, testnum, valptr
19280 checkval = iam * checkval
19281 isize = ibtsizeof(
'I')
19282 ssize = ibtsizeof(
'S')
19287 IF( iam .EQ. 0 )
THEN
19288 WRITE(outnum, *)
' '
19289 WRITE(outnum, *)
' '
19290 WRITE(outnum, 1000 )
19291 IF( verb .GT. 0 )
THEN
19292 WRITE(outnum,*)
' '
19293 WRITE(outnum, 2000)
'NSCOPE:', nscope
19294 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
19295 WRITE(outnum, 2000)
'TReps :', topsrepeat
19296 WRITE(outnum, 2000)
'TCohr :', topscohrnt
19297 WRITE(outnum, 2000)
'NTOP :', ntop
19298 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
19299 WRITE(outnum, 2000)
'NMAT :', nmat
19300 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
19301 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
19302 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
19303 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
19304 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
19305 WRITE(outnum, 2000)
'NDEST :', ndest
19306 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
19307 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
19308 WRITE(outnum, 2000)
'NGRIDS:', ngrid
19309 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
19310 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
19311 WRITE(outnum, 2000)
'VERB :', verb
19312 WRITE(outnum,*)
' '
19314 IF( verb .GT. 1 )
THEN
19319 IF (topsrepeat.EQ.0)
THEN
19322 ELSE IF (topsrepeat.EQ.1)
THEN
19333 DO 10 ima = 1, nmat
19335 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
19336 IF( k .GT. i ) i = k
19338 i = i + ibtnprocs()
19339 maxerr = ( ssize * (memlen-i) ) / ( ssize*2 + isize*6 )
19340 IF( maxerr .LT. 1 )
THEN
19341 WRITE(outnum,*)
'ERROR: Not enough memory to run MIN tests.'
19342 CALL blacs_abort(-1, 1)
19345 erriptr = errdptr + maxerr
19353 DO 90 igr = 1, ngrid
19357 context = context0(igr)
19358 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
19359 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
19361 DO 80 isc = 1, nscope
19362 scope = scope0(isc)
19363 DO 70 ito = 1, ntop
19369 IF( lsame(top,
'M') )
THEN
19371 IF( scope .EQ.
'R' )
THEN
19372 istart = -(npcol - 1)
19374 ELSE IF (scope .EQ.
'C')
THEN
19375 istart = -(nprow - 1)
19378 istart = -(nprow*npcol - 1)
19381 ELSE IF( lsame(top,
'T') )
THEN
19384 IF( scope .EQ.
'R' )
THEN
19386 ELSE IF (scope .EQ.
'C')
THEN
19389 istop = nprow*npcol - 1
19396 DO 60 ima = 1, nmat
19399 ldasrc = ldas0(ima)
19400 ldadst = ldad0(ima)
19405 aptr = preaptr + ipre
19407 DO 50 ide = 1, ndest
19408 testnum = testnum + 1
19409 rdest2 = rdest0(ide)
19410 cdest2 = cdest0(ide)
19415 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
19419 IF (topscohrnt.EQ.0)
THEN
19422 ELSE IF (topscohrnt.EQ.1)
THEN
19435 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
19440 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
19445 valptr = aptr + ipost + n * lda
19446 IF( verb .GT. 1 )
THEN
19447 IF( iam .EQ. 0 )
THEN
19448 WRITE(outnum, 6000)
19449 $ testnum,
'RUNNING', scope, top, m, n,
19450 $ ldasrc, ldadst, ldi, rdest2, cdest2,
19459 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
19460 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
19461 $ (scope .EQ.
'A') )
THEN
19464 DO 40 itr = itr1, itr2
19465 CALL blacs_set(context, 15, itr)
19466 DO 35 itc = itc1, itc2
19467 CALL blacs_set(context, 16, itc)
19468 DO 30 j = istart, istop
19469 IF( j.EQ.0)
GOTO 30
19471 $
CALL blacs_set(context, setwhat, j)
19476 CALL sinitmat(
'G',
'-', m, n, mem(preaptr),
19477 $ lda, ipre, ipost,
19478 $ checkval, testnum,
19483 IF( ldi .NE. -1 )
THEN
19484 DO 15 i = 1, n*ldi + ipre + ipost
19485 rmem(i) = icheckval
19486 cmem(i) = icheckval
19491 DO 20 i = 1, ipre+ipost
19492 rmem(i) = icheckval
19493 cmem(i) = icheckval
19499 CALL sgamn2d(context, scope, top, m, n,
19500 $ mem(aptr), lda, rmem(raptr),
19501 $ cmem(captr), ldi,
19507 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
19508 $ .OR. allrcv )
THEN
19510 $ mem(preaptr), lda, rdest,
19511 $ cdest, myrow, mycol,
19512 $ ipre, ipost, checkval,
19513 $ testnum, maxerr, nerr,
19514 $ mem(erriptr),mem(errdptr))
19515 CALL schkamn(scope, context, m, n,
19517 $ rmem(raptr), cmem(captr),
19518 $ ldi, testnum, maxerr,nerr,
19519 $ mem(erriptr),mem(errdptr),
19520 $ iseed, mem(valptr))
19521 CALL srcchk(ipre, ipost, icheckval,
19522 $ m, n, rmem, cmem, ldi,
19523 $ myrow, mycol, testnum,
19525 $ mem(erriptr), mem(errdptr))
19528 CALL blacs_set(context, 16, 0)
19530 CALL blacs_set(context, 15, 0)
19532 testok = ( k .EQ. nerr )
19536 IF( verb .GT. 1 )
THEN
19539 $ mem(erriptr), mem(errdptr), iseed)
19540 IF( iam .EQ. 0 )
THEN
19541 IF( testok .AND. nerr.EQ.i )
THEN
19542 WRITE(outnum,6000)testnum,
'PASSED ',
19543 $ scope, top, m, n, ldasrc,
19544 $ ldadst, ldi, rdest2, cdest2,
19548 WRITE(outnum,6000)testnum,
'FAILED ',
19549 $ scope, top, m, n, ldasrc,
19550 $ ldadst, ldi, rdest2, cdest2,
19565 IF( verb .LT. 2 )
THEN
19567 CALL sbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
19568 $ mem(errdptr), iseed )
19570 IF( iam .EQ. 0 )
THEN
19571 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
19572 IF( nfail+nskip .EQ. 0 )
THEN
19573 WRITE(outnum, 7000 ) testnum
19575 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
19582 testok = allpass( (nfail.EQ.0) )
19584 1000
FORMAT(
'REAL AMN TESTS: BEGIN.' )
19585 2000
FORMAT(1x,a7,3x,10i6)
19586 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
19588 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
19589 $
'RDEST CDEST P Q')
19590 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
19591 $
'----- ----- ---- ----')
19592 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
19593 7000
FORMAT(
'REAL AMN TESTS: PASSED ALL',
19595 8000
FORMAT(
'REAL AMN TESTS:',i5,
' TESTS;',i5,
' PASSED,',
19596 $ i5,
' SKIPPED,',i5,
' FAILED.')
19604 SUBROUTINE schkamn( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
19605 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
19610 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
19613 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
19614 REAL A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
19617 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
19618 REAL SBTEPS, SBTABS
19620 EXTERNAL IBTMYPROC, IBTNPROCS, IBTSPNUM, SBTRAN, SBTEPS, SBTABS
19627 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMN, CAMN
19628 INTEGER IAMN, I, J, K, H, DEST, NODE
19633 NPROCS = ibtnprocs()
19635 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
19636 dest = myrow*nprocs + mycol
19640 IF( scope .EQ.
'R' )
THEN
19642 DO 10 i = 0, nnodes-1
19643 node = myrow * nprocs + i
19644 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
19645 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19646 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19647 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19649 ELSE IF( scope .EQ.
'C' )
THEN
19651 DO 20 i = 0, nnodes-1
19652 node = i * nprocs + mycol
19653 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
19654 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19655 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19656 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19659 nnodes = nprow * npcol
19660 DO 30 i = 0, nnodes-1
19661 node = (i / npcol) * nprocs + mod(i, npcol)
19662 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
19663 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
19664 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
19665 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
19672 vals(1) = sbtran( iseed )
19674 IF( nnodes .GT. 1 )
THEN
19675 DO 40 k = 1, nnodes-1
19676 vals(k+1) = sbtran( iseed(k*4+1) )
19677 IF( sbtabs( vals(k+1) ) .LT. sbtabs( vals(iamn) ) )
19684 IF( a(i,j) .NE. vals(iamn) )
THEN
19688 IF( ldi .NE. -1 )
THEN
19692 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
19693 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
19694 error = sbtabs( vals(k) ).NE.sbtabs( vals(iamn) )
19695 IF( .NOT.error ) iamn = k
19704 error = ( sbtabs( a(i,j) ) .NE. sbtabs( vals(iamn) ) )
19705 IF( .NOT.error )
THEN
19706 DO 50 k = 1, nnodes
19707 IF( vals(k) .EQ. a(i,j) )
GOTO 60
19718 erribuf(1, nerr) = testnum
19719 erribuf(2, nerr) = nnodes
19720 erribuf(3, nerr) = dest
19721 erribuf(4, nerr) = i
19722 erribuf(5, nerr) = j
19723 erribuf(6, nerr) = 5
19724 errdbuf(1, nerr) = a(i,j)
19725 errdbuf(2, nerr) = vals(iamn)
19731 IF( ldi .NE. -1 )
THEN
19732 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
19733 IF( k.NE.iamn )
THEN
19739 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
19742 error = ( vals(k) .NE. vals(iamn) )
19745 CALL ibtspcoord( scope, iamn-1, myrow, mycol,
19746 $ npcol, ramn, camn )
19747 IF( ramn .NE. ra(h) )
THEN
19749 erribuf(1, nerr) = testnum
19750 erribuf(2, nerr) = nnodes
19751 erribuf(3, nerr) = dest
19752 erribuf(4, nerr) = i
19753 erribuf(5, nerr) = j
19754 erribuf(6, nerr) = -5
19755 errdbuf(1, nerr) = ra(h)
19756 errdbuf(2, nerr) = ramn
19758 IF( camn .NE. ca(h) )
THEN
19760 erribuf(1, nerr) = testnum
19761 erribuf(2, nerr) = nnodes
19762 erribuf(3, nerr) = dest
19763 erribuf(4, nerr) = i
19764 erribuf(5, nerr) = j
19765 erribuf(6, nerr) = -15
19766 errdbuf(1, nerr) = ca(h)
19767 errdbuf(2, nerr) = camn
19782 SUBROUTINE damntest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
19783 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
19784 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
19785 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
19794 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
19795 $ TOPSCOHRNT, TOPSREPEAT, VERB
19798 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
19799 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
19800 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
19801 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
19802 DOUBLE PRECISION MEM(MEMLEN)
19901 LOGICAL ALLPASS, LSAME
19902 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
19903 EXTERNAL allpass, lsame, ibtmyproc, ibtnprocs, ibtsizeof
19906 EXTERNAL blacs_gridinfo, dgamn2d
19910 CHARACTER*1 SCOPE, TOP
19911 LOGICAL INGRID, TESTOK, ALLRCV
19912 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, DSIZE, ERRDPTR,
19913 $ erriptr, i, iam, icheckval, ide, igr, ima, ipad, ipost,
19914 $ ipre, isc, isize, istart, istop, itc, itc1, itc2, ito,
19915 $ itr, itr1, itr2, j, k, lda, ldadst, ldasrc, ldi, m,
19916 $ maxerr, mycol, myrow, n, nerr, nfail, npcol, nprow, nskip,
19917 $ preaptr, raptr, rdest, rdest2, setwhat, testnum, valptr
19918 DOUBLE PRECISION CHECKVAL
19926 checkval = iam * checkval
19927 isize = ibtsizeof(
'I')
19928 dsize = ibtsizeof(
'D')
19933 IF( iam .EQ. 0 )
THEN
19934 WRITE(outnum, *)
' '
19935 WRITE(outnum, *)
' '
19936 WRITE(outnum, 1000 )
19937 IF( verb .GT. 0 )
THEN
19938 WRITE(outnum,*)
' '
19939 WRITE(outnum, 2000)
'NSCOPE:', nscope
19940 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
19941 WRITE(outnum, 2000)
'TReps :', topsrepeat
19942 WRITE(outnum, 2000)
'TCohr :', topscohrnt
19943 WRITE(outnum, 2000)
'NTOP :', ntop
19944 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
19945 WRITE(outnum, 2000)
'NMAT :', nmat
19946 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
19947 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
19948 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
19949 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
19950 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
19951 WRITE(outnum, 2000)
'NDEST :', ndest
19952 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
19953 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
19954 WRITE(outnum, 2000)
'NGRIDS:', ngrid
19955 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
19956 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
19957 WRITE(outnum, 2000)
'VERB :', verb
19958 WRITE(outnum,*)
' '
19960 IF( verb .GT. 1 )
THEN
19965 IF (topsrepeat.EQ.0)
THEN
19968 ELSE IF (topsrepeat.EQ.1)
THEN
19979 DO 10 ima = 1, nmat
19981 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
19982 IF( k .GT. i ) i = k
19984 i = i + ibtnprocs()
19985 maxerr = ( dsize * (memlen-i) ) / ( dsize*2 + isize*6 )
19986 IF( maxerr .LT. 1 )
THEN
19987 WRITE(outnum,*)
'ERROR: Not enough memory to run MIN tests.'
19988 CALL blacs_abort(-1, 1)
19991 erriptr = errdptr + maxerr
19999 DO 90 igr = 1, ngrid
20003 context = context0(igr)
20004 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
20005 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
20007 DO 80 isc = 1, nscope
20008 scope = scope0(isc)
20009 DO 70 ito = 1, ntop
20015 IF( lsame(top,
'M') )
THEN
20017 IF( scope .EQ.
'R' )
THEN
20018 istart = -(npcol - 1)
20020 ELSE IF (scope .EQ.
'C')
THEN
20021 istart = -(nprow - 1)
20024 istart = -(nprow*npcol - 1)
20027 ELSE IF( lsame(top,
'T') )
THEN
20030 IF( scope .EQ.
'R' )
THEN
20032 ELSE IF (scope .EQ.
'C')
THEN
20035 istop = nprow*npcol - 1
20042 DO 60 ima = 1, nmat
20045 ldasrc = ldas0(ima)
20046 ldadst = ldad0(ima)
20051 aptr = preaptr + ipre
20053 DO 50 ide = 1, ndest
20054 testnum = testnum + 1
20055 rdest2 = rdest0(ide)
20056 cdest2 = cdest0(ide)
20061 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
20065 IF (topscohrnt.EQ.0)
THEN
20068 ELSE IF (topscohrnt.EQ.1)
THEN
20081 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
20086 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
20091 valptr = aptr + ipost + n * lda
20092 IF( verb .GT. 1 )
THEN
20093 IF( iam .EQ. 0 )
THEN
20094 WRITE(outnum, 6000)
20095 $ testnum,
'RUNNING', scope, top, m, n,
20096 $ ldasrc, ldadst, ldi, rdest2, cdest2,
20105 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
20106 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
20107 $ (scope .EQ.
'A') )
THEN
20110 DO 40 itr = itr1, itr2
20111 CALL blacs_set(context, 15, itr)
20112 DO 35 itc = itc1, itc2
20113 CALL blacs_set(context, 16, itc)
20114 DO 30 j = istart, istop
20115 IF( j.EQ.0)
GOTO 30
20117 $
CALL blacs_set(context, setwhat, j)
20122 CALL dinitmat(
'G',
'-', m, n, mem(preaptr),
20123 $ lda, ipre, ipost,
20124 $ checkval, testnum,
20129 IF( ldi .NE. -1 )
THEN
20130 DO 15 i = 1, n*ldi + ipre + ipost
20131 rmem(i) = icheckval
20132 cmem(i) = icheckval
20137 DO 20 i = 1, ipre+ipost
20138 rmem(i) = icheckval
20139 cmem(i) = icheckval
20145 CALL dgamn2d(context, scope, top, m, n,
20146 $ mem(aptr), lda, rmem(raptr),
20147 $ cmem(captr), ldi,
20153 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
20154 $ .OR. allrcv )
THEN
20156 $ mem(preaptr), lda, rdest,
20157 $ cdest, myrow, mycol,
20158 $ ipre, ipost, checkval,
20159 $ testnum, maxerr, nerr,
20160 $ mem(erriptr),mem(errdptr))
20161 CALL dchkamn(scope, context, m, n,
20163 $ rmem(raptr), cmem(captr),
20164 $ ldi, testnum, maxerr,nerr,
20165 $ mem(erriptr),mem(errdptr),
20166 $ iseed, mem(valptr))
20167 CALL drcchk(ipre, ipost, icheckval,
20168 $ m, n, rmem, cmem, ldi,
20169 $ myrow, mycol, testnum,
20171 $ mem(erriptr), mem(errdptr))
20174 CALL blacs_set(context, 16, 0)
20176 CALL blacs_set(context, 15, 0)
20178 testok = ( k .EQ. nerr )
20182 IF( verb .GT. 1 )
THEN
20185 $ mem(erriptr), mem(errdptr), iseed)
20186 IF( iam .EQ. 0 )
THEN
20187 IF( testok .AND. nerr.EQ.i )
THEN
20188 WRITE(outnum,6000)testnum,
'PASSED ',
20189 $ scope, top, m, n, ldasrc,
20190 $ ldadst, ldi, rdest2, cdest2,
20194 WRITE(outnum,6000)testnum,
'FAILED ',
20195 $ scope, top, m, n, ldasrc,
20196 $ ldadst, ldi, rdest2, cdest2,
20211 IF( verb .LT. 2 )
THEN
20213 CALL dbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
20214 $ mem(errdptr), iseed )
20216 IF( iam .EQ. 0 )
THEN
20217 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
20218 IF( nfail+nskip .EQ. 0 )
THEN
20219 WRITE(outnum, 7000 ) testnum
20221 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
20228 testok = allpass( (nfail.EQ.0) )
20230 1000
FORMAT(
'DOUBLE PRECISION AMN TESTS: BEGIN.' )
20231 2000
FORMAT(1x,a7,3x,10i6)
20232 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
20234 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
20235 $
'RDEST CDEST P Q')
20236 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
20237 $
'----- ----- ---- ----')
20238 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
20239 7000
FORMAT(
'DOUBLE PRECISION AMN TESTS: PASSED ALL',
20241 8000
FORMAT(
'DOUBLE PRECISION AMN TESTS:',i5,
' TESTS;',i5,
' PASSED,',
20242 $ i5,
' SKIPPED,',i5,
' FAILED.')
20250 SUBROUTINE dchkamn( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
20251 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
20256 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
20259 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
20260 DOUBLE PRECISION A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
20263 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
20264 DOUBLE PRECISION DBTEPS, DBTABS
20265 DOUBLE PRECISION DBTRAN
20266 EXTERNAL IBTMYPROC, IBTNPROCS, IBTSPNUM, DBTRAN, DBTEPS, DBTABS
20273 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMN, CAMN
20274 INTEGER IAMN, I, J, K, H, DEST, NODE
20275 DOUBLE PRECISION EPS
20279 nprocs = ibtnprocs()
20281 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
20282 dest = myrow*nprocs + mycol
20286 IF( scope .EQ.
'R' )
THEN
20288 DO 10 i = 0, nnodes-1
20289 node = myrow * nprocs + i
20290 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20291 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20292 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20293 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20295 ELSE IF( scope .EQ.
'C' )
THEN
20297 DO 20 i = 0, nnodes-1
20298 node = i * nprocs + mycol
20299 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20300 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20301 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20302 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20305 nnodes = nprow * npcol
20306 DO 30 i = 0, nnodes-1
20307 node = (i / npcol) * nprocs + mod(i, npcol)
20308 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20309 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20310 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20311 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20318 vals(1) = dbtran( iseed )
20320 IF( nnodes .GT. 1 )
THEN
20321 DO 40 k = 1, nnodes-1
20322 vals(k+1) = dbtran( iseed(k*4+1) )
20323 IF( dbtabs( vals(k+1) ) .LT. dbtabs( vals(iamn) ) )
20330 IF( a(i,j) .NE. vals(iamn) )
THEN
20334 IF( ldi .NE. -1 )
THEN
20338 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
20339 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
20340 error = dbtabs( vals(k) ).NE.dbtabs( vals(iamn) )
20341 IF( .NOT.error ) iamn = k
20350 error = ( dbtabs( a(i,j) ) .NE. dbtabs( vals(iamn) ) )
20351 IF( .NOT.error )
THEN
20352 DO 50 k = 1, nnodes
20353 IF( vals(k) .EQ. a(i,j) )
GOTO 60
20364 erribuf(1, nerr) = testnum
20365 erribuf(2, nerr) = nnodes
20366 erribuf(3, nerr) = dest
20367 erribuf(4, nerr) = i
20368 erribuf(5, nerr) = j
20369 erribuf(6, nerr) = 5
20370 errdbuf(1, nerr) = a(i,j)
20371 errdbuf(2, nerr) = vals(iamn)
20377 IF( ldi .NE. -1 )
THEN
20378 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
20379 IF( k.NE.iamn )
THEN
20385 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
20388 error = ( vals(k) .NE. vals(iamn) )
20391 CALL ibtspcoord( scope, iamn-1, myrow, mycol,
20392 $ npcol, ramn, camn )
20393 IF( ramn .NE. ra(h) )
THEN
20395 erribuf(1, nerr) = testnum
20396 erribuf(2, nerr) = nnodes
20397 erribuf(3, nerr) = dest
20398 erribuf(4, nerr) = i
20399 erribuf(5, nerr) = j
20400 erribuf(6, nerr) = -5
20401 errdbuf(1, nerr) = ra(h)
20402 errdbuf(2, nerr) = ramn
20404 IF( camn .NE. ca(h) )
THEN
20406 erribuf(1, nerr) = testnum
20407 erribuf(2, nerr) = nnodes
20408 erribuf(3, nerr) = dest
20409 erribuf(4, nerr) = i
20410 erribuf(5, nerr) = j
20411 erribuf(6, nerr) = -15
20412 errdbuf(1, nerr) = ca(h)
20413 errdbuf(2, nerr) = camn
20428 SUBROUTINE camntest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
20429 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
20430 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
20431 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
20440 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
20441 $ topscohrnt, topsrepeat, verb
20444 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
20445 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
20446 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
20447 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
20448 COMPLEX MEM(MEMLEN)
20547 LOGICAL ALLPASS, LSAME
20548 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
20549 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
20552 EXTERNAL BLACS_GRIDINFO, CGAMN2D
20553 EXTERNAL CINITMAT, CCHKPAD, CBTCHECKIN
20556 CHARACTER*1 SCOPE, TOP
20557 LOGICAL INGRID, TESTOK, ALLRCV
20558 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, CSIZE, ERRDPTR,
20559 $ erriptr, i, iam, icheckval, ide, igr, ima, ipad, ipost,
20560 $ ipre, isc, isize, istart, istop, itc, itc1, itc2, ito,
20561 $ itr, itr1, itr2, j, k, lda, ldadst, ldasrc, ldi, m,
20562 $ maxerr, mycol, myrow, n, nerr, nfail, npcol, nprow, nskip,
20563 $ preaptr, raptr, rdest, rdest2, setwhat, testnum, valptr
20570 checkval =
cmplx( -0.91e0, -0.71e0 )
20572 checkval = iam * checkval
20573 isize = ibtsizeof(
'I')
20574 csize = ibtsizeof(
'C')
20579 IF( iam .EQ. 0 )
THEN
20580 WRITE(outnum, *)
' '
20581 WRITE(outnum, *)
' '
20582 WRITE(outnum, 1000 )
20583 IF( verb .GT. 0 )
THEN
20584 WRITE(outnum,*)
' '
20585 WRITE(outnum, 2000)
'NSCOPE:', nscope
20586 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
20587 WRITE(outnum, 2000)
'TReps :', topsrepeat
20588 WRITE(outnum, 2000)
'TCohr :', topscohrnt
20589 WRITE(outnum, 2000)
'NTOP :', ntop
20590 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
20591 WRITE(outnum, 2000)
'NMAT :', nmat
20592 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
20593 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
20594 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
20595 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
20596 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
20597 WRITE(outnum, 2000)
'NDEST :', ndest
20598 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
20599 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
20600 WRITE(outnum, 2000)
'NGRIDS:', ngrid
20601 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
20602 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
20603 WRITE(outnum, 2000)
'VERB :', verb
20604 WRITE(outnum,*)
' '
20606 IF( verb .GT. 1 )
THEN
20611 IF (topsrepeat.EQ.0)
THEN
20614 ELSE IF (topsrepeat.EQ.1)
THEN
20625 DO 10 ima = 1, nmat
20627 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
20628 IF( k .GT. i ) i = k
20630 i = i + ibtnprocs()
20631 maxerr = ( csize * (memlen-i) ) / ( csize*2 + isize*6 )
20632 IF( maxerr .LT. 1 )
THEN
20633 WRITE(outnum,*)
'ERROR: Not enough memory to run MIN tests.'
20634 CALL blacs_abort(-1, 1)
20637 erriptr = errdptr + maxerr
20645 DO 90 igr = 1, ngrid
20649 context = context0(igr)
20650 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
20651 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
20653 DO 80 isc = 1, nscope
20654 scope = scope0(isc)
20655 DO 70 ito = 1, ntop
20661 IF( lsame(top,
'M') )
THEN
20663 IF( scope .EQ.
'R' )
THEN
20664 istart = -(npcol - 1)
20666 ELSE IF (scope .EQ.
'C')
THEN
20667 istart = -(nprow - 1)
20670 istart = -(nprow*npcol - 1)
20673 ELSE IF( lsame(top,
'T') )
THEN
20676 IF( scope .EQ.
'R' )
THEN
20678 ELSE IF (scope .EQ.
'C')
THEN
20681 istop = nprow*npcol - 1
20688 DO 60 ima = 1, nmat
20691 ldasrc = ldas0(ima)
20692 ldadst = ldad0(ima)
20697 aptr = preaptr + ipre
20699 DO 50 ide = 1, ndest
20700 testnum = testnum + 1
20701 rdest2 = rdest0(ide)
20702 cdest2 = cdest0(ide)
20707 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
20711 IF (topscohrnt.EQ.0)
THEN
20714 ELSE IF (topscohrnt.EQ.1)
THEN
20727 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
20732 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
20737 valptr = aptr + ipost + n * lda
20738 IF( verb .GT. 1 )
THEN
20739 IF( iam .EQ. 0 )
THEN
20740 WRITE(outnum, 6000)
20741 $ testnum,
'RUNNING', scope, top, m, n,
20742 $ ldasrc, ldadst, ldi, rdest2, cdest2,
20751 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
20752 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
20753 $ (scope .EQ.
'A') )
THEN
20756 DO 40 itr = itr1, itr2
20757 CALL blacs_set(context, 15, itr)
20758 DO 35 itc = itc1, itc2
20759 CALL blacs_set(context, 16, itc)
20760 DO 30 j = istart, istop
20761 IF( j.EQ.0)
GOTO 30
20763 $
CALL blacs_set(context, setwhat, j)
20768 CALL cinitmat(
'G',
'-', m, n, mem(preaptr),
20769 $ lda, ipre, ipost,
20770 $ checkval, testnum,
20775 IF( ldi .NE. -1 )
THEN
20776 DO 15 i = 1, n*ldi + ipre + ipost
20777 rmem(i) = icheckval
20778 cmem(i) = icheckval
20783 DO 20 i = 1, ipre+ipost
20784 rmem(i) = icheckval
20785 cmem(i) = icheckval
20791 CALL cgamn2d(context, scope, top, m, n,
20792 $ mem(aptr), lda, rmem(raptr),
20793 $ cmem(captr), ldi,
20799 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
20800 $ .OR. allrcv )
THEN
20801 CALL cchkpad(
'G',
'-', m, n,
20802 $ mem(preaptr), lda, rdest,
20803 $ cdest, myrow, mycol,
20804 $ ipre, ipost, checkval,
20805 $ testnum, maxerr, nerr,
20806 $ mem(erriptr),mem(errdptr))
20807 CALL cchkamn(scope, context, m, n,
20809 $ rmem(raptr), cmem(captr),
20810 $ ldi, testnum, maxerr,nerr,
20811 $ mem(erriptr),mem(errdptr),
20812 $ iseed, mem(valptr))
20813 CALL crcchk(ipre, ipost, icheckval,
20814 $ m, n, rmem, cmem, ldi,
20815 $ myrow, mycol, testnum,
20817 $ mem(erriptr), mem(errdptr))
20820 CALL blacs_set(context, 16, 0)
20822 CALL blacs_set(context, 15, 0)
20824 testok = ( k .EQ. nerr )
20828 IF( verb .GT. 1 )
THEN
20830 CALL cbtcheckin(0, outnum, maxerr, nerr,
20831 $ mem(erriptr), mem(errdptr), iseed)
20832 IF( iam .EQ. 0 )
THEN
20833 IF( testok .AND. nerr.EQ.i )
THEN
20834 WRITE(outnum,6000)testnum,
'PASSED ',
20835 $ scope, top, m, n, ldasrc,
20836 $ ldadst, ldi, rdest2, cdest2,
20840 WRITE(outnum,6000)testnum,
'FAILED ',
20841 $ scope, top, m, n, ldasrc,
20842 $ ldadst, ldi, rdest2, cdest2,
20857 IF( verb .LT. 2 )
THEN
20859 CALL cbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
20860 $ mem(errdptr), iseed )
20862 IF( iam .EQ. 0 )
THEN
20863 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
20864 IF( nfail+nskip .EQ. 0 )
THEN
20865 WRITE(outnum, 7000 ) testnum
20867 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
20874 testok = allpass( (nfail.EQ.0) )
20876 1000
FORMAT(
'COMPLEX AMN TESTS: BEGIN.' )
20877 2000
FORMAT(1x,a7,3x,10i6)
20878 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
20880 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
20881 $
'RDEST CDEST P Q')
20882 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
20883 $
'----- ----- ---- ----')
20884 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
20885 7000
FORMAT(
'COMPLEX AMN TESTS: PASSED ALL',
20887 8000
FORMAT(
'COMPLEX AMN TESTS:',i5,
' TESTS;',i5,
' PASSED,',
20888 $ i5,
' SKIPPED,',i5,
' FAILED.')
20896 SUBROUTINE cchkamn( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
20897 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
20902 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
20905 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
20906 COMPLEX A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
20909 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
20910 REAL SBTEPS, CBTABS
20912 EXTERNAL IBTMYPROC, IBTNPROCS, IBTSPNUM, CBTRAN, SBTEPS, CBTABS
20919 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMN, CAMN
20920 INTEGER IAMN, I, J, K, H, DEST, NODE
20925 nprocs = ibtnprocs()
20927 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
20928 dest = myrow*nprocs + mycol
20932 IF( scope .EQ.
'R' )
THEN
20934 DO 10 i = 0, nnodes-1
20935 node = myrow * nprocs + i
20936 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20937 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20938 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20939 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20941 ELSE IF( scope .EQ.
'C' )
THEN
20943 DO 20 i = 0, nnodes-1
20944 node = i * nprocs + mycol
20945 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20946 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20947 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20948 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20951 nnodes = nprow * npcol
20952 DO 30 i = 0, nnodes-1
20953 node = (i / npcol) * nprocs + mod(i, npcol)
20954 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
20955 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
20956 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
20957 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
20964 vals(1) = cbtran( iseed )
20966 IF( nnodes .GT. 1 )
THEN
20967 DO 40 k = 1, nnodes-1
20968 vals(k+1) = cbtran( iseed(k*4+1) )
20969 IF( cbtabs( vals(k+1) ) .LT. cbtabs( vals(iamn) ) )
20976 IF( a(i,j) .NE. vals(iamn) )
THEN
20980 IF( ldi .NE. -1 )
THEN
20984 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
20985 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
20986 error = abs( cbtabs(vals(k)) - cbtabs(vals(iamn)) )
20988 IF( .NOT.error ) iamn = k
20997 error = abs( cbtabs(a(i,j)) - cbtabs(vals(iamn)) )
20999 IF( .NOT.error )
THEN
21000 DO 50 k = 1, nnodes
21001 IF( vals(k) .EQ. a(i,j) )
GOTO 60
21012 erribuf(1, nerr) = testnum
21013 erribuf(2, nerr) = nnodes
21014 erribuf(3, nerr) = dest
21015 erribuf(4, nerr) = i
21016 erribuf(5, nerr) = j
21017 erribuf(6, nerr) = 5
21018 errdbuf(1, nerr) = a(i,j)
21019 errdbuf(2, nerr) = vals(iamn)
21025 IF( ldi .NE. -1 )
THEN
21026 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
21027 IF( k.NE.iamn )
THEN
21033 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
21036 error = ( vals(k) .NE. vals(iamn) )
21039 CALL ibtspcoord( scope, iamn-1, myrow, mycol,
21040 $ npcol, ramn, camn )
21041 IF( ramn .NE. ra(h) )
THEN
21043 erribuf(1, nerr) = testnum
21044 erribuf(2, nerr) = nnodes
21045 erribuf(3, nerr) = dest
21046 erribuf(4, nerr) = i
21047 erribuf(5, nerr) = j
21048 erribuf(6, nerr) = -5
21049 errdbuf(1, nerr) = ra(h)
21050 errdbuf(2, nerr) = ramn
21052 IF( camn .NE. ca(h) )
THEN
21054 erribuf(1, nerr) = testnum
21055 erribuf(2, nerr) = nnodes
21056 erribuf(3, nerr) = dest
21057 erribuf(4, nerr) = i
21058 erribuf(5, nerr) = j
21059 erribuf(6, nerr) = -15
21060 errdbuf(1, nerr) = ca(h)
21061 errdbuf(2, nerr) = camn
21076 SUBROUTINE zamntest( OUTNUM, VERB, TOPSREPEAT, TOPSCOHRNT, NSCOPE,
21077 $ SCOPE0, NTOP, TOP0, NMAT, M0, N0, LDAS0,
21078 $ LDAD0, LDI0, NDEST, RDEST0, CDEST0, NGRID,
21079 $ CONTEXT0, P0, Q0, ISEED, RMEM, CMEM, RCLEN,
21088 INTEGER MEMLEN, NDEST, NGRID, NMAT, NSCOPE, NTOP, OUTNUM, RCLEN,
21089 $ TOPSCOHRNT, TOPSREPEAT, VERB
21092 CHARACTER*1 SCOPE0(NSCOPE), TOP0(NTOP)
21093 INTEGER M0(NMAT), N0(NMAT), LDAS0(NMAT), LDAD0(NMAT), LDI0(NMAT)
21094 INTEGER RDEST0(NDEST), CDEST0(NDEST), CONTEXT0(NGRID)
21095 INTEGER P0(NGRID), Q0(NGRID), ISEED(*), RMEM(RCLEN), CMEM(RCLEN)
21096 DOUBLE COMPLEX MEM(MEMLEN)
21195 LOGICAL ALLPASS, LSAME
21196 INTEGER IBTMYPROC, IBTNPROCS, IBTSIZEOF
21197 EXTERNAL ALLPASS, LSAME, IBTMYPROC, IBTNPROCS, IBTSIZEOF
21200 EXTERNAL blacs_gridinfo, zgamn2d
21204 CHARACTER*1 SCOPE, TOP
21205 LOGICAL INGRID, TESTOK, ALLRCV
21206 INTEGER APTR, CAPTR, CDEST, CDEST2, CONTEXT, ERRDPTR, ERRIPTR, I,
21207 $ IAM, ICHECKVAL, IDE, IGR, IMA, IPAD, IPOST, IPRE, ISC,
21208 $ isize, istart, istop, itc, itc1, itc2, ito, itr, itr1,
21209 $ itr2, j, k, lda, ldadst, ldasrc, ldi, m, maxerr, mycol,
21210 $ myrow, n, nerr, nfail, npcol, nprow, nskip, preaptr,
21211 $ raptr, rdest, rdest2, setwhat, testnum, valptr, zsize
21212 DOUBLE COMPLEX CHECKVAL
21218 checkval = dcmplx( -9.11d0, -9.21d0 )
21220 checkval = iam * checkval
21221 isize = ibtsizeof(
'I')
21222 zsize = ibtsizeof(
'Z')
21227 IF( iam .EQ. 0 )
THEN
21228 WRITE(outnum, *)
' '
21229 WRITE(outnum, *)
' '
21230 WRITE(outnum, 1000 )
21231 IF( verb .GT. 0 )
THEN
21232 WRITE(outnum,*)
' '
21233 WRITE(outnum, 2000)
'NSCOPE:', nscope
21234 WRITE(outnum, 3000)
' SCOPE:', ( scope0(i), i = 1, nscope )
21235 WRITE(outnum, 2000)
'TReps :', topsrepeat
21236 WRITE(outnum, 2000)
'TCohr :', topscohrnt
21237 WRITE(outnum, 2000)
'NTOP :', ntop
21238 WRITE(outnum, 3000)
' TOP :', ( top0(i), i = 1, ntop )
21239 WRITE(outnum, 2000)
'NMAT :', nmat
21240 WRITE(outnum, 2000)
' M :', ( m0(i), i = 1, nmat )
21241 WRITE(outnum, 2000)
' N :', ( n0(i), i = 1, nmat )
21242 WRITE(outnum, 2000)
' LDAS :', ( ldas0(i), i = 1, nmat )
21243 WRITE(outnum, 2000)
' LDAD :', ( ldad0(i), i = 1, nmat )
21244 WRITE(outnum, 2000)
' LDI :', ( ldi0(i), i = 1, nmat )
21245 WRITE(outnum, 2000)
'NDEST :', ndest
21246 WRITE(outnum, 2000)
' RDEST:',( rdest0(i), i = 1, ndest )
21247 WRITE(outnum, 2000)
' CDEST:',( cdest0(i), i = 1, ndest )
21248 WRITE(outnum, 2000)
'NGRIDS:', ngrid
21249 WRITE(outnum, 2000)
' P :', ( p0(i), i = 1, ngrid )
21250 WRITE(outnum, 2000)
' Q :', ( q0(i), i = 1, ngrid )
21251 WRITE(outnum, 2000)
'VERB :', verb
21252 WRITE(outnum,*)
' '
21254 IF( verb .GT. 1 )
THEN
21259 IF (topsrepeat.EQ.0)
THEN
21262 ELSE IF (topsrepeat.EQ.1)
THEN
21273 DO 10 ima = 1, nmat
21275 k = n0(ima) * max0( ldas0(ima), ldad0(ima) ) + ipad
21276 IF( k .GT. i ) i = k
21278 i = i + ibtnprocs()
21279 maxerr = ( zsize * (memlen-i) ) / ( zsize*2 + isize*6 )
21280 IF( maxerr .LT. 1 )
THEN
21281 WRITE(outnum,*)
'ERROR: Not enough memory to run MIN tests.'
21282 CALL blacs_abort(-1, 1)
21285 erriptr = errdptr + maxerr
21293 DO 90 igr = 1, ngrid
21297 context = context0(igr)
21298 CALL blacs_gridinfo( context, nprow, npcol, myrow, mycol )
21299 ingrid = ( (myrow.LT.nprow) .AND. (mycol.LT.npcol) )
21301 DO 80 isc = 1, nscope
21302 scope = scope0(isc)
21303 DO 70 ito = 1, ntop
21309 IF( lsame(top,
'M') )
THEN
21311 IF( scope .EQ.
'R' )
THEN
21312 istart = -(npcol - 1)
21314 ELSE IF (scope .EQ.
'C')
THEN
21315 istart = -(nprow - 1)
21318 istart = -(nprow*npcol - 1)
21321 ELSE IF( lsame(top,
'T') )
THEN
21324 IF( scope .EQ.
'R' )
THEN
21326 ELSE IF (scope .EQ.
'C')
THEN
21329 istop = nprow*npcol - 1
21336 DO 60 ima = 1, nmat
21339 ldasrc = ldas0(ima)
21340 ldadst = ldad0(ima)
21345 aptr = preaptr + ipre
21347 DO 50 ide = 1, ndest
21348 testnum = testnum + 1
21349 rdest2 = rdest0(ide)
21350 cdest2 = cdest0(ide)
21355 allrcv = ( (rdest2.EQ.-1) .OR. (cdest2.EQ.-1) )
21359 IF (topscohrnt.EQ.0)
THEN
21362 ELSE IF (topscohrnt.EQ.1)
THEN
21375 IF( rdest.GE.p0(igr) .OR. cdest.GE.q0(igr) )
THEN
21380 IF( myrow.EQ.rdest .AND. mycol.EQ.cdest )
THEN
21385 valptr = aptr + ipost + n * lda
21386 IF( verb .GT. 1 )
THEN
21387 IF( iam .EQ. 0 )
THEN
21388 WRITE(outnum, 6000)
21389 $ testnum,
'RUNNING', scope, top, m, n,
21390 $ ldasrc, ldadst, ldi, rdest2, cdest2,
21399 IF( (myrow.EQ.rdest .AND. scope.EQ.
'R') .OR.
21400 $ (mycol.EQ.cdest .AND. scope.EQ.
'C') .OR.
21401 $ (scope .EQ.
'A') )
THEN
21404 DO 40 itr = itr1, itr2
21405 CALL blacs_set(context, 15, itr)
21406 DO 35 itc = itc1, itc2
21407 CALL blacs_set(context, 16, itc)
21408 DO 30 j = istart, istop
21409 IF( j.EQ.0)
GOTO 30
21411 $
CALL blacs_set(context, setwhat, j)
21416 CALL zinitmat(
'G',
'-', m, n, mem(preaptr),
21417 $ lda, ipre, ipost,
21418 $ checkval, testnum,
21423 IF( ldi .NE. -1 )
THEN
21424 DO 15 i = 1, n*ldi + ipre + ipost
21425 rmem(i) = icheckval
21426 cmem(i) = icheckval
21431 DO 20 i = 1, ipre+ipost
21432 rmem(i) = icheckval
21433 cmem(i) = icheckval
21439 CALL zgamn2d(context, scope, top, m, n,
21440 $ mem(aptr), lda, rmem(raptr),
21441 $ cmem(captr), ldi,
21447 IF( (myrow.EQ.rdest .AND. mycol.EQ.cdest)
21448 $ .OR. allrcv )
THEN
21450 $ mem(preaptr), lda, rdest,
21451 $ cdest, myrow, mycol,
21452 $ ipre, ipost, checkval,
21453 $ testnum, maxerr, nerr,
21454 $ mem(erriptr),mem(errdptr))
21455 CALL zchkamn(scope, context, m, n,
21457 $ rmem(raptr), cmem(captr),
21458 $ ldi, testnum, maxerr,nerr,
21459 $ mem(erriptr),mem(errdptr),
21460 $ iseed, mem(valptr))
21461 CALL zrcchk(ipre, ipost, icheckval,
21462 $ m, n, rmem, cmem, ldi,
21463 $ myrow, mycol, testnum,
21465 $ mem(erriptr), mem(errdptr))
21468 CALL blacs_set(context, 16, 0)
21470 CALL blacs_set(context, 15, 0)
21472 testok = ( k .EQ. nerr )
21476 IF( verb .GT. 1 )
THEN
21479 $ mem(erriptr), mem(errdptr), iseed)
21480 IF( iam .EQ. 0 )
THEN
21481 IF( testok .AND. nerr.EQ.i )
THEN
21482 WRITE(outnum,6000)testnum,
'PASSED ',
21483 $ scope, top, m, n, ldasrc,
21484 $ ldadst, ldi, rdest2, cdest2,
21488 WRITE(outnum,6000)testnum,
'FAILED ',
21489 $ scope, top, m, n, ldasrc,
21490 $ ldadst, ldi, rdest2, cdest2,
21505 IF( verb .LT. 2 )
THEN
21507 CALL zbtcheckin( nfail, outnum, maxerr, nerr, mem(erriptr),
21508 $ mem(errdptr), iseed )
21510 IF( iam .EQ. 0 )
THEN
21511 IF( verb .GT. 1 )
WRITE(outnum,*)
' '
21512 IF( nfail+nskip .EQ. 0 )
THEN
21513 WRITE(outnum, 7000 ) testnum
21515 WRITE(outnum, 8000 ) testnum, testnum-nskip-nfail,
21522 testok = allpass( (nfail.EQ.0) )
21524 1000
FORMAT(
'DOUBLE COMPLEX AMN TESTS: BEGIN.' )
21525 2000
FORMAT(1x,a7,3x,10i6)
21526 3000
FORMAT(1x,a7,3x,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,5x,a1,
21528 4000
FORMAT(
' TEST# STATUS SCOPE TOP M N LDAS LDAD LDI ',
21529 $
'RDEST CDEST P Q')
21530 5000
FORMAT(
' ----- ------- ----- --- ----- ----- ----- ----- ----- ',
21531 $
'----- ----- ---- ----')
21532 6000
FORMAT(i6,1x,a7,5x,a1,3x,a1,7i6,2i5)
21533 7000
FORMAT(
'DOUBLE COMPLEX AMN TESTS: PASSED ALL',
21535 8000
FORMAT(
'DOUBLE COMPLEX AMN TESTS:',i5,
' TESTS;',i5,
' PASSED,',
21536 $ i5,
' SKIPPED,',i5,
' FAILED.')
21544 SUBROUTINE zchkamn( SCOPE, ICTXT, M, N, A, LDA, RA, CA, LDI,
21545 $ TESTNUM, MAXERR, NERR, ERRIBUF, ERRDBUF,
21550 INTEGER ICTXT, M, N, LDA, LDI, TESTNUM, MAXERR, NERR
21553 INTEGER RA(*), CA(*), ERRIBUF(6, MAXERR), ISEED(*)
21554 DOUBLE COMPLEX A(LDA,*), ERRDBUF(2, MAXERR), VALS(*)
21557 INTEGER IBTMYPROC, IBTNPROCS, IBTSPNUM
21558 DOUBLE PRECISION DBTEPS, ZBTABS
21559 DOUBLE COMPLEX ZBTRAN
21560 EXTERNAL ibtmyproc, ibtnprocs, ibtspnum, zbtran, dbteps, zbtabs
21567 INTEGER NPROCS, NNODES, NPROW, NPCOL, MYROW, MYCOL, RAMN, CAMN
21568 INTEGER IAMN, I, J, K, H, DEST, NODE
21569 DOUBLE PRECISION EPS
21573 nprocs = ibtnprocs()
21575 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
21576 dest = myrow*nprocs + mycol
21580 IF( scope .EQ.
'R' )
THEN
21582 DO 10 i = 0, nnodes-1
21583 node = myrow * nprocs + i
21584 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
21585 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
21586 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
21587 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
21589 ELSE IF( scope .EQ.
'C' )
THEN
21591 DO 20 i = 0, nnodes-1
21592 node = i * nprocs + mycol
21593 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
21594 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
21595 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
21596 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
21599 nnodes = nprow * npcol
21600 DO 30 i = 0, nnodes-1
21601 node = (i / npcol) * nprocs + mod(i, npcol)
21602 iseed(i*4+1) = mod( 1002 + testnum*5 + node*3, 4096 )
21603 iseed(i*4+2) = mod( 2027 + testnum*7 + node, 4096 )
21604 iseed(i*4+3) = mod( 1234 + testnum + node*3, 4096 )
21605 iseed(i*4+4) = mod( 4311 + testnum*10 + node*2, 4096 )
21612 vals(1) = zbtran( iseed )
21614 IF( nnodes .GT. 1 )
THEN
21615 DO 40 k = 1, nnodes-1
21616 vals(k+1) = zbtran( iseed(k*4+1) )
21617 IF( zbtabs( vals(k+1) ) .LT. zbtabs( vals(iamn) ) )
21624 IF( a(i,j) .NE. vals(iamn) )
THEN
21628 IF( ldi .NE. -1 )
THEN
21632 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
21633 IF( k.GT.0 .AND. k.LE.nnodes )
THEN
21634 error = abs( zbtabs(vals(k)) - zbtabs(vals(iamn)) )
21636 IF( .NOT.error ) iamn = k
21645 error = abs( zbtabs(a(i,j)) - zbtabs(vals(iamn)) )
21647 IF( .NOT.error )
THEN
21648 DO 50 k = 1, nnodes
21649 IF( vals(k) .EQ. a(i,j) )
GOTO 60
21660 erribuf(1, nerr) = testnum
21661 erribuf(2, nerr) = nnodes
21662 erribuf(3, nerr) = dest
21663 erribuf(4, nerr) = i
21664 erribuf(5, nerr) = j
21665 erribuf(6, nerr) = 5
21666 errdbuf(1, nerr) = a(i,j)
21667 errdbuf(2, nerr) = vals(iamn)
21673 IF( ldi .NE. -1 )
THEN
21674 k = ibtspnum( scope, ra(h), ca(h), npcol ) + 1
21675 IF( k.NE.iamn )
THEN
21681 IF( k.GT.nnodes .OR. k.LT.1 )
THEN
21684 error = ( vals(k) .NE. vals(iamn) )
21687 CALL ibtspcoord( scope, iamn-1, myrow, mycol,
21688 $ npcol, ramn, camn )
21689 IF( ramn .NE. ra(h) )
THEN
21691 erribuf(1, nerr) = testnum
21692 erribuf(2, nerr) = nnodes
21693 erribuf(3, nerr) = dest
21694 erribuf(4, nerr) = i
21695 erribuf(5, nerr) = j
21696 erribuf(6, nerr) = -5
21697 errdbuf(1, nerr) = ra(h)
21698 errdbuf(2, nerr) = ramn
21700 IF( camn .NE. ca(h) )
THEN
21702 erribuf(1, nerr) = testnum
21703 erribuf(2, nerr) = nnodes
21704 erribuf(3, nerr) = dest
21705 erribuf(4, nerr) = i
21706 erribuf(5, nerr) = j
21707 erribuf(6, nerr) = -15
21708 errdbuf(1, nerr) = ca(h)
21709 errdbuf(2, nerr) = camn