MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::interface::detail Namespace Reference

Classes

struct  cholmod_common_deleter
 Calls cholmod_finish, which frees the common's workspace, then the struct. More...
class  nested_blas_cap
 Before a vendor call: inside an MTL5 region, the vendor runs on this thread only; outside one, nothing happens beyond a thread-local read. More...
class  nested_suitesparse_cap
 The same for a CHOLMOD/SPQR call: caps CHOLMOD's own OpenMP team through cholmod_common::nthreads_max, SPQR's TBB team (in SPQR builds with TBB) through SPQR_nthreads, and the BLAS they call, inside a region. More...

Typedefs

using cholmod_workspace = std::unique_ptr<cholmod_common, cholmod_common_deleter>
 A heap cholmod_common that moves as a pointer and is finished exactly once.

Functions

cholmod_workspace make_cholmod_workspace ()
 A started workspace.
template<typename Common = cholmod_common>
cholmod_workspace make_solve_workspace (const Common &settings)
 A fresh workspace for one solve, so that concurrent solves on one const solver share no mutable state (#839).
template<typename Saved = void, typename M, typename Factor, typename Reject, typename HostFactor>
int factor_or_fall_back (M &A, Factor &&factor, Reject &&rejects, HostFactor &&host_factor)
 factor(src, diag, status) runs the device factorization of A (from src, a device copy of A, or of A in place: A equals src when it starts), writes the factor's n diagonal entries to diag and the library's status to status (0 on success).
template<typename Kernel>
consteval int interleave_kernel_index ()
std::atomic< std::size_t > & forced_interleave_rows () noexcept
const interleave_choice & runtime_interleave_choice () noexcept

Typedef Documentation

◆ cholmod_workspace

using mtl::interface::detail::cholmod_workspace = std::unique_ptr<cholmod_common, cholmod_common_deleter>

A heap cholmod_common that moves as a pointer and is finished exactly once.

Copying the struct itself would leave two owners of its buffers, and both would free them (#774, #839).

Function Documentation

◆ factor_or_fall_back()

template<typename Saved = void, typename M, typename Factor, typename Reject, typename HostFactor>
int mtl::interface::detail::factor_or_fall_back ( M & A,
Factor && factor,
Reject && rejects,
HostFactor && host_factor )

factor(src, diag, status) runs the device factorization of A (from src, a device copy of A, or of A in place: A equals src when it starts), writes the factor's n diagonal entries to diag and the library's status to status (0 on success).

When status is nonzero, or rejects(d) holds for a diagonal entry d, host_factor(H) factors a host copy of src, which is written back to A, and its code is returned; otherwise 0.

src is of type Saved, by default A's own type; a backend whose A may be borrowed from a space that does not allocate names an owning type of the same layout.

◆ forced_interleave_rows()

std::atomic< std::size_t > & mtl::interface::detail::forced_interleave_rows ( )
inlinenoexcept

◆ interleave_kernel_index()

template<typename Kernel>
int mtl::interface::detail::interleave_kernel_index ( )
consteval

◆ make_cholmod_workspace()

cholmod_workspace mtl::interface::detail::make_cholmod_workspace ( )
inline

A started workspace.

Throws std::runtime_error if cholmod_start fails, in which case nothing is left to finish.

◆ make_solve_workspace()

template<typename Common = cholmod_common>
cholmod_workspace mtl::interface::detail::make_solve_workspace ( const Common & settings)

A fresh workspace for one solve, so that concurrent solves on one const solver share no mutable state (#839).

The objects the solve reads – the factor or the sparse matrix – were allocated with the solver's own workspace; CHOLMOD allocates through SuiteSparse's global allocator, so another workspace may read them, and only the dense vectors the solve allocates are counted against (and freed with) this one. The error reporting and thread settings are carried over from the solver's. A template only so the member checks stay soft across CHOLMOD versions, as in nested_suitesparse_cap.

◆ runtime_interleave_choice()

const interleave_choice & mtl::interface::detail::runtime_interleave_choice ( )
inlinenoexcept