kicad2ems.mom25d.gpu_ldl¶
mom25d.gpu_ldl - the complex-symmetric LDL^T factor without pivoting on a
Vulkan GPU (gpu_vk.VulkanBackend's device and plumbing): half an LU's work and
memory. The matrix is half.Half's layout (the lower half by block columns of
NB), on the device as on the host: block column J at its own address, its
rows from J NB, column major.
Per block column k (MAGMA's hybrid scheme, without pivoting the CPU takes the
diagonal block alone):
the CPU factors the w x w diagonal block A11 = L11 D1 L11^T (half.ldl_small,
in double), and inverts L11;
the GPU forms W = A21 L11^-T (a GEMM with that inverse), L21 = W D1^-1 (in
A21's place) and the trailing update of every later block column's rows
from its own start, A22 -= W L21^T (syrk_half: the lower half alone).
With look-ahead: the GPU updates the next block column first and sends its
diagonal block to the CPU, which factors it while the GPU runs the rest of the
update. The solves run on the GPU: L y = b by blocks (each block's L11^-1, then
the rows below), y / D, L^T x = y.
F = factor(be, H) # H: half.Half (complex64, equilibrated)
X = solve(be, F, R)
H = download(be, F) # the factor on the host (half.ldl_solve's)
- class kicad2ems.mom25d.gpu_ldl.HalfDev(be, n, nb, itemsize=8)[source]¶
A half.Half's layout on the device (complex64, or 16-byte numbers): the block columns in buffers of at most MAX_BUFFER bytes, none split between two; addr[J] each block column's device address.
- class kicad2ems.mom25d.gpu_ldl.LDLFactor(dev, tinv, dinv, n)[source]¶
A GPU LDL^T factor (factor's): the block columns, each diagonal block's L11^-1 (for the solves), D^-1; the device memory it holds.
- kicad2ems.mom25d.gpu_ldl.download(be, F)[source]¶
The factor on the host: a half.Half (complex64) for half.ldl_solve.
- kicad2ems.mom25d.gpu_ldl.factor(be, H, dsc=None)[source]¶
The LDL^T factor of the host half.Half H (complex64, equilibrated; or complex128 with dsc: upload_c64's, converted on the way) on be's GPU: LDLFactor. Raises ZeroDivisionError / FloatingPointError where a diagonal block has no factor without pivoting (the caller's LU then).
- kicad2ems.mom25d.gpu_ldl.kernels(be)[source]¶
The LDL^T kernels of backend be, compiled once (be.k; the solves' again for FEW right-hand sides, be.k[name + '_few']).
- kicad2ems.mom25d.gpu_ldl.solve(be, F, R)[source]¶
Z^-1 R (R: host, N x k or N) with F's factor on the GPU, SOLVE_RHS columns at a time: L y = R, y / D, L^T x = y; complex128 out.
- kicad2ems.mom25d.gpu_ldl.upload(be, H, chunk=268435456)[source]¶
H (a host half.Half, complex64, or complex128: the double Z's) onto the device: HalfDev. Its flat array in pieces of 256 MB through two mapped host buffers, each buffer's block columns contiguous on both sides.
- kicad2ems.mom25d.gpu_ldl.upload_c64(be, H, dsc, chunk=268435456)[source]¶
H (a host half.Half, complex128: the double Z's) onto the device as the LDL^T's complex64 half equilibrated by dsc (the core's half_c64), a range of rows at a time converted straight into the two mapped staging buffers: no complex64 half on the host (4 N^2 bytes: a LimeRFE piece of 33k unknowns had peaked at 15.5 GB with it, its double half 8.7).