warp.tile_lower_solve#
- warp.tile_lower_solve( ) Tile[Float, tuple[int, ...]]#
Solve
L z = yfor a lower-triangularLand returnzin a new tile.Only the lower triangle of
L, including its diagonal, is read; the strictly upper triangle is ignored.Lmust be non-singular with nonzero diagonal entries.This is a cooperative operation, so every thread in the block must call it.
The right-hand side may be a 1D tile with
shape=(M,)or a 2D tile withshape=(M, NRHS), which solves for allNRHScolumns at once.Landymust have the same dtype, eitherfloat32orfloat64.On CUDA devices, Warp uses cuSolverDx when it is built with libmathdx and
warp.config.enable_mathdx_solver(or theenable_mathdx_solvermodule option) isTrue. Otherwise, and on the CPU, it uses a cooperative fallback implementation, which is slower than cuSolverDx on CUDA devices.Backward propagation computes gradients with respect to
yand the lower-triangular parameterization ofL; the strictly upper triangle ofLreceives zero gradient.- Parameters:
L – A square, non-singular, lower-triangular tile with
shape=(M, M).y – The right-hand side, a tile with
shape=(M,)orshape=(M, NRHS).
- Returns:
A new tile in shared memory with the same shape and dtype as
y, holding the solutionzofL z = y.
Example
@wp.kernel def forward_substitution(ell: wp.array2d[float], y: wp.array[float], z: wp.array[float]): l_tile = wp.tile_load(ell, shape=(3, 3)) y_tile = wp.tile_load(y, shape=3) wp.tile_store(z, wp.tile_lower_solve(l_tile, y_tile)) ell = wp.array(np.array([[2.0, 0.0, 0.0], [1.0, 3.0, 0.0], [4.0, 5.0, 6.0]], dtype=np.float32)) y = wp.array(np.array([2.0, 7.0, 32.0], dtype=np.float32)) z = wp.zeros(3, dtype=float) # one full warp cooperates on the triangular solve wp.launch_tiled(forward_substitution, dim=1, inputs=[ell, y], outputs=[z], block_dim=32) print(z.numpy())
[1. 2. 3.]