|
TDLS 0.4.0
Tiny Device-callable Linear Solvers
|
Runtime-size variant of the CooperativeLUpp solver. More...
#include <type_traits>#include <tdls/core/group.hpp>#include <tdls/core/macros.hpp>#include <tdls/core/math.hpp>#include <tdls/core/target.hpp>#include <tdls/solvers/cooperative_lupp/config.hpp>Go to the source code of this file.
Classes | |
| struct | tdls::CooperativeLUppSolverDynamic< T, Config > |
| Runtime-size dense LU factorization with partial pivoting shared by a group of threads, solving one n x n system per group. More... | |
Macros | |
| #define | TDLS_COOP_LUPP_DYN_A(r, c) |
| Strided element (r, c) of S, the stored matrix read column-major (A under the column-major layout, A^T under the row-major one): consecutive threads hold consecutive rows of S, thus consecutive addresses. | |
| #define | TDLS_COOP_LUPP_DYN_PIV(r) |
| Strided pivot entry of row r. | |
| #define | TDLS_COOP_LUPP_DYN_B(r) |
| Strided entry r of the right-hand side. | |
| #define | TDLS_COOP_LUPP_DYN_X(r) |
| Strided entry r of the solution. | |
| #define | TDLS_COOP_LUPP_DYN_Y(r) |
| Strided entry r of the right-hand side solved in place. | |
Runtime-size variant of the CooperativeLUpp solver.
Same algorithm as CooperativeLUppSolverStatic (solver_static.hpp): the LU with partial pivoting of MAGMA's register-blocked small-system kernel applied to S, the stored matrix read column-major (A under the column-major layout, A^T under the row-major one), the solve S x = b or S^T x = b, logical or physical row interchanges, the rows of S shared by a group of threads, a workspace and a deduced or caller-provided barrier, the pivot entries as pivot output and the pivots on the factored diagonal. The difference is that the system dimension n is a runtime function parameter instead of a template parameter. Only the number of rows per thread (Config.rows_per_thread) stays compile-time: it sizes the pivot entries and the right-hand-side entries kept by each thread, while the number of threads, threads_per_system(n), and every loop bound are runtime values.
Deliberate differences with the compile-time solver:
For equal shapes (n = N, same configuration), results are bitwise identical to the compile-time solver: factored rows, pivot entries and solution. The arithmetic sequence is the same, only the storage of the rows 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. Build with -ffp-contract=off (–fmad=false for nvcc) to compare them bit for bit.
The compile-time solver is the performance path; this variant is the flexibility path (dimensions unknown at compile time, fast builds).
The calling convention, the factored format and the pivot convention are those of the compile-time solver, described in solver_static.hpp. So are the guarantees of the group: a fixed sequence of barriers, no data race, inputs read by their owners on entry, results visible to the whole group on return. One exception: under the row-major layout and physical row interchanges, the substitutions read the factored matrix of the other threads before any barrier, so it must be visible to the group before the call, as it is after factorize. The workspace holds workspace_size(n) elements, laid out as there with n for N, without the restrict qualifier, for the reason given there. The matrix layout follows Config.layout, row-major by default, and selects the solve at compile time, as there.
Preconditions: n >= 1 and 0 <= tx < threads_per_system(n). The flat element index (for the matrix, n*n) must stay below 2^31; element offsets, index times stride, are computed in 64-bit arithmetic.
| #define TDLS_COOP_LUPP_DYN_A | ( | r, | |
| c ) |
Strided element (r, c) of S, the stored matrix read column-major (A under the column-major layout, A^T under the row-major one): consecutive threads hold consecutive rows of S, thus consecutive addresses.
| #define TDLS_COOP_LUPP_DYN_B | ( | r | ) |
Strided entry r of the right-hand side.
| #define TDLS_COOP_LUPP_DYN_PIV | ( | r | ) |
Strided pivot entry of row r.
| #define TDLS_COOP_LUPP_DYN_X | ( | r | ) |
Strided entry r of the solution.
| #define TDLS_COOP_LUPP_DYN_Y | ( | r | ) |
Strided entry r of the right-hand side solved in place.