Module contains subroutines for solver for block tri-diagonal matrices. More...
Data Types | |
type | blacsparameters |
BLACS/PBLAS information. More... | |
type | blacsprocessgrid |
BLACS/PBLAS process grid information. More... | |
type | levelelement |
Data associated with each row at each level. More... | |
type | mastertoslavemapping |
Master-to-slave mapping. More... | |
type | pblaslevelparameters |
Level-specific PBLAS information. More... | |
type | pblasstats |
type | pblastemparray |
type | solutionelement |
Solution of selected rows of interest to this rank. More... | |
type | timecount |
Statistics (timing, etc.) More... | |
Functions/Subroutines | |
subroutine | bclockinit () |
A convenience function to be able to change clock routine(s) easily. | |
subroutine | bsystemclock (ts) |
A convenience function to be able to change clock routine easily. More... | |
subroutine | fl (u) |
A convenience function to be able to change or turn off easily. More... | |
subroutine | chargememory (bytes) |
Convenience routine to track allocated memory sizes. More... | |
subroutine | chargetime (tot, t2, t1, cnt) |
Convenience routine to accumulate timing values. More... | |
subroutine | timecountinit (tc) |
Initialize stats. | |
subroutine | timecountprint (tc, msg) |
Print stats. | |
subroutine | plbinitstats () |
Init statistics. | |
subroutine | plbprintstats () |
Print statistics so far. | |
subroutine | plbinitialize |
Initialize before foward or backward starts. | |
subroutine | plbfinalize |
Finalize after foward or backward are done. | |
subroutine | plbforwardinitialize |
Initialize before any forward level starts. | |
subroutine | plbforwardfinalize |
Finalize after all forward levels are done. | |
subroutine | plbbackwardinitialize |
Initialize before any backward level starts. | |
subroutine | plbbackwardfinalize |
Finalize after all backward levels are done. | |
subroutine | plbforwardinitializelevel (lvl, ammaster) |
Initialize before the forward solve at a given level starts. | |
subroutine | plbforwardfinalizelevel (lvl, ammaster) |
Finalize after the forward solve at a given level ends. | |
subroutine | plbbackwardinitializelevel (lvl, ammaster) |
Initialize before the backward solve at a given level starts. | |
subroutine | plbbackwardfinalizelevel (lvl, ammaster) |
Finalize after the backward solve at a given level ends. | |
subroutine | determinemasterslaveranks () |
Determine the ranks of master and slaves at this level. | |
subroutine | masterbcastnextop (nextop) |
Inform the next operation to be done (calling rank is in master mode) | |
subroutine | slavegetnextop (nextop) |
Determine the next operation to be done (calling rank is in slave mode) | |
subroutine | slaveservice () |
Slave's operation loop. | |
subroutine | extractsubmatrix (bszr, bszc, pnr, pnc, pi, pj, A, nrows, ncols, subA, subnrows, subncols) |
Extracts from A the submatrix corresponding to process-grid element (pi,pj) | |
subroutine | mastersendmatrix (A, nrows, ncols, ssubA, ssubnrows, ssubncols) |
Send the matrix by master (caller) to all slaves The submatrix belonging to the caller (master is also one of the slaves) is returned in the ssub* arguments (i.e., sent to self) | |
subroutine | slavereceivematrix (nrows, ncols, subA, subnrows, subncols) |
Receive the fragment of matrix sent by master to slave (caller) More... | |
subroutine | masterbcastvalue (val) |
Send the given value by master (caller) to all slaves. | |
subroutine | slavereceivevalue (val) |
Receive a value sent by master to slave (caller) | |
subroutine | injectsubmatrix (bszr, bszc, pnr, pnc, pi, pj, A, nrows, ncols, subA, subnrows, subncols) |
Incorporates into A the submatrix corresp. to process-grid element (pi,pj) | |
subroutine | injectsubvector (bszr, pnr, pi, V, nrows, subV, subnrows) |
Incorporates into V the subvector corresp. to process-grid element (pi,0) | |
subroutine | masterrecvmatrix (A, nrows, ncols, ssubA, ssubnrows, ssubncols) |
Receive the submatrices by master (caller) from all slaves The submatrix belonging to the caller (master is also one of the slaves) is given in the ssub* arguments (i.e., received from self) | |
subroutine | slavesendmatrix (nrows, ncols, subA, subnrows, subncols) |
Send the fragment of matrix by slave (caller) to master. More... | |
subroutine | masterrecvvector (V, nrows, ssubV, ssubnrows) |
Receive the subvector by master (caller) from all slaves in column 1 of pgrid The subvector belonging to the caller (master is also one of the slaves) is given in the ssub* arguments (i.e., received from self) | |
subroutine | slavesendvector (nrows, subV, subnrows) |
Send the fragment of vector by slave (caller) to master Only slaves who belong to zero'th column of pgrid send to master Other slave simply do no-op for this routine. More... | |
subroutine | plbdgemm (alpha, A, B, beta, C) |
Encapsulates BLAS' DGEMM functionality. More... | |
subroutine | slavedgemm () |
DGEMM support from slave. | |
subroutine | plbdgemv (alpha, A, x, beta, y) |
Encapsulates BLAS' DGEMV functionality. More... | |
subroutine | plbdgetrf (A, piv, info) |
Encapsulates BLAS/LAPACK's DGETRF functionality. More... | |
subroutine | slavedgetrf () |
DGETRF support from slave. | |
subroutine | plbdgetrs (nrhs, A, piv, B, info) |
Encapsulates BLAS/LAPACK's DGETRS functionality. More... | |
subroutine | slavedgetrs () |
DGETRS support from slave. | |
subroutine, public | initialize (inN, inM) |
To be invoked, before solve, by user. More... | |
subroutine, public | getranks (irank, inranks) |
subroutine | setmatrixrow (globrow, L, D, U) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine | setmatrixrowl (globrow, L) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine | setmatrixrowd (globrow, D) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine | setmatrixrowu (globrow, U) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine, public | setmatrixrowcoll (globrow, Lj, j) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine, public | setmatrixrowcold (globrow, Dj, j) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine, public | setmatrixrowcolu (globrow, Uj, j) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine, public | setmatrixrhs (globrow, b) |
To be invoked, before solve, after initialize, by user, to set up the matrix. More... | |
subroutine, public | getmatrixrowcoll (globrow, Lj, j) |
Can be invoked after initialize, by user, to get a copy of the matrix. More... | |
subroutine, public | getmatrixrowcold (globrow, Dj, j) |
Can be invoked after initialize, by user, to get a copy of the matrix. More... | |
subroutine, public | getmatrixrowcolu (globrow, Uj, j) |
Can be invoked after initialize, by user, to get a copy of the matrix. More... | |
subroutine, public | getmatrixrhs (globrow, b) |
Can be invoked after initialize, by user, to get a copy of the RHS. More... | |
subroutine, public | getsolutionvector (globrow, x) |
To be invoked, after solve, by user to get the solution vector of a local row. More... | |
subroutine | setidentitytestcase |
To be invoked, before solve, after initialize, by user, to generate a test. | |
subroutine | setidentityrhs |
To be invoked, before solve, after SetIdentityCase, by user, to generate a test. | |
subroutine | setrandomtestcase |
To be invoked, before solve, after initialize, by user, to generate a test. | |
subroutine | setrandomrhs (randseedoff) |
To be invoked, before solve, after SetRandomTestCase, by user, to generate a an RHS. | |
subroutine, public | finalize (do_mpifinalize) |
To be invoked, after solve, by user. More... | |
logical function | iseven (num) |
Is given integer even? More... | |
logical function | isodd (num) |
Is given integer odd? More... | |
integer function | lr2gr (locrow, level) |
Determines the global row number of a given local row number at a given level. More... | |
integer function | gr2lr (globrow, level) |
Determines the local row number of "globrow" global row number when globrow participates at a given level; returns zero if this globrow does not operate at the given level. More... | |
integer function | gr2rank (globrow) |
Determines the rank of the task holding the given global row (at level 1) More... | |
integer function | lr2rank (locrow, level) |
Determines the rank of the task holding the given local row (at a given level) More... | |
subroutine | computeforwardoddrowhats (locrow, level, startlocrow, endlocrow, bonly) |
Compute the matrix multiplications in the forward solve at some/any level The row should be odd at the level, The locrow should obey startlocrow <= locrow <= endlocrow. More... | |
subroutine, public | forwardsolve |
BCYCLIC forward phase; to be called after Initialize. | |
subroutine | forwardupdateb |
BCYCLIC forward phase to deal with a new b; to be called after a SetRHS that may have been invoked after a ForwardSolve, before BackwardSolve. | |
subroutine, public | backwardsolve |
BCYCLIC backward phase; to be called after ForwardSolve. | |
subroutine | verifysolution |
Verify the RMS error of solution after backward solve. | |
subroutine, public | checkconditionnumber (nblkrow, bsize, anorm, rcond, info) |
subroutine, public | checksymmetry (asymIndx) |
subroutine, public | storediagonal (blkrow, colnum, buf) |
subroutine | writeblocks (flag) |
subroutine | displayblocks (flag) |
subroutine, public | parmatvec (invec, outvec, outveclength) |
subroutine | getcolsum (cs) |
subroutine | initscalefactors |
subroutine | getscalefactors (js, scalevector) |
subroutine | finalizescalefactors |
subroutine, public | applyparallelscaling (lmp, colscale) |
subroutine | parallelscaling (colsum) |
subroutine, public | findminmax_tri (lmp) |
subroutine | resetdiagonal (lmp, bReset) |
subroutine, public | refactorhessian (lmp) |
subroutine | computetranspose |
subroutine | vectorcopypar (colsum, colscale) |
subroutine, public | padsides (arrin, blksize, top, bot) |
Variables | |
integer, parameter | rprec = SELECTED_REAL_KIND(12, 100) |
integer, parameter | iprec = SELECTED_INT_KIND(8) |
integer, parameter | cprec = KIND((1.0_rprec, 1.0_rprec)) |
integer, parameter | dp = rprec |
integer | mpi_err |
type(levelelement), dimension(:,:), allocatable | lelement |
Data for each row at each level on this rank The first dimension is the level number [1..L], L=#levels of forward solve The 2nd dimension is the row number [1..K+g], K=#rows at level 1 on this rank The +g is for incoming results from neighbors, 0<=g<=2. | |
type(levelelement), dimension(:), allocatable | orig |
Initial problem specification saved for verification at end of solution The dimension is the row number [1..K], K=#rows at level 1 on this rank. | |
type(solutionelement), dimension(:), allocatable | selement |
The solution The dimension is the global (level 1) row number [1..N]. | |
integer | rank |
This MPI task's rank. | |
integer | nranks |
Num of MPI tasks. | |
integer | p |
Num of "master" tasks, adjusted such that P=Min(nranks,N) | |
integer | n |
Num of row blocks in input block tri-diag matrix. | |
integer | m |
Size of each square sub-matrix block. | |
integer | startglobrow |
Starting row number of this processor at first level. | |
integer | endglobrow |
Ending row number (inclusive) at first level. | |
integer | startrow1 |
1 row less than startglobrow | |
integer | endrow1 |
1 row greater than endglobrow | |
integer | nlevels |
Total number of levels in recursion. | |
logical | matdirtied |
Has a new matrix been set after ForwardSolve? | |
logical | rhsdirtied |
Has a new RHS been set after ForwardSolve? | |
character *100 | kenvvar |
character *100 | kenvval |
logical | lbcylic_init =.FALSE. |
logical | lplb_init =.FALSE. |
logical | kpdbg |
Should debugging output be written? : SKS on Nov 9, 2011. | |
integer | ofu |
Output file unit. | |
integer | pfu |
Problem file unit. | |
logical | writeproblemfile |
Should save the random test case to a file? | |
logical | writesolution |
Should dump solution in output? | |
logical | usebarriers |
Should barriers be invoked between levels? | |
real | membytes |
A running count of memory allocated so far. | |
real | dpsz |
Byte size of a double precision variable. | |
real | intsz |
Byte size of an integer variable. | |
real | ptrsz |
Byte size of a pointer variable. | |
real(dp) | one |
1.0 | |
real(dp) | zero |
0.0 | |
logical(dp) | l_colscale =.FALSE. |
set true if column scaling is applied | |
logical | use_mpiwtime =.FALSE. |
Use MPI's timer function? | |
double precision | loctimer1 |
double precision | loctimer2 |
Stopwatch snapshots to use locally. | |
double precision | mattimer1 |
double precision | mattimer2 |
Stopwatch snapshots for matrix ops. | |
double precision | globtimer1 |
double precision | globtimer2 |
Stopwatch snapshots to use globally. | |
double precision | timerfreq |
Timer frequency in Hz (count rate) | |
double precision | tottime |
Total elapsed time. | |
integer | totcount |
Total count. | |
double precision | totcommtime |
Total communication time. | |
integer | totcommcount |
Total communication operation count. | |
double precision | totinvtime |
Total time to invert matrices. | |
integer | totinvcount |
Total count of matrix inversions. | |
double precision | totmatmultime |
Total time for matrix-matrix multiplications. | |
integer | totmatmulcount |
Total count of matrix-matrix multiplications. | |
double precision | totmatsoltime |
Total time for matrix-solve multiplications. | |
integer | totmatsolcount |
Total count of matrix solutions. | |
real(dp), dimension(:), allocatable | origdiagelement |
Unmodified diagonal element : SKS. | |
real(dp), dimension(:), allocatable | topscalefac |
real(dp), dimension(:), allocatable | botscalefac |
logical | doblasonly |
BLACS/PBLAS options. | |
logical | doblacscomm |
type(blacsparameters) | blacs |
type(pblaslevelparameters) | pblas |
integer, parameter | op_none = 0 |
Master-to-slave commands. | |
integer, parameter | op_done = 1 |
integer, parameter | op_dgemm = 2 |
integer, parameter | op_dgemv = 3 |
integer, parameter | op_dgetrf = 4 |
integer, parameter | op_dgetrs = 5 |
type(pblasstats) | pstats |
real(dp), public | maxeigen_tri |
maximum eigenvalue from Gerschgorin theorem | |
real(dp), public | dmin_tri |
minimum non-zero diagonal element, used to scale Levenberg parameter (SPH 08-31-16) | |
Module contains subroutines for solver for block tri-diagonal matrices.
|
private |
A convenience function to be able to change clock routine easily.
[in,out] | ts | Time snapshot |
Definition at line 268 of file blocktridiagonalsolver_s.f90.
|
private |
Convenience routine to track allocated memory sizes.
[in] | bytes | Number of bytes allocated |
Definition at line 310 of file blocktridiagonalsolver_s.f90.
|
private |
Convenience routine to accumulate timing values.
[in,out] | tot | Total time |
[in] | t2 | Timer value at end of segment being timed |
[in] | t1 | Timer value at start of timed segment |
[in,out] | cnt | Counter of number of samples |
Definition at line 325 of file blocktridiagonalsolver_s.f90.
|
private |
Compute the matrix multiplications in the forward solve at some/any level The row should be odd at the level, The locrow should obey startlocrow <= locrow <= endlocrow.
[in] | locrow | Row number at a given level |
[in] | level | Local row number is at this level |
[in] | startlocrow | Top-most local row number at given level |
[in] | endlocrow | Bot-most local row number at given level |
[in] | bonly | Show compute/update only the b, and not L,D,U? |
Definition at line 3393 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::finalize | ( | logical, intent(in) | do_mpifinalize | ) |
To be invoked, after solve, by user.
[in] | do_mpifinalize | Invoke MPI_Finalize? |
Definition at line 3129 of file blocktridiagonalsolver_s.f90.
|
private |
A convenience function to be able to change or turn off easily.
[in] | u | Unit number to flush |
Definition at line 296 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::getmatrixrhs | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(out) | b | ||
) |
Can be invoked after initialize, by user, to get a copy of the RHS.
[in] | globrow | Original/global block-row num in [1..N] |
[out] | b | RHS column corr. to globrow |
Definition at line 2826 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::getmatrixrowcold | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(out) | Dj, | ||
integer, intent(in) | j | ||
) |
Can be invoked after initialize, by user, to get a copy of the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[out] | dj | j'th colum of D at globrow |
[in] | j | column number of L at globrow that is being set |
Definition at line 2730 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::getmatrixrowcoll | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(out) | Lj, | ||
integer, intent(in) | j | ||
) |
Can be invoked after initialize, by user, to get a copy of the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[out] | lj | j'th colum of L at globrow; 1st L is always 0 |
[in] | j | column number of L at globrow that is being set |
Definition at line 2680 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::getmatrixrowcolu | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(out) | Uj, | ||
integer, intent(in) | j | ||
) |
Can be invoked after initialize, by user, to get a copy of the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[out] | uj | j'th colum of L at globrow; Nth U is always 0 |
[in] | j | column number of U at globrow that is being set |
Definition at line 2776 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::getsolutionvector | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(out) | x | ||
) |
To be invoked, after solve, by user to get the solution vector of a local row.
[in] | globrow | Original/global block-row num in [1..N] |
[out] | x | Solution column corr. to globrow |
Definition at line 2867 of file blocktridiagonalsolver_s.f90.
|
private |
Determines the local row number of "globrow" global row number when globrow participates at a given level; returns zero if this globrow does not operate at the given level.
[in] | globrow | Row number in original input (level 1) |
[in] | level | Level at which globrow's position is needed |
Definition at line 3299 of file blocktridiagonalsolver_s.f90.
|
private |
Determines the rank of the task holding the given global row (at level 1)
[in] | globrow | Row number in original input (level 1) |
Definition at line 3333 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::initialize | ( | integer, intent(in) | inN, |
integer, intent(in) | inM | ||
) |
To be invoked, before solve, by user.
[in] | inn | Num of row blocks in input block tri-diag matrix |
[in] | inm | Size of each square sub-matrix block |
Definition at line 2006 of file blocktridiagonalsolver_s.f90.
|
private |
Is given integer even?
[in] | num | A number |
Definition at line 3241 of file blocktridiagonalsolver_s.f90.
|
private |
Is given integer odd?
[in] | num | A number |
Definition at line 3251 of file blocktridiagonalsolver_s.f90.
|
private |
Determines the global row number of a given local row number at a given level.
[in] | locrow | local row number of global row, at given level |
[in] | level | Level at which locrow's position is given |
Definition at line 3261 of file blocktridiagonalsolver_s.f90.
|
private |
Determines the rank of the task holding the given local row (at a given level)
[in] | locrow | Row number at a given level |
[in] | level | Local row number is at this level |
Definition at line 3366 of file blocktridiagonalsolver_s.f90.
|
private |
Encapsulates BLAS' DGEMM functionality.
[in] | b | Each matrix of size MxM |
[in,out] | c | Matrix of size MxM |
Definition at line 1558 of file blocktridiagonalsolver_s.f90.
|
private |
Encapsulates BLAS' DGEMV functionality.
[in] | a | Matrix of size MxM |
[in] | x | Vector of size Mx1 |
[in,out] | y | Vector of size Mx1 |
Definition at line 1793 of file blocktridiagonalsolver_s.f90.
|
private |
Encapsulates BLAS/LAPACK's DGETRF functionality.
[in,out] | a | Matrix of size MxM |
[out] | piv | Mx1 |
Definition at line 1812 of file blocktridiagonalsolver_s.f90.
|
private |
Encapsulates BLAS/LAPACK's DGETRS functionality.
[in] | a | Matrix of size MxM |
[in] | piv | Mx1 |
[in,out] | b | Matrix of size Mxnrhs |
Definition at line 1971 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::setmatrixrhs | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(in) | b | ||
) |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | b | RHS column corr. to globrow |
Definition at line 2631 of file blocktridiagonalsolver_s.f90.
|
private |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | u | Vals in 1st L(or Nth U) == 0.0 |
Definition at line 2233 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::setmatrixrowcold | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(in) | Dj, | ||
integer, intent(in) | j | ||
) |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | dj | j'th colum of D at globrow |
[in] | j | column number of L at globrow that is being set |
Definition at line 2519 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::setmatrixrowcoll | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(in) | Lj, | ||
integer, intent(in) | j | ||
) |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | lj | j'th colum of L at globrow; 1st L is always 0 |
[in] | j | column number of L at globrow that is being set |
Definition at line 2461 of file blocktridiagonalsolver_s.f90.
subroutine, public blocktridiagonalsolver_s::setmatrixrowcolu | ( | integer, intent(in) | globrow, |
real(dp), dimension(:), intent(in) | Uj, | ||
integer, intent(in) | j | ||
) |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | uj | j'th colum of L at globrow; Nth U is always 0 |
[in] | j | column number of U at globrow that is being set |
Definition at line 2573 of file blocktridiagonalsolver_s.f90.
|
private |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
Definition at line 2355 of file blocktridiagonalsolver_s.f90.
|
private |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | l | Vals in 1st L == 0.0 |
Definition at line 2300 of file blocktridiagonalsolver_s.f90.
|
private |
To be invoked, before solve, after initialize, by user, to set up the matrix.
[in] | globrow | Original/global block-row num in [1..N] |
[in] | u | Vals in Nth U == 0.0 |
Definition at line 2406 of file blocktridiagonalsolver_s.f90.
|
private |
Receive the fragment of matrix sent by master to slave (caller)
[in] | ncols | of global matrix |
Definition at line 1142 of file blocktridiagonalsolver_s.f90.
|
private |
Send the fragment of matrix by slave (caller) to master.
[in] | ncols | of global matrix |
Definition at line 1416 of file blocktridiagonalsolver_s.f90.
|
private |
Send the fragment of vector by slave (caller) to master Only slaves who belong to zero'th column of pgrid send to master Other slave simply do no-op for this routine.
[in] | nrows | of global matrix |
Definition at line 1525 of file blocktridiagonalsolver_s.f90.