|
|
| |
| # lines: |
1530 | | # code: |
1530 | | # comment: | 0 | |
# blank: | 0 |
| # Variables: | 38 |
| # Callers: | 1 |
| # Callings: | 1 |
| # Words: | 299 |
| # Keywords: | 115 |
|
|
|
|
|
..
.. Local Scalars ..
..
.. Local Arrays ..
..
.. External Subroutines ..
..
.. External Functions ..
..
.. Intrinsic Functions ..
..
.. Executable Statements ..
Test the input parameters
Convert descriptor into standard form for easy access to
parameters, check that grid is of right shape.
Temporarily set the descriptor type to 1xP type
Consistency checks for DESCA and DESCB.
Context must be the same
These are alignment restrictions that may or may not be removed
in future releases. -Andy Cleary, April 14, 1996.
Block sizes must be the same
Source processor must be the same
Get values out of descriptor for use in code.
Get grid parameters
Current alignment restriction
Argument checking that is specific to Divide & Conquer routine
Pack params and positions into arrays for global consistency check
Want to find errors with MIN( ), so if no error, set it to a big
number. If there already is an error, multiply by the the
descriptor multiplier.
Check consistency across processors
Prepare output: set info = 0 if no error, and divide by DESCMULT
if error is not in a descriptor entry.
Quick return if possible
Adjust addressing into matrix space to properly get into
the beginning part of the relevant data
Form a new BLACS grid (the "standard form" grid) with only procs
holding part of the matrix, of size 1xNP where NP is adjusted,
starting at csrc=0, with JA modified to reflect dropped procs.
First processor to hold part of the matrix:
Calculate new JA one while dropping off unused processors.
Save and compute new value of NP
Call utility routine that forms "standard-form" grid
Use new context from standard grid as context.
Get information about new grid.
Drop out processors that do not have part of the matrix.
********************************
Values reused throughout routine
User-input value of partition size
Number of columns in each processor
Offset in columns to beginning of main partition in each proc
Size of main (or odd) partition in each processor
Offset to workspace for Upper triangular factor
Begin main code
Frontsolve
*****************************************
Local computation phase
*****************************************
Use main partition in each processor to solve locally
Use factorization of odd-even connection block to modify
locally stored portion of right hand side(s)
Use the "spike" fillin to calculate contribution to previous
processor's righthand-side.
***********************************************
Formation and solution of reduced system
***********************************************
Send modifications to prior processor's right hand sides
Receive modifications to processor's right hand sides
Combine contribution to locally stored right hand sides
The last processor does not participate in the solution of the
reduced system, having sent its contribution already.
*************************************
Modification Loop
The distance for sending and receiving for each level starts
at 1 for the first level.
Do until this proc is needed to modify other procs' equations
Receive and add contribution to righthand sides from left
Receive and add contribution to righthand sides from right
[End of GOTO Loop]
*********************************
Calculate and use this proc's blocks to modify other procs
Solve with diagonal block
*********
Calculate contribution from this block to next diagonal block
Send contribution to diagonal block's owning processor.
End of "if( mycol/level_dist .le. (npcol-1)/level_dist-2 )..."
************
Use offdiagonal block to calculate modification to diag block
of processor to the left
Send contribution to diagonal block's owning processor.
End of "if( mycol/level_dist.le. (npcol-1)/level_dist -1 )..."
******************* BACKSOLVE *************************************
*******************************************************************
.. Begin reduced system phase of algorithm ..
*******************************************************************
The last processor does not participate in the solution of the
reduced system and just waits to receive its solution.
Determine number of steps in tree loop
Receive solution from processor to left
Use offdiagonal block to calculate modification to RHS stored
on this processor
End of "if( mycol/level_dist.le. (npcol-1)/level_dist -1 )..."
Receive solution from processor to right
Calculate contribution from this block to next diagonal block
End of "if( mycol/level_dist .le. (npcol-1)/level_dist-2 )..."
Solve with diagonal block
**Modification Loop *******
Send solution to the right
Send solution to left
[End of GOTO Loop]
[Processor npcol - 1 jumped to here to await next stage]
******************************
Reduced system has been solved, communicate solutions to nearest
neighbors in preparation for local computation phase.
Send elements of solution to next proc
Receive modifications to processor's right hand sides
*********************************************
Local computation phase
*********************************************
Use the "spike" fillin to calculate contribution from previous
processor's solution.
Use factorization of odd-even connection block to modify
locally stored portion of right hand side(s)
Use main partition in each processor to solve locally
End of "IF( LSAME( TRANS, 'N' ) )"...
**************************************************************
CASE UPLO = 'U' *
**************************************************************
Frontsolve
*****************************************
Local computation phase
*****************************************
Use main partition in each processor to solve locally
Use factorization of odd-even connection block to modify
locally stored portion of right hand side(s)
Use the "spike" fillin to calculate contribution to previous
processor's righthand-side.
***********************************************
Formation and solution of reduced system
***********************************************
Send modifications to prior processor's right hand sides
|
|
|
|
001 SUBROUTINE PCDTTRSV( UPLO , TRANS , N , NRHS , DL , D , DU , JA , DESCA ,
002 $B , IB , DESCB , AF , LAF , WORK , LWORK , INFO )
003
004 * -- ScaLAPACK routine(version 1.7) --
005 * University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
006 * and University of California , Berkeley.
007 * November 15 , 1997
008
009 * .. Scalar Arguments ..
010 CHARACTER TRANS , UPLO
011 INTEGER IB , INFO , JA , LAF , LWORK , N , NRHS
012 * ..
013 * .. Array Arguments ..
014 INTEGER DESCA( * ) , DESCB( * )
015 COMPLEX AF( * ) , B( * ) , D( * ) , DL( * ) , DU( * ) ,
016 $WORK( * )
017 * ..
018
019 * Purpose
020 * === ====
021
022 * PCDTTRSV solves a tridiagonal triangular system of linear equations
023
024 * A(1 : N , JA : JA + N - 1) * X = B(IB : IB + N - 1 , 1 : NRHS)
025 * or
026 * A(1 : N , JA : JA + N - 1)^H * X = B(IB : IB + N - 1 , 1 : NRHS)
027
028 * where A(1 : N , JA : JA + N - 1) is a tridiagonal
029 * triangular matrix factor produced by the
030 * Gaussian elimination code PC@(dom_pre)TTRF
031 * and is stored in A(1 : N , JA : JA + N - 1) and AF.
032 * The matrix stored in A(1 : N , JA : JA + N - 1) is either
033 * upper or lower triangular according to UPLO ,
034 * and the choice of solving A(1 : N , JA : JA + N - 1) or A(1 : N , JA : JA + N - 1)^H
035 * is dictated by the user by the parameter TRANS.
036
037 * Routine PCDTTRF MUST be called first.
038
039 * === ==================================================================
040
041 * Arguments
042 * === ======
043
044 * UPLO(global input) CHARACTER
045 * = 'U' : Upper triangle of A(1 : N , JA : JA + N - 1) is stored ;
046 * = 'L' : Lower triangle of A(1 : N , JA : JA + N - 1) is stored.
047
048 * TRANS(global input) CHARACTER
049 * = 'N' : Solve with A(1 : N , JA : JA + N - 1) ;
050 * = 'C' : Solve with conjugate_transpose( A(1 : N , JA : JA + N - 1) ) ;
051
052 * N(global input) INTEGER
053 * The number of rows and columns to be operated on , i.e. the
054 * order of the distributed submatrix A(1 : N , JA : JA + N - 1). N >= 0.
055
056 * NRHS(global input) INTEGER
057 * The number of right hand sides , i.e. , the number of columns
058 * of the distributed submatrix B(IB : IB + N - 1 , 1 : NRHS).
059 * NRHS >= 0.
060
061 * DL(local input / local output) COMPLEX pointer to local
062 * part of global vector storing the lower diagonal of the
063 * matrix. Globally , DL(1) is not referenced , and DL must be
064 * aligned with D.
065 * Must be of size >= DESCA( NB_ ).
066 * On exit , this array contains information containing the
067 * factors of the matrix.
068
069 * D(local input / local output) COMPLEX pointer to local
070 * part of global vector storing the main diagonal of the
071 * matrix.
072 * On exit , this array contains information containing the
073 * factors of the matrix.
074 * Must be of size >= DESCA( NB_ ).
075
076 * DU(local input / local output) COMPLEX pointer to local
077 * part of global vector storing the upper diagonal of the
078 * matrix. Globally , DU(n) is not referenced , and DU must be
079 * aligned with D.
080 * On exit , this array contains information containing the
081 * factors of the matrix.
082 * Must be of size >= DESCA( NB_ ).
083
084 * JA(global input) INTEGER
085 * The index in the global array A that points to the start of
086 * the matrix to be operated on(which may be either all of A
087 * or a submatrix of A).
088
089 * DESCA(global and local input) INTEGER array of dimension DLEN.
090 * if 1D type(DTYPE_A = 501 or 502) , DLEN >= 7 ;
091 * if 2D type(DTYPE_A = 1) , DLEN >= 9.
092 * The array descriptor for the distributed matrix A.
093 * Contains information of mapping of A to memory. Please
094 * see NOTES below for full description and options.
095
096 * B(local input / local output) COMPLEX pointer into
097 * local memory to an array of local lead dimension lld_b >= NB.
098 * On entry , this array contains the
099 * the local pieces of the right hand sides
100 * B(IB : IB + N - 1 , 1 : NRHS).
101 * On exit , this contains the local piece of the solutions
102 * distributed matrix X.
103
104 * IB(global input) INTEGER
105 * The row index in the global array B that points to the first
106 * row of the matrix to be operated on(which may be either
107 * all of B or a submatrix of B).
108
109 * DESCB(global and local input) INTEGER array of dimension DLEN.
110 * if 1D type(DTYPE_B = 502) , DLEN >= 7 ;
111 * if 2D type(DTYPE_B = 1) , DLEN >= 9.
112 * The array descriptor for the distributed matrix B.
113 * Contains information of mapping of B to memory. Please
114 * see NOTES below for full description and options.
115
116 * AF(local output) COMPLEX array , dimension LAF.
117 * Auxiliary Fillin Space.
118 * Fillin is created during the factorization routine
119 * PCDTTRF and this is stored in AF. If a linear system
120 * is to be solved using PCDTTRS after the factorization
121 * routine , AF *must not be altered* after the factorization.
122
123 * LAF(local input) INTEGER
124 * Size of user - input Auxiliary Fillin space AF. Must be >=
125 * 2*(NB + 2)
126 * If LAF is not large enough , an error code will be returned
127 * and the minimum acceptable size will be returned in AF( 1 )
128
129 * WORK(local workspace / local output)
130 * COMPLEX temporary workspace. This space may
131 * be overwritten in between calls to routines. WORK must be
132 * the size given in LWORK.
133 * On exit , WORK( 1 ) contains the minimal LWORK.
134
135 * LWORK(local input or global input) INTEGER
136 * Size of user - input workspace WORK.
137 * If LWORK is too small , the minimal acceptable size will be
138 * returned in WORK(1) and an error code is returned. LWORK >=
139 * 10*NPCOL + 4*NRHS
140
141 * INFO(local output) INTEGER
142 * = 0 : successful exit
143 * < 0 : If the i - th argument is an array and the j - entry had
144 * an illegal value , then INFO = - (i*100 + j) , if the i - th
145 * argument is a scalar and had an illegal value , then
146 * INFO = - i.
147
148 * === ==================================================================
149
150 * Restrictions
151 * === =========
152
153 * The following are restrictions on the input parameters. Some of these
154 * are temporary and will be removed in future releases , while others
155 * may reflect fundamental technical limitations.
156
157 * Non - cyclic restriction : VERY IMPORTANT !
158 * P*NB >= mod(JA - 1 , NB) + N.
159 * The mapping for matrices must be blocked , reflecting the nature
160 * of the divide and conquer algorithm as a task - parallel algorithm.
161 * This formula in words is : no processor may have more than one
162 * chunk of the matrix.
163
164 * Blocksize cannot be too small :
165 * If the matrix spans more than one processor , the following
166 * restriction on NB , the size of each block on each processor ,
167 * must hold :
168 * NB >= 2
169 * The bulk of parallel computation is done on the matrix of size
170 * O(NB) on each processor. If this is too small , divide and conquer
171 * is a poor choice of algorithm.
172
173 * Submatrix reference :
174 * JA = IB
175 * Alignment restriction that prevents unnecessary communication.
176
177 * === ==================================================================
178
179 * Notes
180 * === ==
181
182 * If the factorization routine and the solve routine are to be called
183 * separately(to solve various sets of righthand sides using the same
184 * coefficient matrix) , the auxiliary space AF *must not be altered*
185 * between calls to the factorization routine and the solve routine.
186
187 * The best algorithm for solving banded and tridiagonal linear systems
188 * depends on a variety of parameters , especially the bandwidth.
189 * Currently , only algorithms designed for the case N / P >> bw are
190 * implemented. These go by many names , including Divide and Conquer ,
191 * Partitioning , domain decomposition - type , etc.
192 * For tridiagonal matrices , it is obvious : N / P >> bw( = 1) , and so D&C
193 * algorithms are the appropriate choice.
194
195 * Algorithm description : Divide and Conquer
196
197 * The Divide and Conqer algorithm assumes the matrix is narrowly
198 * banded compared with the number of equations. In this situation ,
199 * it is best to distribute the input matrix A one - dimensionally ,
200 * with columns atomic and rows divided amongst the processes.
201 * The basic algorithm divides the tridiagonal matrix up into
202 * P pieces with one stored on each processor ,
203 * and then proceeds in 2 phases for the factorization or 3 for the
204 * solution of a linear system.
205 * 1) Local Phase :
206 * The individual pieces are factored independently and in
207 * parallel. These factors are applied to the matrix creating
208 * fillin , which is stored in a non - inspectable way in auxiliary
209 * space AF. Mathematically , this is equivalent to reordering
210 * the matrix A as P A P^T and then factoring the principal
211 * leading submatrix of size equal to the sum of the sizes of
212 * the matrices factored on each processor. The factors of
213 * these submatrices overwrite the corresponding parts of A
214 * in memory.
215 * 2) Reduced System Phase :
216 * A small((P - 1)) system is formed representing
217 * interaction of the larger blocks , and is stored(as are its
218 * factors) in the space AF. A parallel Block Cyclic Reduction
219 * algorithm is used. For a linear system , a parallel front solve
220 * followed by an analagous backsolve , both using the structure
221 * of the factored matrix , are performed.
222 * 3) Backsubsitution Phase :
223 * For a linear system , a local backsubstitution is performed on
224 * each processor in parallel.
225
226 * Descriptors
227 * === ========
228
229 * Descriptors now have *types* and differ from ScaLAPACK 1.0.
230
231 * Note : tridiagonal codes can use either the old two dimensional
232 * or new one - dimensional descriptors , though the processor grid in
233 * both cases *must be one - dimensional*. We describe both types below.
234
235 * Each global data object is described by an associated description
236 * vector. This vector stores the information required to establish
237 * the mapping between an object element and its corresponding process
238 * and memory location.
239
240 * Let A be a generic term for any 2D block cyclicly distributed array.
241 * Such a global array has an associated description vector DESCA.
242 * In the following comments , the character _ should be read as
243 * "of the global array".
244
245 * NOTATION STORED IN EXPLANATION
246 * --- ------------ -------------- --------------------------------------
247 * DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case ,
248 * DTYPE_A = 1.
249 * CTXT_A(global) DESCA( CTXT_ ) The BLACS context handle , indicating
250 * the BLACS process grid A is distribu -
251 * ted over. The context itself is glo -
252 * bal , but the handle(the integer
253 * value) may vary.
254 * M_A(global) DESCA( M_ ) The number of rows in the global
255 * array A.
256 * N_A(global) DESCA( N_ ) The number of columns in the global
257 * array A.
258 * MB_A(global) DESCA( MB_ ) The blocking factor used to distribute
259 * the rows of the array.
260 * NB_A(global) DESCA( NB_ ) The blocking factor used to distribute
261 * the columns of the array.
262 * RSRC_A(global) DESCA( RSRC_ ) The process row over which the first
263 * row of the array A is distributed.
264 * CSRC_A(global) DESCA( CSRC_ ) The process column over which the
265 * first column of the array A is
266 * distributed.
267 * LLD_A(local) DESCA( LLD_ ) The leading dimension of the local
268 * array. LLD_A >= MAX(1 , LOCr(M_A)).
269
270 * Let K be the number of rows or columns of a distributed matrix ,
271 * and assume that its process grid has dimension p x q.
272 * LOCr( K ) denotes the number of elements of K that a process
273 * would receive if K were distributed over the p processes of its
274 * process column.
275 * Similarly , LOCc( K ) denotes the number of elements of K that a
276 * process would receive if K were distributed over the q processes of
277 * its process row.
278 * The values of LOCr() and LOCc() may be determined via a call to the
279 * ScaLAPACK tool function , NUMROC :
280 * LOCr( M ) = NUMROC( M , MB_A , MYROW , RSRC_A , NPROW ) ,
281 * LOCc( N ) = NUMROC( N , NB_A , MYCOL , CSRC_A , NPCOL ).
282 * An upper bound for these quantities may be computed by :
283 * LOCr( M ) <= ceil( ceil(M / MB_A) / NPROW )*MB_A
284 * LOCc( N ) <= ceil( ceil(N / NB_A) / NPCOL )*NB_A
285
286 * One - dimensional descriptors :
287
288 * One - dimensional descriptors are a new addition to ScaLAPACK since
289 * version 1.0. They simplify and shorten the descriptor for 1D
290 * arrays.
291
292 * Since ScaLAPACK supports two - dimensional arrays as the fundamental
293 * object , we allow 1D arrays to be distributed either over the
294 * first dimension of the array(as if the grid were P - by - 1) or the
295 * 2nd dimension(as if the grid were 1 - by - P). This choice is
296 * indicated by the descriptor type(501 or 502)
297 * as described below.
298 * However , for tridiagonal matrices , since the objects being
299 * distributed are the individual vectors storing the diagonals , we
300 * have adopted the convention that both the P - by - 1 descriptor and
301 * the 1 - by - P descriptor are allowed and are equivalent for
302 * tridiagonal matrices. Thus , for tridiagonal matrices ,
303 * DTYPE_A = 501 or 502 can be used interchangeably
304 * without any other change.
305 * We require that the distributed vectors storing the diagonals of a
306 * tridiagonal matrix be aligned with each other. Because of this , a
307 * single descriptor , DESCA , serves to describe the distribution of
308 * of all diagonals simultaneously.
309
310 * IMPORTANT NOTE : the actual BLACS grid represented by the
311 * CTXT entry in the descriptor may be *either* P - by - 1 or 1 - by - P
312 * irrespective of which one - dimensional descriptor type
313 * (501 or 502) is input.
314 * This routine will interpret the grid properly either way.
315 * ScaLAPACK routines *do not support intercontext operations* so that
316 * the grid passed to a single ScaLAPACK routine *must be the same*
317 * for all array descriptors passed to that routine.
318
319 * NOTE : In all cases where 1D descriptors are used , 2D descriptors
320 * may also be used , since a one - dimensional array is a special case
321 * of a two - dimensional array with one dimension of size unity.
322 * The two - dimensional array used in this case *must* be of the
323 * proper orientation :
324 * If the appropriate one - dimensional descriptor is DTYPEA = 501
325 * (1 by P type) , then the two dimensional descriptor must
326 * have a CTXT value that refers to a 1 by P BLACS grid ;
327 * If the appropriate one - dimensional descriptor is DTYPEA = 502
328 * (P by 1 type) , then the two dimensional descriptor must
329 * have a CTXT value that refers to a P by 1 BLACS grid.
330
331 * Summary of allowed descriptors , types , and BLACS grids :
332 * DTYPE 501 502 1 1
333 * BLACS grid 1xP or Px1 1xP or Px1 1xP Px1
334 * --- --------------------------------------------------
335 * A OK OK OK NO
336 * B NO OK NO OK
337
338 * Note that a consequence of this chart is that it is not possible
339 * for *both* DTYPE_A and DTYPE_B to be 2D_type(1) , as these lead
340 * to opposite requirements for the orientation of the BLACS grid ,
341 * and as noted before , the *same* BLACS context must be used in
342 * all descriptors in a single ScaLAPACK subroutine call.
343
344 * Let A be a generic term for any 1D block cyclicly distributed array.
345 * Such a global array has an associated description vector DESCA.
346 * In the following comments , the character _ should be read as
347 * "of the global array".
348
349 * NOTATION STORED IN EXPLANATION
350 * --- ------------ ---------- ------------------------------------------
351 * DTYPE_A(global) DESCA( 1 ) The descriptor type. For 1D grids ,
352 * TYPE_A = 501 : 1 - by - P grid.
353 * TYPE_A = 502 : P - by - 1 grid.
354 * CTXT_A(global) DESCA( 2 ) The BLACS context handle , indicating
355 * the BLACS process grid A is distribu -
356 * ted over. The context itself is glo -
357 * bal , but the handle(the integer
358 * value) may vary.
359 * N_A(global) DESCA( 3 ) The size of the array dimension being
360 * distributed.
361 * NB_A(global) DESCA( 4 ) The blocking factor used to distribute
362 * the distributed dimension of the array.
363 * SRC_A(global) DESCA( 5 ) The process row or column over which the
364 * first row or column of the array
365 * is distributed.
366 * Ignored DESCA( 6 ) Ignored for tridiagonal matrices.
367 * Reserved DESCA( 7 ) Reserved for future use.
368
369 * === ==================================================================
370
371 * Code Developer : Andrew J. Cleary , University of Tennessee.
372 * Current address : Lawrence Livermore National Labs.
373 * This version released : August , 2001.
374
375 * === ==================================================================
376
377 * ..
378 * .. Parameters ..
379 REAL ONE , ZERO
380 PARAMETER( ONE = 1.0E + 0 )
381 PARAMETER( ZERO = 0.0E + 0 )
382 COMPLEX CONE , CZERO
383 PARAMETER( CONE =( 1.0E + 0 , 0.0E + 0 ) )
384 PARAMETER( CZERO =( 0.0E + 0 , 0.0E + 0 ) )
385 INTEGER INT_ONE
386 PARAMETER( INT_ONE = 1 )
387 INTEGER DESCMULT , BIGNUM
388 PARAMETER(DESCMULT = 100 , BIGNUM = DESCMULT * DESCMULT)
389 INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
390 $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
391 PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
392 $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
393 $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
394 IF( MYCOL .GT. 0) THEN
395
395
396 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
397 $ WORK( 1 ) , INT_ONE ,
398 $ 0 , MYCOL - 1 )
399
400 ENDIF
401
402 * Receive modifications to processor's right hand sides
403
404 IF( MYCOL .LT. NPCOL - 1) THEN
405
405
406 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
407 $ WORK( 1 ) , INT_ONE ,
408 $ 0 , MYCOL + 1 )
409
410 * Combine contribution to locally stored right hand sides
411
412 CALL CMATADD( INT_ONE , NRHS , CONE ,
413 $ WORK( 1 ) , INT_ONE , CONE ,
414 $ B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB )
415
416 ENDIF
417
418 * The last processor does not participate in the solution of the
419 * reduced system , having sent its contribution already.
420 IF( MYCOL .EQ. NPCOL - 1 ) THEN
420
421 GOTO 44
422 ENDIF
423
424 * *************************************
425 * Modification Loop
426
427 * The distance for sending and receiving for each level starts
428 * at 1 for the first level.
429 LEVEL_DIST = 1
430
431 * Do until this proc is needed to modify other procs' equations
432
433 42 CONTINUE
434 IF( MOD((MYCOL + 1) / LEVEL_DIST , 2) .NE. 0 ) GOTO 41
435
436 * Receive and add contribution to righthand sides from left
437
438 IF( MYCOL - LEVEL_DIST .GE. 0 ) THEN
439
439
440 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
441 $ WORK( 1 ) ,
442 $ INT_ONE , 0 , MYCOL - LEVEL_DIST )
443
444 CALL CMATADD( INT_ONE , NRHS , CONE ,
445 $ WORK( 1 ) , INT_ONE , CONE ,
446 $ B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB )
447
448 ENDIF
449
450 * Receive and add contribution to righthand sides from right
451
452 IF( MYCOL + LEVEL_DIST .LT. NPCOL - 1 ) THEN
453
453
454 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
455 $ WORK( 1 ) ,
456 $ INT_ONE , 0 , MYCOL + LEVEL_DIST )
457
458 CALL CMATADD( INT_ONE , NRHS , CONE ,
459 $ WORK( 1 ) , INT_ONE , CONE ,
460 $ B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB )
461
462 ENDIF
463
464 LEVEL_DIST = LEVEL_DIST*2
465
466 GOTO 42
467 41 CONTINUE
468 * [End of GOTO Loop]
469
470 * *********************************
471 * Calculate and use this proc's blocks to modify other procs
472
473 * Solve with diagonal block
474
475 CALL CTBTRS( 'U' , 'C' , 'N' , INT_ONE , MIN( INT_ONE , INT_ONE - 1 ) ,
476 $NRHS , AF( ODD_SIZE + 2 ) , INT_ONE + 1 ,
477 $B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB , INFO )
478
479 IF( INFO.NE.0 ) THEN
479
480 GO TO 1000
481 ENDIF
482
483 * *********
484 IF( MYCOL / LEVEL_DIST .LE.(NPCOL - 1) / LEVEL_DIST - 2 )THEN
485
486 * Calculate contribution from this block to next diagonal block
487
487
488 CALL CGEMM( 'C' , 'N' , INT_ONE , NRHS , INT_ONE , - CONE ,
489 $ AF( WORK_U + (ODD_SIZE)*INT_ONE + 1 ) ,
490 $ INT_ONE ,
491 $ B( PART_OFFSET + ODD_SIZE + 1 ) ,
492 $ LLDB , CZERO ,
493 $ WORK( 1 ) ,
494 $ INT_ONE )
495
496 * Send contribution to diagonal block's owning processor.
497
498 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
499 $ WORK( 1 ) ,
500 $ INT_ONE , 0 , MYCOL + LEVEL_DIST )
501
502 ENDIF
503 * End of "if( mycol/level_dist .le.(npcol-1)/level_dist-2 )..."
504
505 * ************
506 IF((MYCOL / LEVEL_DIST .GT. 0 ).AND.
507 $( MYCOL / LEVEL_DIST .LE.(NPCOL - 1) / LEVEL_DIST - 1 ) ) THEN
508
509 * Use offdiagonal block to calculate modification to diag block
510 * of processor to the left
511
512 CALL CGEMM( 'N' , 'N' , INT_ONE , NRHS , INT_ONE , - CONE ,
513 $AF( WORK_U + ODD_SIZE*INT_ONE + 2 + 1 ) ,
514 $INT_ONE ,
515 $B( PART_OFFSET + ODD_SIZE + 1 ) ,
516 $LLDB , CZERO ,
517 $WORK( 1 ) ,
518 $INT_ONE )
519
520 * Send contribution to diagonal block's owning processor.
521
522 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
523 $WORK( 1 ) ,
524 $INT_ONE , 0 , MYCOL - LEVEL_DIST )
525
526 ENDIF
527 * End of "if( mycol/level_dist.le.(npcol-1)/level_dist -1 )..."
528
529 44 CONTINUE
530
531 ELSE
532
533 * ******************* BACKSOLVE *************************************
534
535 * *******************************************************************
536 * .. Begin reduced system phase of algorithm ..
537 * *******************************************************************
538
539 * The last processor does not participate in the solution of the
540 * reduced system and just waits to receive its solution.
540
541 IF( MYCOL .EQ. NPCOL - 1 ) THEN
541
542 GOTO 54
543 ENDIF
544
545 * Determine number of steps in tree loop
546
547 LEVEL_DIST = 1
548 57 CONTINUE
549 IF( MOD((MYCOL + 1) / LEVEL_DIST , 2) .NE. 0 ) GOTO 56
550
551 LEVEL_DIST = LEVEL_DIST*2
552
553 GOTO 57
554 56 CONTINUE
555
556 IF((MYCOL / LEVEL_DIST .GT. 0 ).AND.
557 $( MYCOL / LEVEL_DIST .LE.(NPCOL - 1) / LEVEL_DIST - 1 ) ) THEN
558
559 * Receive solution from processor to left
560
561 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
562 $WORK( 1 ) ,
563 $INT_ONE , 0 , MYCOL - LEVEL_DIST )
564
565 * Use offdiagonal block to calculate modification to RHS stored
566 * on this processor
567
568 CALL CGEMM( 'C' , 'N' , INT_ONE , NRHS , INT_ONE , - CONE ,
569 $AF( WORK_U + ODD_SIZE*INT_ONE + 2 + 1 ) ,
570 $INT_ONE ,
571 $WORK( 1 ) ,
572 $INT_ONE , CONE ,
573 $B( PART_OFFSET + ODD_SIZE + 1 ) ,
574 $LLDB )
575 ENDIF
576 * End of "if( mycol/level_dist.le.(npcol-1)/level_dist -1 )..."
577
578 IF( MYCOL / LEVEL_DIST .LE.(NPCOL - 1) / LEVEL_DIST - 2 )THEN
579
580 * Receive solution from processor to right
581
581
582 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
583 $ WORK( 1 ) ,
584 $ INT_ONE , 0 , MYCOL + LEVEL_DIST )
585
586 * Calculate contribution from this block to next diagonal block
587
588 CALL CGEMM( 'N' , 'N' , INT_ONE , NRHS , INT_ONE , - CONE ,
589 $ AF( WORK_U + (ODD_SIZE)*INT_ONE + 1 ) ,
590 $ INT_ONE ,
591 $ WORK( 1 ) ,
592 $ INT_ONE , CONE ,
593 $ B( PART_OFFSET + ODD_SIZE + 1 ) ,
594 $ LLDB )
595
596 ENDIF
597 * End of "if( mycol/level_dist .le.(npcol-1)/level_dist-2 )..."
598
599 * Solve with diagonal block
600
601 CALL CTBTRS( 'U' , 'N' , 'N' , INT_ONE , MIN( INT_ONE , INT_ONE - 1 ) ,
602 $NRHS , AF( ODD_SIZE + 2 ) , INT_ONE + 1 ,
603 $B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB , INFO )
604
605 IF( INFO.NE.0 ) THEN
605
606 GO TO 1000
607 ENDIF
608
609 * **Modification Loop *******
610
611 52 CONTINUE
612 IF( LEVEL_DIST .EQ. 1 ) GOTO 51
613
614 LEVEL_DIST = LEVEL_DIST / 2
615
616 * Send solution to the right
617
618 IF( MYCOL + LEVEL_DIST .LT. NPCOL - 1 ) THEN
619
619
620 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
621 $ B( PART_OFFSET + ODD_SIZE + 1 ) ,
622 $ LLDB , 0 , MYCOL + LEVEL_DIST )
623
624 ENDIF
625
626 * Send solution to left
627
628 IF( MYCOL - LEVEL_DIST .GE. 0 ) THEN
629
629
630 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
631 $ B( PART_OFFSET + ODD_SIZE + 1 ) ,
632 $ LLDB , 0 , MYCOL - LEVEL_DIST )
633
634 ENDIF
635
636 GOTO 52
637 51 CONTINUE
638 * [End of GOTO Loop]
639
640 54 CONTINUE
641 * [Processor npcol - 1 jumped to here to await next stage]
642
643 * ******************************
644 * Reduced system has been solved , communicate solutions to nearest
645 * neighbors in preparation for local computation phase.
646
647 * Send elements of solution to next proc
648
649 IF( MYCOL .LT. NPCOL - 1) THEN
650
650
651 CALL CGESD2D( ICTXT , INT_ONE , NRHS ,
652 $ B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB ,
653 $ 0 , MYCOL + 1 )
654
655 ENDIF
656
657 * Receive modifications to processor's right hand sides
658
659 IF( MYCOL .GT. 0) THEN
660
660
661 CALL CGERV2D( ICTXT , INT_ONE , NRHS ,
662 $ WORK( 1 ) , INT_ONE ,
663 $ 0 , MYCOL - 1 )
664
665 ENDIF
666
667 * *********************************************
668 * Local computation phase
669 * *********************************************
670
671 IF( MYCOL .NE. 0 ) THEN
672 * Use the "spike" fillin to calculate contribution from previous
673 * processor's solution.
674
674
675 CALL CGEMM( 'N' , 'N' , ODD_SIZE , NRHS , INT_ONE , - CONE ,
676 $ AF( WORK_U + 1 ) , ODD_SIZE ,
677 $ WORK( 1 + INT_ONE - INT_ONE ) , INT_ONE , CONE ,
678 $ B( PART_OFFSET + 1 ) , LLDB )
679
680 ENDIF
681
682 IF( MYCOL .LT. NP - 1 ) THEN
683 * Use factorization of odd - even connection block to modify
684 * locally stored portion of right hand side(s)
685
685
686 CALL CAXPY( NRHS , - ( DU( PART_OFFSET + ODD_SIZE ) ) ,
687 $ B( PART_OFFSET + ODD_SIZE + 1 ) , LLDB ,
688 $ B( PART_OFFSET + ODD_SIZE ) , LLDB )
689
690 ENDIF
691
692 * Use main partition in each processor to solve locally
693
694 CALL CDTTRSV ( UPLO , 'N' , ODD_SIZE , NRHS , DU( PART_OFFSET + 2 ) ,
695 $D( PART_OFFSET + 1 ) , DU( PART_OFFSET + 1 ) ,
696 $B( PART_OFFSET + 1 ) , LLDB , INFO )
697
698 ENDIF
699 * End of "IF( LSAME( TRANS, 'N' ) )"...
700
701 ENDIF
702 * End of "IF( LSAME( UPLO, 'L' ) )"...
703 1000 CONTINUE
704
705 * Free BLACS space used to hold standard - form grid.
706
707 IF( ICTXT_SAVE .NE. ICTXT_NEW ) THEN
707
708 CALL BLACS_GRIDEXIT( ICTXT_NEW )
709 ENDIF
710
711 1234 CONTINUE
712
713 * Restore saved input parameters
714
715 ICTXT = ICTXT_SAVE
716 NP = NP_SAVE
717
718 * Output minimum worksize
719
720 WORK( 1 ) = WORK_SIZE_MIN
721
722 RETURN
723
724 * End of PCDTTRSV
725
726 END165
18
|
|
Variables in Routine PCDTTRSV()
| Summary Report |
| Data Type | Quantity | Size(byte) |
| CHARACTER | 2 | 2 |
| COMPLEX | 8 | 32 |
| INTEGER | 26 | 104 |
| REAL | 2 | 8 |
| TOTAL | 38 | 146 |
List of Variables
CHARACTER
COMPLEX
| AF( * ) | B( * ) | CONE | CZERO | D( * ) |
| DL( * ) | DU( * ) | WORK( * ) | | |
INTEGER
| BIGNUM | BLOCK_CYCLIC_2D | CSRC_ | CTXT_ | DESCA( * ) |
| DESCB( * ) | DESCMULT | DLEN_ | DTYPE_ | IB |
| ICTXT | INFO | INT_ONE | JA | LAF |
| LEVEL_DIST | LLD_ | LWORK | M_ | MB_ |
| N | N_ | NB_ | NP | NRHS |
| RSRC_ | | | | |
REAL
Variables Dependence Graph Put the mouse over a right hand side variable to display the corresponding line of the dependence | | - | | - | - | | LEVEL_DIST | <--- | LEVEL_DISTLEVEL_DIST = LEVEL_DIST*2{2LEVEL_DIST = LEVEL_DIST*2, 3LEVEL_DIST = LEVEL_DIST/2} |
|
|
Analysis elements of the routine PCDTTRSV() Put the mouse over each element to display detailed matching information
Assigned variables |
| | | BIGNUM , BLOCK_CYCLIC_2D , CONE , CSRC_ , CTXT_ , CZERO , DESCMULT , DLEN_ , DTYPE_ , ICTXT , INFO , INT_ONE , JA , LEVEL_DIST , LLD_ , LWORK , M_ , MB_ , N , N_ , NB_ , NP , NRHS , ONE , RSRC_ , WORK , ZERO |
|
Active variables |
| | | AF , B , BIGNUM , BLOCK_CYCLIC_2D , CONE , CSRC_ , CTXT_ , CZERO , D , DESCA , DESCB , DESCMULT , DL , DLEN_ , DTYPE_ , DU , IB , ICTXT , INFO , INT_ONE , JA , LAF , LEVEL_DIST , LLD_ , LWORK , M_ , MB_ , N , N_ , NB_ , NP , NRHS , one , RSRC_ , TRANS , UPLO , WORK , ZERO |
|
Allocated variables [ statement : associated variable ] |
| | new | : a, or |
|
Desallocated variables [ statement : associated variable ] |
| | free | : BLACS |
|
Accessed arrays [ array name : associated index ] |
| | AF | : * , 1 , ODD_SIZE+2 , ODD_SIZE+2 , WORK_U+(ODD_SIZE)*INT_ONE+1 , WORK_U+(ODD_SIZE)*INT_ONE+1 , WORK_U+1 , WORK_U+ODD_SIZE*INT_ONE+2+1 , WORK_U+ODD_SIZE*INT_ONE+2+1 |
| | B | : * , IB:IB+N-1, 1:NRHS , IB:IB+N-1, 1:NRHS , IB:IB+N-1, 1:NRHS , IB:IB+N-1, 1:NRHS , PART_OFFSET+1 , PART_OFFSET+1 , PART_OFFSET+ODD_SIZE + 1 , PART_OFFSET+ODD_SIZE + 1 , PART_OFFSET+ODD_SIZE + 1 , PART_OFFSET+ODD_SIZE , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 , PART_OFFSET+ODD_SIZE+1 |
| | D | : * , PART_OFFSET+1 |
| | DESCA | : * , 1 , 2 , 3 , 4 , 5 , 6 , 7 , CSRC_ , CTXT_ , DTYPE_ , LLD_ , M_ , MB_ , N_ , NB_ , NB_ , NB_ , NB_ , RSRC_ |
| | DESCB | : * |
| | DL | : * , 1 |
| | DU | : * , n , PART_OFFSET+1 , PART_OFFSET+2 , PART_OFFSET+ODD_SIZE |
| | WORK | : * , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1+INT_ONE-INT_ONE |
|
Conditional statements [ statement : associated predicate ] |
| | do | : ( not support intercontext operations* so that ) , ( until this proc is needed to modify other procs' equations ) |
| | for | : ( the distributed matrix A. ) , ( full description and options. ) , ( the distributed matrix B. ) , ( full description and options. ) , ( matrices must be blocked , reflecting the nature ) , ( solving banded and tridiagonal linear systems ) , ( the case N / P >> bw are ) , ( tridiagonal matrices , it is obvious : N / P >> bw( = 1) , and so D&C ) , ( the factorization or 3 for the ) , ( the ) , ( a linear system , a parallel front solve ) , ( a linear system , a local backsubstitution is performed on ) , ( any 2D block cyclicly distributed array. ) , ( these quantities may be computed by : ) , ( 1D ) , ( tridiagonal matrices , since the objects being ) , ( tridiagonal matrices , ) , ( all array descriptors passed to that routine. ) , ( *both* DTYPE_A and DTYPE_B to be 2D_type(1) , as these lead ) , ( the orientation of the BLACS grid , ) , ( any 1D block cyclicly distributed array. ) , ( 1D grids , ) , ( tridiagonal matrices. ) , ( future use. ) , ( sending and receiving for each level starts ) , ( each level starts ) , ( the first level. ) , ( local computation phase. ) |
| | if | : ( 1D type (DTYPE_A = 501 or 502) , DLEN >= 7 ; ) , ( 2D type (DTYPE_A = 1) , DLEN >= 9. ) , ( 1D type (DTYPE_B = 502) , DLEN >= 7 ; ) , ( 2D type (DTYPE_B = 1) , DLEN >= 9. ) , ( a linear system ) , ( LAF is not large enough , an error code will be returned ) , ( LWORK is too small , the minimal acceptable size will be ) , ( the i-th argument is an array and the j - entry had ) , ( the i-th ) , ( the matrix spans more than one processor , the following ) , ( this is too small , divide and conquer ) , ( the factorization routine and the solve routine are to be called ) , ( K were distributed over the p processes of its ) , ( K were distributed over the q processes of ) , ( the grid were P - by - 1) or the ) , ( the grid were 1 - by - P). This choice is ) , ( the appropriate one - dimensional descriptor is DTYPEA = 501 ) , ( the appropriate one - dimensional descriptor is DTYPEA = 502 ) , ( MYCOL .GT. 0 ) , ( MYCOL .LT. NPCOL - 1 ) , ( MYCOL .EQ. NPCOL - 1 ) , ( (MOD( (MYCOL + 1) / LEVEL_DIST , 2) .NE. 0 ) GOTO 41 ) , ( MYCOL-LEVEL_DIST .GE. 0 ) , ( MYCOL+LEVEL_DIST .LT. NPCOL - 1 ) , ( INFO.NE.0 ) , ( (MYCOL / LEVEL_DIST .LE. (NPCOL - 1) / LEVEL_DIST - 2 )THEN ) , ( ((MYCOL / LEVEL_DIST .GT. 0 ).AND. ) , ( MYCOL .EQ. NPCOL - 1 ) , ( (MOD( (MYCOL + 1) / LEVEL_DIST , 2) .NE. 0 ) GOTO 56 ) , ( ((MYCOL / LEVEL_DIST .GT. 0 ).AND. ) , ( (MYCOL / LEVEL_DIST .LE. (NPCOL - 1) / LEVEL_DIST - 2 )THEN ) , ( INFO.NE.0 ) , ( LEVEL_DIST .EQ. 1 ) , ( MYCOL+LEVEL_DIST .LT. NPCOL - 1 ) , ( MYCOL-LEVEL_DIST .GE. 0 ) , ( MYCOL .LT. NPCOL - 1 ) , ( MYCOL .GT. 0 ) , ( MYCOL .NE. 0 ) , ( MYCOL .LT. NP - 1 ) , ( ICTXT_SAVE .NE. ICTXT_NEW ) |
| | until | : ( this proc is needed to modify other procs' equations ) |
| | while | : ( others ) |
|
| List of variables | AF( * ) B( * ) BIGNUM BLOCK_CYCLIC_2D CONE CSRC_ CTXT_
| CZERO D( * ) DESCA( * ) DESCB( * ) DESCMULT DL( * ) DLEN_ DTYPE_
| DU( * ) IB ICTXT INFO INT_ONE JA LAF LEVEL_DIST
| LLD_ LWORK M_ MB_ N N_ NB_ NP
| NRHS ONE RSRC_ TRANS UPLO WORK( * ) ZERO | | close
| |
AF( * )
B( * )
BIGNUM
BLOCK_CYCLIC_2D
CONE
CSRC_
CTXT_
CZERO
D( * )
DESCA( * )
DESCB( * )
DESCMULT
DL( * )
DLEN_
DTYPE_
DU( * )
IB
ICTXT
INFO
INT_ONE
JA
LAF
LEVEL_DIST
LLD_
LWORK
M_
MB_
N
N_
NB_
NP
NRHS
ONE
RSRC_
TRANS
UPLO
WORK( * )
ZERO
5
| |