SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ pvdescchk()

subroutine pvdescchk ( integer  ictxt,
integer  nout,
character*1  matrix,
integer, dimension( * )  descx,
integer  dtx,
integer  mx,
integer  nx,
integer  imbx,
integer  inbx,
integer  mbx,
integer  nbx,
integer  rsrcx,
integer  csrcx,
integer  incx,
integer  mpx,
integer  nqx,
integer  iprex,
integer  imidx,
integer  ipostx,
integer  igap,
integer  gapmul,
integer  info 
)

Definition at line 384 of file pblastim.f.

388*
389* -- PBLAS test routine (version 2.0) --
390* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
391* and University of California, Berkeley.
392* April 1, 1998
393*
394* .. Scalar Arguments ..
395 CHARACTER*1 MATRIX
396 INTEGER CSRCX, DTX, GAPMUL, ICTXT, IGAP, IMBX, IMIDX,
397 $ INBX, INCX, INFO, IPOSTX, IPREX, MBX, MPX, MX,
398 $ NBX, NOUT, NQX, NX, RSRCX
399* ..
400* .. Array Arguments ..
401 INTEGER DESCX( * )
402* ..
403*
404* Purpose
405* =======
406*
407* PVDESCCHK checks the validity of the input test parameters and ini-
408* tializes the descriptor DESCX and the scalar variables MPX, NQX. In
409* case of an invalid parameter, this routine displays error messages
410* and return an non-zero error code in INFO.
411*
412* Notes
413* =====
414*
415* A description vector is associated with each 2D block-cyclicly dis-
416* tributed matrix. This vector stores the information required to
417* establish the mapping between a matrix entry and its corresponding
418* process and memory location.
419*
420* In the following comments, the character _ should be read as
421* "of the distributed matrix". Let A be a generic term for any 2D
422* block cyclicly distributed matrix. Its description vector is DESCA:
423*
424* NOTATION STORED IN EXPLANATION
425* ---------------- --------------- ------------------------------------
426* DTYPE_A (global) DESCA( DTYPE_ ) The descriptor type.
427* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
428* the NPROW x NPCOL BLACS process grid
429* A is distributed over. The context
430* itself is global, but the handle
431* (the integer value) may vary.
432* M_A (global) DESCA( M_ ) The number of rows in the distribu-
433* ted matrix A, M_A >= 0.
434* N_A (global) DESCA( N_ ) The number of columns in the distri-
435* buted matrix A, N_A >= 0.
436* IMB_A (global) DESCA( IMB_ ) The number of rows of the upper left
437* block of the matrix A, IMB_A > 0.
438* INB_A (global) DESCA( INB_ ) The number of columns of the upper
439* left block of the matrix A,
440* INB_A > 0.
441* MB_A (global) DESCA( MB_ ) The blocking factor used to distri-
442* bute the last M_A-IMB_A rows of A,
443* MB_A > 0.
444* NB_A (global) DESCA( NB_ ) The blocking factor used to distri-
445* bute the last N_A-INB_A columns of
446* A, NB_A > 0.
447* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
448* row of the matrix A is distributed,
449* NPROW > RSRC_A >= 0.
450* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
451* first column of A is distributed.
452* NPCOL > CSRC_A >= 0.
453* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
454* array storing the local blocks of
455* the distributed matrix A,
456* IF( Lc( 1, N_A ) > 0 )
457* LLD_A >= MAX( 1, Lr( 1, M_A ) )
458* ELSE
459* LLD_A >= 1.
460*
461* Let K be the number of rows of a matrix A starting at the global in-
462* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
463* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
464* receive if these K rows were distributed over NPROW processes. If K
465* is the number of columns of a matrix A starting at the global index
466* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
467* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
468* these K columns were distributed over NPCOL processes.
469*
470* The values of Lr() and Lc() may be determined via a call to the func-
471* tion PB_NUMROC:
472* Lr( IA, K ) = PB_NUMROC( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
473* Lc( JA, K ) = PB_NUMROC( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
474*
475* Arguments
476* =========
477*
478* ICTXT (local input) INTEGER
479* On entry, ICTXT specifies the BLACS context handle, indica-
480* ting the global context of the operation. The context itself
481* is global, but the value of ICTXT is local.
482*
483* NOUT (global input) INTEGER
484* On entry, NOUT specifies the unit number for the output file.
485* When NOUT is 6, output to screen, when NOUT is 0, output to
486* stderr. NOUT is only defined for process 0.
487*
488* MATRIX (global input) CHARACTER*1
489* On entry, MATRIX specifies the one character matrix identi-
490* fier.
491*
492* DESCX (global output) INTEGER array
493* On entry, DESCX is an array of dimension DLEN_. DESCX is the
494* array descriptor to be set.
495*
496* DTYPEX (global input) INTEGER
497* On entry, DTYPEX specifies the descriptor type. In this ver-
498* sion, DTYPEX must be BLOCK_CYCLIC_INB_2D.
499*
500* MX (global input) INTEGER
501* On entry, MX specifies the number of rows in the matrix. MX
502* must be at least zero.
503*
504* NX (global input) INTEGER
505* On entry, NX specifies the number of columns in the matrix.
506* NX must be at least zero.
507*
508* IMBX (global input) INTEGER
509* On entry, IMBX specifies the row blocking factor used to dis-
510* tribute the first IMBX rows of the matrix. IMBX must be at
511* least one.
512*
513* INBX (global input) INTEGER
514* On entry, INBX specifies the column blocking factor used to
515* distribute the first INBX columns of the matrix. INBX must
516* be at least one.
517*
518* MBX (global input) INTEGER
519* On entry, MBX specifies the row blocking factor used to dis-
520* tribute the rows of the matrix. MBX must be at least one.
521*
522* NBX (global input) INTEGER
523* On entry, NBX specifies the column blocking factor used to
524* distribute the columns of the matrix. NBX must be at least
525* one.
526*
527* RSRCX (global input) INTEGER
528* On entry, RSRCX specifies the process row in which the first
529* row of the matrix resides. When RSRCX is -1, the matrix is
530* row replicated, otherwise RSCRX must be at least zero and
531* strictly less than NPROW.
532*
533* CSRCX (global input) INTEGER
534* On entry, CSRCX specifies the process column in which the
535* first column of the matrix resides. When CSRCX is -1, the
536* matrix is column replicated, otherwise CSCRX must be at least
537* zero and strictly less than NPCOL.
538*
539* INCX (global input) INTEGER
540* On entry, INCX specifies the global vector increment. INCX
541* must be one or MX.
542*
543* MPX (local output) INTEGER
544* On exit, MPX is Lr( 1, MX ).
545*
546* NQX (local output) INTEGER
547* On exit, NQX is Lc( 1, NX ).
548*
549* IPREX (local output) INTEGER
550* On exit, IPREX specifies the size of the guard zone to put
551* before the start of the local padded array.
552*
553* IMIDX (local output) INTEGER
554* On exit, IMIDX specifies the ldx-gap of the guard zone to
555* put after each column of the local padded array.
556*
557* IPOSTX (local output) INTEGER
558* On exit, IPOSTX specifies the size of the guard zone to put
559* after the local padded array.
560*
561* IGAP (global input) INTEGER
562* On entry, IGAP specifies the size of the ldx-gap.
563*
564* GAPMUL (global input) INTEGER
565* On entry, GAPMUL is a constant factor controlling the size
566* of the pre- and post guardzone.
567*
568* INFO (global output) INTEGER
569* On exit, when INFO is zero, no error has been detected,
570* otherwise an error has been detected.
571*
572* -- Written on April 1, 1998 by
573* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
574*
575* =====================================================================
576*
577* .. Parameters ..
578 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
579 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
580 $ RSRC_
581 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
582 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
583 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
584 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
585* ..
586* .. Local Scalars ..
587 INTEGER LLDX, MYCOL, MYROW, NPCOL, NPROW
588* ..
589* .. External Subroutines ..
590 EXTERNAL blacs_gridinfo, igsum2d, pb_descinit2
591* ..
592* .. External Functions ..
593 INTEGER PB_NUMROC
594 EXTERNAL pb_numroc
595* ..
596* .. Intrinsic Functions ..
597 INTRINSIC max
598* ..
599* .. Executable Statements ..
600*
601 info = 0
602 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
603*
604* Verify descriptor type DTYPE_
605*
606 IF( dtx.NE.block_cyclic_2d_inb ) THEN
607 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
608 $ WRITE( nout, fmt = 9999 ) matrix, 'DTYPE', matrix, dtx,
609 $ block_cyclic_2d_inb
610 info = 1
611 END IF
612*
613* Verify global matrix dimensions (M_,N_) are correct
614*
615 IF( mx.LT.0 ) THEN
616 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
617 $ WRITE( nout, fmt = 9998 ) matrix, 'M', matrix, mx
618 info = 1
619 ELSE IF( nx.LT.0 ) THEN
620 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
621 $ WRITE( nout, fmt = 9997 ) matrix, 'N', matrix, nx
622 info = 1
623 END IF
624*
625* Verify if blocking factors (IMB_, INB_) are correct
626*
627 IF( imbx.LT.1 ) THEN
628 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
629 $ WRITE( nout, fmt = 9996 ) matrix, 'IMB', matrix, imbx
630 info = 1
631 ELSE IF( inbx.LT.1 ) THEN
632 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
633 $ WRITE( nout, fmt = 9995 ) matrix, 'INB', matrix, inbx
634 info = 1
635 END IF
636*
637* Verify if blocking factors (MB_, NB_) are correct
638*
639 IF( mbx.LT.1 ) THEN
640 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
641 $ WRITE( nout, fmt = 9994 ) matrix, 'MB', matrix, mbx
642 info = 1
643 ELSE IF( nbx.LT.1 ) THEN
644 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
645 $ WRITE( nout, fmt = 9993 ) matrix, 'NB', matrix, nbx
646 info = 1
647 END IF
648*
649* Verify if origin process coordinates (RSRC_, CSRC_) are valid
650*
651 IF( rsrcx.LT.-1 .OR. rsrcx.GE.nprow ) THEN
652 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
653 WRITE( nout, fmt = 9992 ) matrix
654 WRITE( nout, fmt = 9990 ) 'RSRC', matrix, rsrcx, nprow
655 END IF
656 info = 1
657 ELSE IF( csrcx.LT.-1 .OR. csrcx.GE.npcol ) THEN
658 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
659 WRITE( nout, fmt = 9991 ) matrix
660 WRITE( nout, fmt = 9990 ) 'CSRC', matrix, csrcx, npcol
661 END IF
662 info = 1
663 END IF
664*
665* Check input increment value
666*
667 IF( incx.NE.1 .AND. incx.NE.mx ) THEN
668 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
669 WRITE( nout, fmt = 9989 ) matrix
670 WRITE( nout, fmt = 9988 ) 'INC', matrix, incx, matrix, mx
671 END IF
672 info = 1
673 END IF
674*
675* Check all processes for an error
676*
677 CALL igsum2d( ictxt, 'All', ' ', 1, 1, info, 1, -1, 0 )
678*
679 IF( info.NE.0 ) THEN
680*
681 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
682 WRITE( nout, fmt = 9987 ) matrix
683 WRITE( nout, fmt = * )
684 END IF
685*
686 ELSE
687*
688* Compute local testing leading dimension
689*
690 mpx = pb_numroc( mx, 1, imbx, mbx, myrow, rsrcx, nprow )
691 nqx = pb_numroc( nx, 1, inbx, nbx, mycol, csrcx, npcol )
692 iprex = max( gapmul*nbx, mpx )
693 imidx = igap
694 ipostx = max( gapmul*nbx, nqx )
695 lldx = max( 1, mpx ) + imidx
696*
697 CALL pb_descinit2( descx, mx, nx, imbx, inbx, mbx, nbx, rsrcx,
698 $ csrcx, ictxt, lldx, info )
699*
700* Check all processes for an error
701*
702 CALL igsum2d( ictxt, 'All', ' ', 1, 1, info, 1, -1, 0 )
703*
704 IF( info.NE.0 ) THEN
705 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
706 WRITE( nout, fmt = 9987 ) matrix
707 WRITE( nout, fmt = * )
708 END IF
709 END IF
710*
711 END IF
712*
713 9999 FORMAT( 2x, '>> Invalid matrix ', a1, ' descriptor type ', a5, a1,
714 $ ': ', i6, ' should be ', i3, '.' )
715 9998 FORMAT( 2x, '>> Invalid matrix ', a1, ' row dimension ', a1, a1,
716 $ ': ', i6, ' should be at least 1.' )
717 9997 FORMAT( 2x, '>> Invalid matrix ', a1, ' column dimension ', a1,
718 $ a1, ': ', i6, ' should be at least 1.' )
719 9996 FORMAT( 2x, '>> Invalid matrix ', a1, ' first row block size ',
720 $ a3, a1, ': ', i6, ' should be at least 1.' )
721 9995 FORMAT( 2x, '>> Invalid matrix ', a1, ' first column block size ',
722 $ a3, a1,': ', i6, ' should be at least 1.' )
723 9994 FORMAT( 2x, '>> Invalid matrix ', a1, ' row block size ', a2, a1,
724 $ ': ', i6, ' should be at least 1.' )
725 9993 FORMAT( 2x, '>> Invalid matrix ', a1, ' column block size ', a2,
726 $ a1,': ', i6, ' should be at least 1.' )
727 9992 FORMAT( 2x, '>> Invalid matrix ', a1, ' row process source:' )
728 9991 FORMAT( 2x, '>> Invalid matrix ', a1, ' column process source:' )
729 9990 FORMAT( 2x, '>> ', a4, a1, '= ', i6, ' should be >= -1 and < ',
730 $ i6, '.' )
731 9989 FORMAT( 2x, '>> Invalid vector ', a1, ' increment:' )
732 9988 FORMAT( 2x, '>> ', a3, a1, '= ', i6, ' should be 1 or M', a1,
733 $ ' = ', i6, '.' )
734 9987 FORMAT( 2x, '>> Invalid matrix ', a1, ' descriptor: going on to ',
735 $ 'next test case.' )
736*
737 RETURN
738*
739* End of PVDESCCHK
740*
subroutine pb_descinit2(desc, m, n, imb, inb, mb, nb, rsrc, csrc, ctxt, lld, info)
Definition pblastst.f:3337
integer function pb_numroc(n, i, inb, nb, proc, srcproc, nprocs)
Definition pblastst.f:2548
#define max(A, B)
Definition pcgemr.c:180