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

◆ pb_descinit2()

subroutine pb_descinit2 ( integer, dimension( * )  desc,
integer  m,
integer  n,
integer  imb,
integer  inb,
integer  mb,
integer  nb,
integer  rsrc,
integer  csrc,
integer  ctxt,
integer  lld,
integer  info 
)

Definition at line 3930 of file pblastim.f.

3932*
3933* -- PBLAS test routine (version 2.0) --
3934* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
3935* and University of California, Berkeley.
3936* April 1, 1998
3937*
3938* .. Scalar Arguments ..
3939 INTEGER CSRC, CTXT, IMB, INB, INFO, LLD, M, MB, N, NB,
3940 $ RSRC
3941* ..
3942* .. Array Arguments ..
3943 INTEGER DESC( * )
3944* ..
3945*
3946* Purpose
3947* =======
3948*
3949* PB_DESCINIT2 uses its 10 input arguments M, N, IMB, INB, MB, NB,
3950* RSRC, CSRC, CTXT and LLD to initialize a descriptor vector of type
3951* BLOCK_CYCLIC_2D_INB.
3952*
3953* Notes
3954* =====
3955*
3956* A description vector is associated with each 2D block-cyclicly dis-
3957* tributed matrix. This vector stores the information required to
3958* establish the mapping between a matrix entry and its corresponding
3959* process and memory location.
3960*
3961* In the following comments, the character _ should be read as
3962* "of the distributed matrix". Let A be a generic term for any 2D
3963* block cyclicly distributed matrix. Its description vector is DESCA:
3964*
3965* NOTATION STORED IN EXPLANATION
3966* ---------------- --------------- ------------------------------------
3967* DTYPE_A (global) DESCA( DTYPE_ ) The descriptor type.
3968* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
3969* the NPROW x NPCOL BLACS process grid
3970* A is distributed over. The context
3971* itself is global, but the handle
3972* (the integer value) may vary.
3973* M_A (global) DESCA( M_ ) The number of rows in the distribu-
3974* ted matrix A, M_A >= 0.
3975* N_A (global) DESCA( N_ ) The number of columns in the distri-
3976* buted matrix A, N_A >= 0.
3977* IMB_A (global) DESCA( IMB_ ) The number of rows of the upper left
3978* block of the matrix A, IMB_A > 0.
3979* INB_A (global) DESCA( INB_ ) The number of columns of the upper
3980* left block of the matrix A,
3981* INB_A > 0.
3982* MB_A (global) DESCA( MB_ ) The blocking factor used to distri-
3983* bute the last M_A-IMB_A rows of A,
3984* MB_A > 0.
3985* NB_A (global) DESCA( NB_ ) The blocking factor used to distri-
3986* bute the last N_A-INB_A columns of
3987* A, NB_A > 0.
3988* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
3989* row of the matrix A is distributed,
3990* NPROW > RSRC_A >= 0.
3991* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
3992* first column of A is distributed.
3993* NPCOL > CSRC_A >= 0.
3994* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
3995* array storing the local blocks of
3996* the distributed matrix A,
3997* IF( Lc( 1, N_A ) > 0 )
3998* LLD_A >= MAX( 1, Lr( 1, M_A ) )
3999* ELSE
4000* LLD_A >= 1.
4001*
4002* Let K be the number of rows of a matrix A starting at the global in-
4003* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
4004* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
4005* receive if these K rows were distributed over NPROW processes. If K
4006* is the number of columns of a matrix A starting at the global index
4007* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
4008* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
4009* these K columns were distributed over NPCOL processes.
4010*
4011* The values of Lr() and Lc() may be determined via a call to the func-
4012* tion PB_NUMROC:
4013* Lr( IA, K ) = PB_NUMROC( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
4014* Lc( JA, K ) = PB_NUMROC( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
4015*
4016* Arguments
4017* =========
4018*
4019* DESC (global and local output) INTEGER array
4020* On entry, DESC is an array of dimension DLEN_. DESC is the
4021* array descriptor to be set.
4022*
4023* M (global input) INTEGER
4024* On entry, M specifies the number of rows of the matrix.
4025* M must be at least zero.
4026*
4027* N (global input) INTEGER
4028* On entry, N specifies the number of columns of the matrix.
4029* N must be at least zero.
4030*
4031* IMB (global input) INTEGER
4032* On entry, IMB specifies the row size of the first block of
4033* the global matrix distribution. IMB must be at least one.
4034*
4035* INB (global input) INTEGER
4036* On entry, INB specifies the column size of the first block
4037* of the global matrix distribution. INB must be at least one.
4038*
4039* MB (global input) INTEGER
4040* On entry, MB specifies the row size of the blocks used to
4041* partition the matrix. MB must be at least one.
4042*
4043* NB (global input) INTEGER
4044* On entry, NB specifies the column size of the blocks used to
4045* partition the matrix. NB must be at least one.
4046*
4047* RSRC (global input) INTEGER
4048* On entry, RSRC specifies the row coordinate of the process
4049* that possesses the first row of the matrix. When RSRC = -1,
4050* the data is not distributed but replicated, otherwise RSRC
4051* must be at least zero and strictly less than NPROW.
4052*
4053* CSRC (global input) INTEGER
4054* On entry, CSRC specifies the column coordinate of the pro-
4055* cess that possesses the first column of the matrix. When
4056* CSRC = -1, the data is not distributed but replicated, other-
4057* wise CSRC must be at least zero and strictly less than NPCOL.
4058*
4059* CTXT (local input) INTEGER
4060* On entry, CTXT specifies the BLACS context handle, indicating
4061* the global communication context. The value of the context
4062* itself is local.
4063*
4064* LLD (local input) INTEGER
4065* On entry, LLD specifies the leading dimension of the local
4066* array storing the local entries of the matrix. LLD must be at
4067* least MAX( 1, Lr(1,M) ).
4068*
4069* INFO (local output) INTEGER
4070* = 0: successful exit
4071* < 0: if INFO = -i, the i-th argument had an illegal value.
4072*
4073* Notes
4074* =====
4075*
4076* If the routine can recover from an erroneous input argument, it will
4077* return an acceptable descriptor vector. For example, if LLD = 0 on
4078* input, DESC( LLD_ ) will contain the smallest leading dimension re-
4079* quired to store the specified m by n matrix, INFO will however be set
4080* to -11 on exit in that case.
4081*
4082* -- Written on April 1, 1998 by
4083* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
4084*
4085* =====================================================================
4086*
4087* .. Parameters ..
4088 INTEGER BLOCK_CYCLIC_2D_INB, CSRC_, CTXT_, DLEN_,
4089 $ DTYPE_, IMB_, INB_, LLD_, MB_, M_, NB_, N_,
4090 $ RSRC_
4091 parameter( block_cyclic_2d_inb = 2, dlen_ = 11,
4092 $ dtype_ = 1, ctxt_ = 2, m_ = 3, n_ = 4,
4093 $ imb_ = 5, inb_ = 6, mb_ = 7, nb_ = 8,
4094 $ rsrc_ = 9, csrc_ = 10, lld_ = 11 )
4095* ..
4096* .. Local Scalars ..
4097 INTEGER LLDMIN, MP, MYCOL, MYROW, NPCOL, NPROW
4098* ..
4099* .. External Subroutines ..
4100 EXTERNAL blacs_gridinfo, pxerbla
4101* ..
4102* .. External Functions ..
4103 INTEGER PB_NUMROC
4104 EXTERNAL pb_numroc
4105* ..
4106* .. Intrinsic Functions ..
4107 INTRINSIC max, min
4108* ..
4109* .. Executable Statements ..
4110*
4111* Get grid parameters
4112*
4113 CALL blacs_gridinfo( ctxt, nprow, npcol, myrow, mycol )
4114*
4115 info = 0
4116 IF( m.LT.0 ) THEN
4117 info = -2
4118 ELSE IF( n.LT.0 ) THEN
4119 info = -3
4120 ELSE IF( imb.LT.1 ) THEN
4121 info = -4
4122 ELSE IF( inb.LT.1 ) THEN
4123 info = -5
4124 ELSE IF( mb.LT.1 ) THEN
4125 info = -6
4126 ELSE IF( nb.LT.1 ) THEN
4127 info = -7
4128 ELSE IF( rsrc.LT.-1 .OR. rsrc.GE.nprow ) THEN
4129 info = -8
4130 ELSE IF( csrc.LT.-1 .OR. csrc.GE.npcol ) THEN
4131 info = -9
4132 ELSE IF( nprow.EQ.-1 ) THEN
4133 info = -10
4134 END IF
4135*
4136* Compute minimum LLD if safe (to avoid division by 0)
4137*
4138 IF( info.EQ.0 ) THEN
4139 mp = pb_numroc( m, 1, imb, mb, myrow, rsrc, nprow )
4140 IF( pb_numroc( n, 1, inb, nb, mycol, csrc, npcol ).GT.0 ) THEN
4141 lldmin = max( 1, mp )
4142 ELSE
4143 lldmin = 1
4144 END IF
4145 IF( lld.LT.lldmin )
4146 $ info = -11
4147 END IF
4148*
4149 IF( info.NE.0 )
4150 $ CALL pxerbla( ctxt, 'PB_DESCINIT2', -info )
4151*
4152 desc( dtype_ ) = block_cyclic_2d_inb
4153 desc( ctxt_ ) = ctxt
4154 desc( m_ ) = max( 0, m )
4155 desc( n_ ) = max( 0, n )
4156 desc( imb_ ) = max( 1, imb )
4157 desc( inb_ ) = max( 1, inb )
4158 desc( mb_ ) = max( 1, mb )
4159 desc( nb_ ) = max( 1, nb )
4160 desc( rsrc_ ) = max( -1, min( rsrc, nprow-1 ) )
4161 desc( csrc_ ) = max( -1, min( csrc, npcol-1 ) )
4162 desc( lld_ ) = max( lld, lldmin )
4163*
4164 RETURN
4165*
4166* End of PB_DESCINIT2
4167*
integer function pb_numroc(n, i, inb, nb, proc, srcproc, nprocs)
Definition pblastst.f:2548
#define max(A, B)
Definition pcgemr.c:180
#define min(A, B)
Definition pcgemr.c:181
subroutine pxerbla(ictxt, srname, info)
Definition pxerbla.f:2