Routine: PJLAENV()  File: SRC\pjlaenv.f

 
 
# lines: 364
  # code: 364
  # comment: 0
  # blank:0
# Variables:35
# Callers:16
# Callings:0
# Words:287
# Keywords:220
 

 

..
  Purpose
  =======
  PJLAENV is called from the ScaLAPACK symmetric and Hermitian
  tailored eigen-routines to choose
  problem-dependent parameters for the local environment.  See ISPEC
  for a description of the parameters.
  This version provides a set of parameters which should give good,
  but not optimal, performance on many of the currently available
  computers.  Users are encouraged to modify this subroutine to set
  the tuning parameters for their particular machine using the option
  and problem size information in the arguments.
  This routine will not function correctly if it is converted to all
  lower case.  Converting it to all upper case is allowed.
  Arguments
  =========
  ISPEC   (global input) INTEGER
          Specifies the parameter to be returned as the value of
          PJLAENV.
          = 1: the data layout blocksize;
          = 2: the panel blocking factor;
          = 3: the algorithmic blocking factor;
          = 4: execution path control;
          = 5: maximum size for direct call to the LAPACK routine
  NAME    (global input) CHARACTER*(*)
          The name of the calling subroutine, in either upper case or
          lower case.
  OPTS    (global input) CHARACTER*(*)
          The character options to the subroutine NAME, concatenated
          into a single character string.  For example, UPLO = 'U',
          TRANS = 'T', and DIAG = 'N' for a triangular routine would
          be specified as OPTS = 'UTN'.
  N1      (global input) INTEGER
  N2      (global input) INTEGER
  N3      (global input) INTEGER
  N4      (global input) INTEGER
          Problem dimensions for the subroutine NAME; these may not all
          be required.
          At present, only N1 is used, and it (N1) is used only for
          'TTRD'
 (PJLAENV) (global or local output) INTEGER
          >= 0: the value of the parameter specified by ISPEC
          < 0:  if PJLAENV = -k, the k-th argument had an illegal
          value.
          Most parameters set via a call to PJLAENV must be identical
          on all processors and hence PJLAENV will return the same
          value to all procesors (i.e. global output).  However some,
          in particular, the panel blocking factor can be different
          on each processor and hence PJLAENV can return different
          values on different processors (i.e. local output).
  Further Details
  ===============
  The following conventions have been used when calling PJLAENV from
  the ScaLAPACK routines:
  1)  OPTS is a concatenation of all of the character options to
      subroutine NAME, in the same order that they appear in the
      argument list for NAME, even if they are not used in determining
      the value of the parameter specified by ISPEC.
  2)  The problem dimensions N1, N2, N3, N4 are specified in the order
      that they appear in the argument list for NAME.  N1 is used
      first, N2 second, and so on, and unused problem dimensions are
      passed a value of -1.
  3)  The parameter value returned by PJLAENV is checked for validity
      in the calling subroutine.  For example, PJLAENV is used to
      retrieve the optimal blocksize for STRTRI as follows:
      NB = PJLAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
      IF( NB.LE.1 ) NB = MAX( 1, N )
  PJLAENV is patterned after ILAENV and keeps the same interface in
  anticipation of future needs, even though PJLAENV is only sparsely
  used at present in ScaLAPACK.  Most ScaLAPACK codes use the input
  data layout blocking factor as the algorithmic blocking factor -
  hence there is no need or opportunity to set the algorithmic or
  data decomposition blocking factor.
  pXYYtevx.f and pXYYtgvx.f and pXYYttrd.f are the only codes which
  call PJLAENV in this release.  pXYYtevx.f and pXYYtgvx.f redistribute
  the data to the best data layout for each transformation.  pXYYttrd.f
  uses a data layout blocking factor of 1 and a
  =====================================================================
     .. Parameters ..

 
Display dynamic version Find AutoScroll Reload FontSize: - + Hide Comments Hide Blanks Frame FullScreen MailPrint

 
001        INTEGER FUNCTION PJLAENV( ICTXT , ISPEC , NAME , OPTS , N1 ,
002       $N2 , N3 , N4 )
003  
004  *     -- ScaLAPACK test routine(version 1.7) --
005  *     University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
006  *     and University of California , Berkeley.
007  *     October 15 , 1999
008  
009  *     .. Scalar Arguments ..
010        CHARACTER*( * ) NAME , OPTS
011        INTEGER ICTXT , ISPEC , N1 , N2 , N3 , N4
012        INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
013       $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
014        PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
015       $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
016       $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
017  *     ..
018  *     .. Local Scalars ..
019        LOGICAL CNAME , GLOBAL , SNAME
020        CHARACTER C1
021        CHARACTER*2 C2 , C4
022        CHARACTER*3 C3
023        CHARACTER*8 SUBNAM
024        INTEGER I , IC , IDUMM , IZ , MSZ , NB
025  *     ..
026  *     .. Intrinsic Functions ..
027        INTRINSIC CHAR , ICHAR
028  *     ..
029  
030  *     .. External Subroutines ..
031        EXTERNAL IGAMX2D
032  *     ..
033  *     .. Executable Statements ..
034  *     This is just to keep ftnchek and toolpack / 1 happy
035        IF( BLOCK_CYCLIC_2D*CSRC_*CTXT_*DLEN_*DTYPE_*LLD_*MB_*M_*NB_*N_*
036       $    RSRC_.LT.0 )RETURN
037  
038            GO TO( 10 , 10 , 10 , 10 , 10 )ISPEC
039  
040  *         Invalid value for ISPEC
041  
042            PJLAENV = - 1
043            RETURN
044  
045     10 CONTINUE
046  
047  *     Convert NAME to upper case if the first character is lower case.
048  
049        PJLAENV = 1
050        SUBNAM = NAME
051        IC = ICHAR( SUBNAM( 1 : 1 ) )
052        IZ = ICHAR( 'Z' )
053        IF( IZ.EQ.100 .OR. IZ.EQ.122 ) THEN
054  
055  *         ASCII character set
056  
057            IF( IC.GE.97 .AND. IC.LE.122 ) THEN
058                SUBNAM( 1 : 1 ) = CHAR( IC - 32 )
059                DO 20 I = 2 , 6
060                    IC = ICHAR( SUBNAM( I : I ) )
061                    IF( IC.GE.97 .AND. IC.LE.122 )
062       $                SUBNAM( I : I ) = CHAR( IC - 32 )
063     20         CONTINUE
064            END IF
065  
066        ELSE IF( IZ.EQ.233 .OR. IZ.EQ.169 ) THEN
067  
068  *         EBCDIC character set
069  
070            IF(( IC.GE.129 .AND. IC.LE.137 ) .OR.
071       $( IC.GE.145 .AND. IC.LE.153 ) .OR.
072       $( IC.GE.162 .AND. IC.LE.169 ) ) THEN
073            SUBNAM( 1 : 1 ) = CHAR( IC + 64 )
074            DO 30 I = 2 , 6
075                IC = ICHAR( SUBNAM( I : I ) )
076                IF(( IC.GE.129 .AND. IC.LE.137 ) .OR.
077       $( IC.GE.145 .AND. IC.LE.153 ) .OR.
078       $( IC.GE.162 .AND. IC.LE.169 ) )SUBNAM( I :
079       $        I ) = CHAR( IC + 64 )
080     30     CONTINUE
081        END IF
082  
083        ELSE IF( IZ.EQ.218 .OR. IZ.EQ.250 ) THEN
084  
085  *         Prime machines : ASCII + 128
086  
087            IF( IC.GE.225 .AND. IC.LE.250 ) THEN
088                SUBNAM( 1 : 1 ) = CHAR( IC - 32 )
089                DO 40 I = 2 , 6
090                    IC = ICHAR( SUBNAM( I : I ) )
091                    IF( IC.GE.225 .AND. IC.LE.250 )
092       $                SUBNAM( I : I ) = CHAR( IC - 32 )
093     40         CONTINUE
094            END IF
095        END IF
096  
097        C1 = SUBNAM( 2 : 2 )
098        SNAME = C1.EQ.'S' .OR. C1.EQ.'D'
099        CNAME = C1.EQ.'C' .OR. C1.EQ.'Z'
100        IF( .NOT.( CNAME .OR. SNAME ) )
101       $    RETURN
102            C2 = SUBNAM( 3 : 4 )
103            C3 = SUBNAM( 5 : 7 )
104            C4 = C3( 2 : 3 )
105  
106  *         This is to keep ftnchek happy
107  
108            IF(( N2 + N3 + N4 )*0.NE.0 ) THEN
109                C4 = OPTS
110                C3 = C4
111            END IF
112  
113            GO TO( 50 , 60 , 70 , 80 , 90 )ISPEC
114  
115     50 CONTINUE
116  
117  *     ISPEC = 1 : data layout block size
118  *     (global - all processes must use the same value)
119  
120  *     In these examples , separate code is provided for setting NB for
121  *     real and complex. We assume that NB will take the same value in
122  *     single or double precision.
123  
124        NB = 1
125  
126        IF( C2.EQ.'SY' .OR. C2.EQ.'HE' ) THEN
127            IF( C3.EQ.'LLT' ) THEN
128                IF( SNAME ) THEN
129                    NB = 64
130                ELSE
131                    NB = 64
132                END IF
133            ELSE IF( C3.EQ.'TTR' ) THEN
134                IF( SNAME ) THEN
135                    NB = 1
136                ELSE
137                    NB = 1
138                END IF
139            ELSE IF( C3.EQ.'GST' ) THEN
140                IF( SNAME ) THEN
141                    NB = 32
142                ELSE
143                    NB = 32
144                END IF
145            ELSE IF( C3.EQ.'BCK' ) THEN
146                IF( SNAME ) THEN
147                    NB = 32
148                ELSE
149                    NB = 32
150                END IF
151            ELSE IF( C3.EQ.'TRS' ) THEN
152                IF( SNAME ) THEN
153                    NB = 64
154                ELSE
155                    NB = 64
156                END IF
157            END IF
158        END IF
159  
160        PJLAENV = NB
161        GLOBAL = .TRUE.
162        GO TO 100
163  
164     60 CONTINUE
165  
166  *     ISPEC = 2 : panel blocking factor(Used only in PxyyTTRD)
167  *     (local - different processes may use different values)
168  
169        NB = 16
170        IF( C2.EQ.'SY' .OR. C2.EQ.'HE' ) THEN
171            IF( C3.EQ.'TTR' ) THEN
172                IF( SNAME ) THEN
173                    NB = 32
174                ELSE
175                    NB = 32
176                END IF
177            END IF
178        END IF
179        PJLAENV = NB
180        GLOBAL = .FALSE.
181        GO TO 100
182  
183     70 CONTINUE
184  
185  *     ISPEC = 3 : algorithmic blocking factor(Used only in PxyyTTRD)
186  *     (global - all processes must use the same value)
187  
188        NB = 1
189        IF( C2.EQ.'SY' .OR. C2.EQ.'HE' ) THEN
190            IF( C3.EQ.'TTR' ) THEN
191                IF( SNAME ) THEN
192                    NB = 16
193                ELSE
194                    NB = 16
195                END IF
196            END IF
197        END IF
198        PJLAENV = NB
199        GLOBAL = .TRUE.
200        GO TO 100
201  
202     80 CONTINUE
203  
204  *     ISPEC = 4 : Execution path options(Used only in PxyyTTRD)
205  *     (global - all processes must use the same value)
206  
207        PJLAENV = - 4
208        IF( C2.EQ.'SY' .OR. C2.EQ.'HE' ) THEN
209            IF( C3.EQ.'TTR' ) THEN
210  *             V and H interleaved(default is not interleaved)
211                IF( N1.EQ.1 ) THEN
212                    PJLAENV = 1
213                END IF
214  
215  *             Two ZGEMMs(default is one ZGEMM)
216                IF( N1.EQ.2 ) THEN
217                    PJLAENV = 0
218                END IF
219  *             Balanced Update(default is minimum communication update)
220                IF( N1.EQ.3 ) THEN
221                    PJLAENV = 0
222                END IF
223            END IF
224        END IF
225        GLOBAL = .TRUE.
226        GO TO 100
227  
228     90 CONTINUE
229  
230  *     ISPEC = 5 : Minimum size to justify call to parallel code
231  *     (global - all processes must use the same value)
232  
233        MSZ = 0
234        IF( C2.EQ.'SY' .OR. C2.EQ.'HE' ) THEN
235            IF( C3.EQ.'TTR' ) THEN
236                IF( SNAME ) THEN
237                    MSZ = 100
238                ELSE
239                    MSZ = 100
240                END IF
241            END IF
242        END IF
243        PJLAENV = MSZ
244        GLOBAL = .TRUE.
245        GO TO 100
246  
247    100 CONTINUE
248  
249        IF( GLOBAL ) THEN
250            CALL IGAMX2D( ICTXT , 'All' , ' ' , 1 , 1 , PJLAENV , 1 , IDUMM ,
251       $    IDUMM , - 1 , - 1 , IDUMM )
252        END IF
253  
254        RETURN
255  
256  *     End of PJLAENV
257  
258        END