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

◆ pmdescchk()

subroutine pmdescchk ( integer  ictxt,
integer  nout,
character*1  matrix,
integer, dimension( * )  desca,
integer  dta,
integer  ma,
integer  na,
integer  imba,
integer  inba,
integer  mba,
integer  nba,
integer  rsrca,
integer  csrca,
integer  mpa,
integer  nqa,
integer  iprea,
integer  imida,
integer  iposta,
integer  igap,
integer  gapmul,
integer  info 
)

Definition at line 742 of file pblastim.f.

746*
747* -- PBLAS test routine (version 2.0) --
748* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
749* and University of California, Berkeley.
750* April 1, 1998
751*
752* .. Scalar Arguments ..
753 CHARACTER*1 MATRIX
754 INTEGER CSRCA, DTA, GAPMUL, ICTXT, IGAP, IMBA, IMIDA,
755 $ INBA, INFO, IPOSTA, IPREA, MA, MBA, MPA, NA,
756 $ NBA, NOUT, NQA, RSRCA
757* ..
758* .. Array Arguments ..
759 INTEGER DESCA( * )
760* ..
761*
762* Purpose
763* =======
764*
765* PMDESCCHK checks the validity of the input test parameters and ini-
766* tializes the descriptor DESCA and the scalar variables MPA, NQA. In
767* case of an invalid parameter, this routine displays error messages
768* and return an non-zero error code in INFO.
769*
770* Notes
771* =====
772*
773* A description vector is associated with each 2D block-cyclicly dis-
774* tributed matrix. This vector stores the information required to
775* establish the mapping between a matrix entry and its corresponding
776* process and memory location.
777*
778* In the following comments, the character _ should be read as
779* "of the distributed matrix". Let A be a generic term for any 2D
780* block cyclicly distributed matrix. Its description vector is DESCA:
781*
782* NOTATION STORED IN EXPLANATION
783* ---------------- --------------- ------------------------------------
784* DTYPE_A (global) DESCA( DTYPE_ ) The descriptor type.
785* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
786* the NPROW x NPCOL BLACS process grid
787* A is distributed over. The context
788* itself is global, but the handle
789* (the integer value) may vary.
790* M_A (global) DESCA( M_ ) The number of rows in the distribu-
791* ted matrix A, M_A >= 0.
792* N_A (global) DESCA( N_ ) The number of columns in the distri-
793* buted matrix A, N_A >= 0.
794* IMB_A (global) DESCA( IMB_ ) The number of rows of the upper left
795* block of the matrix A, IMB_A > 0.
796* INB_A (global) DESCA( INB_ ) The number of columns of the upper
797* left block of the matrix A,
798* INB_A > 0.
799* MB_A (global) DESCA( MB_ ) The blocking factor used to distri-
800* bute the last M_A-IMB_A rows of A,
801* MB_A > 0.
802* NB_A (global) DESCA( NB_ ) The blocking factor used to distri-
803* bute the last N_A-INB_A columns of
804* A, NB_A > 0.
805* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
806* row of the matrix A is distributed,
807* NPROW > RSRC_A >= 0.
808* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
809* first column of A is distributed.
810* NPCOL > CSRC_A >= 0.
811* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
812* array storing the local blocks of
813* the distributed matrix A,
814* IF( Lc( 1, N_A ) > 0 )
815* LLD_A >= MAX( 1, Lr( 1, M_A ) )
816* ELSE
817* LLD_A >= 1.
818*
819* Let K be the number of rows of a matrix A starting at the global in-
820* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
821* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
822* receive if these K rows were distributed over NPROW processes. If K
823* is the number of columns of a matrix A starting at the global index
824* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
825* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
826* these K columns were distributed over NPCOL processes.
827*
828* The values of Lr() and Lc() may be determined via a call to the func-
829* tion PB_NUMROC:
830* Lr( IA, K ) = PB_NUMROC( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
831* Lc( JA, K ) = PB_NUMROC( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
832*
833* Arguments
834* =========
835*
836* ICTXT (local input) INTEGER
837* On entry, ICTXT specifies the BLACS context handle, indica-
838* ting the global context of the operation. The context itself
839* is global, but the value of ICTXT is local.
840*
841* NOUT (global input) INTEGER
842* On entry, NOUT specifies the unit number for the output file.
843* When NOUT is 6, output to screen, when NOUT is 0, output to
844* stderr. NOUT is only defined for process 0.
845*
846* MATRIX (global input) CHARACTER*1
847* On entry, MATRIX specifies the one character matrix identi-
848* fier.
849*
850* DESCA (global output) INTEGER array
851* On entry, DESCA is an array of dimension DLEN_. DESCA is the
852* array descriptor to be set.
853*
854* DTYPEA (global input) INTEGER
855* On entry, DTYPEA specifies the descriptor type. In this ver-
856* sion, DTYPEA must be BLOCK_CYCLIC_INB_2D.
857*
858* MA (global input) INTEGER
859* On entry, MA specifies the number of rows in the matrix. MA
860* must be at least zero.
861*
862* NA (global input) INTEGER
863* On entry, NA specifies the number of columns in the matrix.
864* NA must be at least zero.
865*
866* IMBA (global input) INTEGER
867* On entry, IMBA specifies the row blocking factor used to dis-
868* tribute the first IMBA rows of the matrix. IMBA must be at
869* least one.
870*
871* INBA (global input) INTEGER
872* On entry, INBA specifies the column blocking factor used to
873* distribute the first INBA columns of the matrix. INBA must
874* be at least one.
875*
876* MBA (global input) INTEGER
877* On entry, MBA specifies the row blocking factor used to dis-
878* tribute the rows of the matrix. MBA must be at least one.
879*
880* NBA (global input) INTEGER
881* On entry, NBA specifies the column blocking factor used to
882* distribute the columns of the matrix. NBA must be at least
883* one.
884*
885* RSRCA (global input) INTEGER
886* On entry, RSRCA specifies the process row in which the first
887* row of the matrix resides. When RSRCA is -1, the matrix is
888* row replicated, otherwise RSCRA must be at least zero and
889* strictly less than NPROW.
890*
891* CSRCA (global input) INTEGER
892* On entry, CSRCA specifies the process column in which the
893* first column of the matrix resides. When CSRCA is -1, the
894* matrix is column replicated, otherwise CSCRA must be at least
895* zero and strictly less than NPCOL.
896*
897* MPA (local output) INTEGER
898* On exit, MPA is Lr( 1, MA ).
899*
900* NQA (local output) INTEGER
901* On exit, NQA is Lc( 1, NA ).
902*
903* IPREA (local output) INTEGER
904* On exit, IPREA specifies the size of the guard zone to put
905* before the start of the local padded array.
906*
907* IMIDA (local output) INTEGER
908* On exit, IMIDA specifies the lda-gap of the guard zone to
909* put after each column of the local padded array.
910*
911* IPOSTA (local output) INTEGER
912* On exit, IPOSTA specifies the size of the guard zone to put
913* after the local padded array.
914*
915* IGAP (global input) INTEGER
916* On entry, IGAP specifies the size of the lda-gap.
917*
918* GAPMUL (global input) INTEGER
919* On entry, GAPMUL is a constant factor controlling the size
920* of the pre- and post guardzone.
921*
922* INFO (global output) INTEGER
923* On exit, when INFO is zero, no error has been detected,
924* otherwise an error has been detected.
925*
926* -- Written on April 1, 1998 by
927* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
928*
929* =====================================================================
930*
931* .. Parameters ..
932 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
933 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
934 $ RSRC_
935 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
936 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
937 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
938 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
939* ..
940* .. Local Scalars ..
941 INTEGER LLDA, MYCOL, MYROW, NPCOL, NPROW
942* ..
943* .. External Subroutines ..
944 EXTERNAL blacs_gridinfo, igsum2d, pb_descinit2
945* ..
946* .. External Functions ..
947 INTEGER PB_NUMROC
948 EXTERNAL pb_numroc
949* ..
950* .. Intrinsic Functions ..
951 INTRINSIC max
952* ..
953* .. Executable Statements ..
954*
955 info = 0
956 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
957*
958* Verify descriptor type DTYPE_
959*
960 IF( dta.NE.block_cyclic_2d_inb ) THEN
961 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
962 $ WRITE( nout, fmt = 9999 ) matrix, 'DTYPE', matrix, dta,
963 $ block_cyclic_2d_inb
964 info = 1
965 END IF
966*
967* Verify global matrix dimensions (M_,N_) are correct
968*
969 IF( ma.LT.0 ) THEN
970 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
971 $ WRITE( nout, fmt = 9998 ) matrix, 'M', matrix, ma
972 info = 1
973 ELSE IF( na.LT.0 ) THEN
974 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
975 $ WRITE( nout, fmt = 9997 ) matrix, 'N', matrix, na
976 info = 1
977 END IF
978*
979* Verify if blocking factors (IMB_, INB_) are correct
980*
981 IF( imba.LT.1 ) THEN
982 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
983 $ WRITE( nout, fmt = 9996 ) matrix, 'IMB', matrix, imba
984 info = 1
985 ELSE IF( inba.LT.1 ) THEN
986 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
987 $ WRITE( nout, fmt = 9995 ) matrix, 'INB', matrix, inba
988 info = 1
989 END IF
990*
991* Verify if blocking factors (MB_, NB_) are correct
992*
993 IF( mba.LT.1 ) THEN
994 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
995 $ WRITE( nout, fmt = 9994 ) matrix, 'MB', matrix, mba
996 info = 1
997 ELSE IF( nba.LT.1 ) THEN
998 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
999 $ WRITE( nout, fmt = 9993 ) matrix, 'NB', matrix, nba
1000 info = 1
1001 END IF
1002*
1003* Verify if origin process coordinates (RSRC_, CSRC_) are valid
1004*
1005 IF( rsrca.LT.-1 .OR. rsrca.GE.nprow ) THEN
1006 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
1007 WRITE( nout, fmt = 9992 ) matrix
1008 WRITE( nout, fmt = 9990 ) 'RSRC', matrix, rsrca, nprow
1009 END IF
1010 info = 1
1011 ELSE IF( csrca.LT.-1 .OR. csrca.GE.npcol ) THEN
1012 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
1013 WRITE( nout, fmt = 9991 ) matrix
1014 WRITE( nout, fmt = 9990 ) 'CSRC', matrix, csrca, npcol
1015 END IF
1016 info = 1
1017 END IF
1018*
1019* Check all processes for an error
1020*
1021 CALL igsum2d( ictxt, 'All', ' ', 1, 1, info, 1, -1, 0 )
1022*
1023 IF( info.NE.0 ) THEN
1024*
1025 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
1026 WRITE( nout, fmt = 9989 ) matrix
1027 WRITE( nout, fmt = * )
1028 END IF
1029*
1030 ELSE
1031*
1032* Compute local testing leading dimension
1033*
1034 mpa = pb_numroc( ma, 1, imba, mba, myrow, rsrca, nprow )
1035 nqa = pb_numroc( na, 1, inba, nba, mycol, csrca, npcol )
1036 iprea = max( gapmul*nba, mpa )
1037 imida = igap
1038 iposta = max( gapmul*nba, nqa )
1039 llda = max( 1, mpa ) + imida
1040*
1041 CALL pb_descinit2( desca, ma, na, imba, inba, mba, nba, rsrca,
1042 $ csrca, ictxt, llda, info )
1043*
1044* Check all processes for an error
1045*
1046 CALL igsum2d( ictxt, 'All', ' ', 1, 1, info, 1, -1, 0 )
1047*
1048 IF( info.NE.0 ) THEN
1049 IF( myrow.EQ.0 .AND. mycol.EQ.0 ) THEN
1050 WRITE( nout, fmt = 9989 ) matrix
1051 WRITE( nout, fmt = * )
1052 END IF
1053 END IF
1054*
1055 END IF
1056*
1057 9999 FORMAT( 2x, '>> Invalid matrix ', a1, ' descriptor type ', a5, a1,
1058 $ ': ', i6, ' should be ', i3, '.' )
1059 9998 FORMAT( 2x, '>> Invalid matrix ', a1, ' row dimension ', a1, a1,
1060 $ ': ', i6, ' should be at least 1.' )
1061 9997 FORMAT( 2x, '>> Invalid matrix ', a1, ' column dimension ', a1,
1062 $ a1, ': ', i6, ' should be at least 1.' )
1063 9996 FORMAT( 2x, '>> Invalid matrix ', a1, ' first row block size ',
1064 $ a3, a1, ': ', i6, ' should be at least 1.' )
1065 9995 FORMAT( 2x, '>> Invalid matrix ', a1, ' first column block size ',
1066 $ a3, a1,': ', i6, ' should be at least 1.' )
1067 9994 FORMAT( 2x, '>> Invalid matrix ', a1, ' row block size ', a2, a1,
1068 $ ': ', i6, ' should be at least 1.' )
1069 9993 FORMAT( 2x, '>> Invalid matrix ', a1, ' column block size ', a2,
1070 $ a1,': ', i6, ' should be at least 1.' )
1071 9992 FORMAT( 2x, '>> Invalid matrix ', a1, ' row process source:' )
1072 9991 FORMAT( 2x, '>> Invalid matrix ', a1, ' column process source:' )
1073 9990 FORMAT( 2x, '>> ', a4, a1, '= ', i6, ' should be >= -1 and < ',
1074 $ i6, '.' )
1075 9989 FORMAT( 2x, '>> Invalid matrix ', a1, ' descriptor: going on to ',
1076 $ 'next test case.' )
1077*
1078 RETURN
1079*
1080* End of PMDESCCHK
1081*
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
Here is the call graph for this function: