TDLS 0.4.0
Tiny Device-callable Linear Solvers
Loading...
Searching...
No Matches
solver_dynamic.hpp File Reference

Runtime-shape variant of the ArrowheadLUpp solver. More...

Include dependency graph for solver_dynamic.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tdls::ArrowheadLUppSolverDynamic< T, Config >
 Arrowhead solver with a runtime shape. More...
 
struct  tdls::ArrowheadLUppSolverDynamic< T, Config >::StreamedBlock
 Block k of a streamed solve: a view of the areas of the workspace where the solver factors and solves the block, which the caller fills through the accessors when the solver asks for it; the factorization and the solve then run in place; only a save, after the areas of the stored path, is copied to store a refused block as given. The accessors are those of ArrowheadLUppSolverStatic::StreamedBlock, so that one provider serves both solvers. Entries in logical order whatever the layout and the storage. The areas hold the previous block: the caller writes every entry, zeros included, by assignment. More...
 
struct  tdls::ArrowheadLUppSolverDynamic< T, Config >::RecomputedBlock
 Block k of a recomputed solve (solve_inplace_recomputed, solve_inplace_recomputed_or_tangent): a StreamedBlock, the same view and accessors, and whether the solver asks for the block again, in its recovery. A provider taking a StreamedBlock& serves too; one taking a RecomputedBlock&, or auto&, reads the flag. The streamed entry points keep the StreamedBlock alone, so that their code is that of a solver without the recomputed ones. More...
 

Macros

#define TDLS_ARROW_LUPP_DYN_A(idx)
 Strided stored entry at index idx of the matrix.
 
#define TDLS_ARROW_LUPP_DYN_Y(i)
 Strided entry i of the right-hand side and solution.
 
#define TDLS_ARROW_LUPP_DYN_YW(m, i)
 Strided entry i of column m of the right-hand sides and solutions. The function declares ycols, its number of columns when fixed at compile time (0 otherwise): with one, m is ignored and the macro is TDLS_ARROW_LUPP_DYN_Y exactly.
 
#define TDLS_ARROW_LUPP_DYN_W(e)
 Strided entry e of the workspace.
 
#define TDLS_ARROW_LUPP_DYN_F(r, c)
 Entry (r, c) of the front of the second pass, row-major at the start of the workspace.
 
#define TDLS_ARROW_LUPP_DYN_LU(i, j)
 Entry (i, j) of the factors of the block in the workspace, by rows (physical_solve).
 
#define TDLS_ARROW_LUPP_DYN_RC(c, i)
 Entry i of column c of the right-hand sides of the block in the workspace (physical_solve).
 

Detailed Description

Runtime-shape variant of the ArrowheadLUpp solver.

Author
Tristan Chenaille

Same algorithm as ArrowheadLUppSolverStatic (solver_static.hpp): static condensation of the blocks with the pivot check, second pass of the refused blocks, border solve, recovery. The difference is that the shape is a runtime function argument instead of a template argument. The storage, the coupling, the layout and the knobs stay compile-time. The blocks and the border are solved by TiledLUppSolverDynamic.

Deliberate differences with the compile-time solver:

  • No local array: a device has no array of runtime size. Every temporary of the solver (the copy of a block, its border multipliers, the solved right-hand sides, the accumulated Schur complement, the border system...) lives in the workspace, of workspace_size(shape) entries, and the pivots of the blocks and of the border in a caller array of pivot_size(shape) ints.
  • No residency booleans and no unroll pragma: every array is a pointer plus a stride, and the unroll_loops knob is ignored.
  • A streamed block (StreamedBlock) is a view of the workspace, where the provider writes every entry of the block, zeros included, and the solver factors and solves it; the streamed entry points need streamed_workspace_size(shape) entries: the block is written where the stored path copies it, and A_bk under the dense coupling and the copies that restore a refused block come after the areas of the stored path. The provider must not throw: the entry points are noexcept.

For equal shapes and configurations, the results are bitwise identical to the compile-time solver: the arithmetic sequence is the same, only the addressing and the loop mechanics differ. A compiler that fuses multiplications and additions differently in the two (GCC with -march=native does) changes the last bits. -ffp-contract=off (–fmad=false for nvcc) keeps them identical.

The compile-time solver is the performance path; this variant is the flexibility path (shapes unknown at compile time, faster builds).

Preconditions: a workspace and a pivot array of the sizes above. The entry points check the shape first, valid(shape, nrhs), and return false on a shape they reject. An rhs_pass_width above border + nrhs counts as border + nrhs, one pass (the compile-time solver rejects a width above border + 1, its border being known). Element offsets, index times stride, are computed in 64-bit arithmetic.

Macro Definition Documentation

◆ TDLS_ARROW_LUPP_DYN_A

#define TDLS_ARROW_LUPP_DYN_A ( idx)
Value:
A[TDLS_STRIDED(idx, A_stride)]
#define TDLS_STRIDED(i, s)
Offset of entry i of a strided object, i times stride s, in 64-bit arithmetic (std::size_t); i and s ...
Definition macros.hpp:206

Strided stored entry at index idx of the matrix.

◆ TDLS_ARROW_LUPP_DYN_F

#define TDLS_ARROW_LUPP_DYN_F ( r,
c )
Value:
TDLS_ARROW_LUPP_DYN_W((r) * front_cols + (c))
#define TDLS_ARROW_LUPP_DYN_W(e)
Strided entry e of the workspace.
Definition solver_dynamic.hpp:92

Entry (r, c) of the front of the second pass, row-major at the start of the workspace.

◆ TDLS_ARROW_LUPP_DYN_LU

#define TDLS_ARROW_LUPP_DYN_LU ( i,
j )
Value:
TDLS_ARROW_LUPP_DYN_W(o.Dl + (i) * S + (j))

Entry (i, j) of the factors of the block in the workspace, by rows (physical_solve).

◆ TDLS_ARROW_LUPP_DYN_RC

#define TDLS_ARROW_LUPP_DYN_RC ( c,
i )
Value:
TDLS_ARROW_LUPP_DYN_W(o.W + (c) * S + (i))

Entry i of column c of the right-hand sides of the block in the workspace (physical_solve).

◆ TDLS_ARROW_LUPP_DYN_W

#define TDLS_ARROW_LUPP_DYN_W ( e)
Value:
work[TDLS_STRIDED(e, work_stride)]

Strided entry e of the workspace.

◆ TDLS_ARROW_LUPP_DYN_Y

#define TDLS_ARROW_LUPP_DYN_Y ( i)
Value:
y[TDLS_STRIDED(i, rhs_stride)]

Strided entry i of the right-hand side and solution.

◆ TDLS_ARROW_LUPP_DYN_YW

#define TDLS_ARROW_LUPP_DYN_YW ( m,
i )
Value:
y[TDLS_STRIDED(i, rhs_stride) + \
(ycols == 1 ? std::size_t(0) : TDLS_STRIDED_WIDE(m, xcol_stride))]
#define TDLS_STRIDED_WIDE(i, s)
Offset of entry i of a strided object, i times stride s, for a 64-bit stride s (std::size_t); i is a ...
Definition macros.hpp:227

Strided entry i of column m of the right-hand sides and solutions. The function declares ycols, its number of columns when fixed at compile time (0 otherwise): with one, m is ignored and the macro is TDLS_ARROW_LUPP_DYN_Y exactly.