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

Shape and compile-time configuration of the ArrowheadLUpp solver family. More...

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

Go to the source code of this file.

Classes

struct  tdls::ArrowheadShape
 Shape of an arrowhead matrix: a template argument of the compile-time solver, a function argument of the runtime one. More...
 
struct  tdls::ArrowheadLUppConfig< T >
 Compile-time knobs of the ArrowheadLUpp solvers, carrying the tuned defaults. More...
 

Enumerations

enum class  tdls::ArrowheadStorage { Full , Packed , Csr , Bsr }
 Storage of an arrowhead matrix. More...
 
enum class  tdls::ArrowheadCoupling { Dense , Diagonal }
 Pattern of the border-to-block couplings A_bk, the entries of the border rows in the columns of a block. More...
 
enum class  tdls::ArrowheadCondensation { MinFlops , MinTraffic }
 Condensation of an accepted block: what its Schur update and its recovery data spare, flops or memory traffic (ArrowheadLUppConfig::condensation). More...
 

Functions

template<typename T >
constexpr TiledLUppConfig< T > tdls::detail::arrowhead_block_config (const ArrowheadLUppConfig< T > &config) noexcept
 TiledLUpp configuration of the diagonal blocks of an ArrowheadLUpp solver.
 
template<typename T >
constexpr TiledLUppConfig< T > tdls::detail::arrowhead_physical_block_config (const ArrowheadLUppConfig< T > &config) noexcept
 TiledLUpp configuration of the diagonal blocks eliminated in registers: that of arrowhead_block_config with physical row interchanges (the whole block one tile, every index known at compile time).
 
template<typename T >
TDLS_HOST_DEVICE constexpr bool tdls::detail::arrowhead_register_blocks (const ArrowheadLUppConfig< T > &config, const int S) noexcept
 Whether the diagonal blocks of S unknowns are eliminated in registers (ArrowheadLUppConfig::block_row_interchange, Auto resolved).
 
template<typename T >
TDLS_HOST_DEVICE constexpr int tdls::detail::arrowhead_rhs_pass_width (const ArrowheadLUppConfig< T > &config, const bool reg) noexcept
 The width of the passes over [A_kb | y_k] (ArrowheadLUppConfig::rhs_pass_width), -1 resolved: 2 on GPU with the blocks in registers, whatever the layout, 0 (one pass) otherwise.
 
template<typename T >
TDLS_HOST_DEVICE constexpr bool tdls::detail::arrowhead_register_blocks_here (const RowInterchange interchange, const int S) noexcept
 Whether the diagonal blocks of S unknowns are eliminated in registers, decided at run time on the side of the code (detail::physical_rows_here): the choice of the runtime solver.
 
TDLS_HOST_DEVICE constexpr int tdls::detail::arrowhead_rhs_pass_width_here (const int width, const bool reg) noexcept
 arrowhead_rhs_pass_width decided at run time on the side of the code, as arrowhead_register_blocks_here.
 
template<typename T , bool gpu>
constexpr ArrowheadLUppConfig< T > tdls::detail::arrowhead_resolved_config (ArrowheadLUppConfig< T > config, const int S) noexcept
 The configuration with the choices of the given hardware made explicit: block_row_interchange Physical or Logical, rhs_pass_width non-negative (the delegation of the side dispatch of nvc++).
 
template<typename T >
constexpr TiledLUppConfig< T > tdls::detail::arrowhead_border_config (const ArrowheadLUppConfig< T > &config) noexcept
 TiledLUpp configuration of the border system of an ArrowheadLUpp solver, a local row-major array whatever the layout.
 

Detailed Description

Shape and compile-time configuration of the ArrowheadLUpp solver family.

Author
Tristan Chenaille

An arrowhead matrix, or bordered block-diagonal matrix, has border unknowns first, then blocks diagonal blocks of block unknowns:

[ Abb  Ab0  Ab1 ... ]
[ A0b  D0           ]
[ A1b       D1      ]
[ ...           ... ]

Two blocks never couple. ArrowheadShape holds the four integers of this pattern; it is a template argument of the compile-time solver and a function argument of the runtime one, as the dimension N of TiledLUpp. Every knob is a member of the ArrowheadLUppConfig aggregate, passed as the Config non-type template argument of both solvers, with designated initializers in declaration order:

constexpr auto config = tdls::ArrowheadLUppConfig<double>{ .coupling = tdls::ArrowheadCoupling::Diagonal, .storage = tdls::ArrowheadStorage::Packed};

Both aggregates are structural types: every member is public, and two values with equal members name the same instantiation. The floating-point knobs are held as tdls::StructuralReal values, as in the other families.

Enumeration Type Documentation

◆ ArrowheadCondensation

enum class tdls::ArrowheadCondensation
strong

Condensation of an accepted block: what its Schur update and its recovery data spare, flops or memory traffic (ArrowheadLUppConfig::condensation).

The two differ under the row-major layout with the dense coupling only. The other paths run the whole solve W_k = D_k^-1 [A_kb | y_k] either way: under the diagonal coupling it already costs fewer flops than the update by the multipliers, and under the column-major layout it is the only path.

Enumerator
MinFlops 

the forward stage V_k = L^-1 P [A_kb | y_k] alone, the Schur complement updated by M V_k with the border multipliers M = A_bk U^-1 of the pivot check; V_k in place of A_kb and y_k, U in the upper triangle of D_k, and the backward stage, on one column, in the recovery

MinTraffic 

the whole solve W_k = D_k^-1 [A_kb | y_k], the Schur complement updated by A_bk W_k; W_k in place of A_kb and y_k, D_k left as stored: U is neither written nor read again

◆ ArrowheadCoupling

enum class tdls::ArrowheadCoupling
strong

Pattern of the border-to-block couplings A_bk, the entries of the border rows in the columns of a block.

Enumerator
Dense 

every border row may touch every unknown of every block

Diagonal 

unknown i of a block touches border row coupling_row + i only

◆ ArrowheadStorage

enum class tdls::ArrowheadStorage
strong

Storage of an arrowhead matrix.

Every storage holds the entries of the arrowhead pattern, the zeros inside the stored blocks included. The pattern is known from the shape, so the position of every entry is computed, never looked up: Csr and Bsr need no index array at run time. ArrowheadStorageMap computes the positions, and writes the canonical index arrays of Csr and Bsr, to build or check a matrix in these formats. Each storage reads by rows under the row-major layout and by columns under the column-major one.

Enumerator
Full 

the full n x n matrix, zeros included: (r, c) at r * n + c, or c * n + r

Packed 

Abb, the couplings A_bk, then the A_kb, then the D_k, each by rows or by columns.

Csr 

compressed sparse rows, border rows first; compressed sparse columns under the column-major layout

Bsr 

block sparse rows, square blocks of size block; block sparse columns under the column-major layout; needs a border multiple of the block (and a coupling_row multiple of it under the diagonal coupling)

Function Documentation

◆ arrowhead_block_config()

template<typename T >
TiledLUppConfig< T > tdls::detail::arrowhead_block_config ( const ArrowheadLUppConfig< T > & config)
nodiscardconstexprnoexcept

TiledLUpp configuration of the diagonal blocks of an ArrowheadLUpp solver.

Template Parameters
Tscalar type
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
Returns
the block tile size, the two block thresholds, the layout and the unroll policy of config, the other knobs at their default

◆ arrowhead_border_config()

template<typename T >
TiledLUppConfig< T > tdls::detail::arrowhead_border_config ( const ArrowheadLUppConfig< T > & config)
nodiscardconstexprnoexcept

TiledLUpp configuration of the border system of an ArrowheadLUpp solver, a local row-major array whatever the layout.

Template Parameters
Tscalar type
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
Returns
the border tile size and the unroll policy of config, the other knobs at their default

◆ arrowhead_physical_block_config()

template<typename T >
TiledLUppConfig< T > tdls::detail::arrowhead_physical_block_config ( const ArrowheadLUppConfig< T > & config)
nodiscardconstexprnoexcept

TiledLUpp configuration of the diagonal blocks eliminated in registers: that of arrowhead_block_config with physical row interchanges (the whole block one tile, every index known at compile time).

Template Parameters
Tscalar type
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
Returns
arrowhead_block_config(config), its rows interchanged physically

◆ arrowhead_register_blocks()

template<typename T >
TDLS_HOST_DEVICE constexpr bool tdls::detail::arrowhead_register_blocks ( const ArrowheadLUppConfig< T > & config,
const int S )
nodiscardconstexprnoexcept

Whether the diagonal blocks of S unknowns are eliminated in registers (ArrowheadLUppConfig::block_row_interchange, Auto resolved).

Template Parameters
Tscalar type
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
[in]Sunknowns of a block
Returns
true for the physical row interchanges

◆ arrowhead_register_blocks_here()

template<typename T >
TDLS_HOST_DEVICE constexpr bool tdls::detail::arrowhead_register_blocks_here ( const RowInterchange interchange,
const int S )
nodiscardconstexprnoexcept

Whether the diagonal blocks of S unknowns are eliminated in registers, decided at run time on the side of the code (detail::physical_rows_here): the choice of the runtime solver.

The runtime helpers take the fields of the configuration by value: a configuration given as a template argument and bound to a reference at run time needs the storage of the template parameter object on the device, which nvc++ does not emit (the image is then rejected when loaded).

Template Parameters
Tscalar type
Parameters
[in]interchangeArrowheadLUppConfig::block_row_interchange
[in]Sunknowns of a block
Returns
true for the physical row interchanges

◆ arrowhead_resolved_config()

template<typename T , bool gpu>
ArrowheadLUppConfig< T > tdls::detail::arrowhead_resolved_config ( ArrowheadLUppConfig< T > config,
const int S )
nodiscardconstexprnoexcept

The configuration with the choices of the given hardware made explicit: block_row_interchange Physical or Logical, rhs_pass_width non-negative (the delegation of the side dispatch of nvc++).

Template Parameters
Tscalar type
gputhe hardware: GPU (true) or CPU (false)
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
[in]Sunknowns of a block
Returns
the configuration, Auto and -1 resolved

◆ arrowhead_rhs_pass_width()

template<typename T >
TDLS_HOST_DEVICE constexpr int tdls::detail::arrowhead_rhs_pass_width ( const ArrowheadLUppConfig< T > & config,
const bool reg )
nodiscardconstexprnoexcept

The width of the passes over [A_kb | y_k] (ArrowheadLUppConfig::rhs_pass_width), -1 resolved: 2 on GPU with the blocks in registers, whatever the layout, 0 (one pass) otherwise.

Template Parameters
Tscalar type
Parameters
[in]configconfiguration of the ArrowheadLUpp solver
[in]regwhether the blocks are eliminated in registers
Returns
the width, 0 for one pass

◆ arrowhead_rhs_pass_width_here()

TDLS_HOST_DEVICE constexpr int tdls::detail::arrowhead_rhs_pass_width_here ( const int width,
const bool reg )
nodiscardconstexprnoexcept

arrowhead_rhs_pass_width decided at run time on the side of the code, as arrowhead_register_blocks_here.

Parameters
[in]widthArrowheadLUppConfig::rhs_pass_width
[in]regwhether the blocks are eliminated in registers
Returns
the width, 0 for one pass