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