jaxmg.qr¤
qr computes the reduced QR decomposition of a tall or square matrix \(A\):
where an \(M\times N\) input with \(M\geq N\) produces an \(M\times N\) matrix \(Q\) and an \(N\times N\) upper-triangular matrix \(R\).
Use qr for a direct decomposition. Use qr_shardmap_ctx when the
decomposition is part of a larger caller-owned jax.jit. cuSOLVERMp overwrites
the input matrix with \(Q\), so the context interface returns \(Q\) directly as the
donated input alias.
jaxmg.qr(a, T_A, mesh=None, matrix_specs=None, *, in_specs=None, return_status=False, pad=True, donate=True)
¤
Compute a distributed reduced QR decomposition with cuSOLVERMp.
For a tall or square m x n matrix with m >= n, returns an m x n
matrix Q with orthonormal columns and an n x n upper-triangular
matrix R such that A = Q @ R.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
A rank-2 real or complex tall or square matrix sharded over a one- or two-axis device mesh. |
required |
T_A
|
int
|
Square cuSOLVERMp tile width. |
required |
mesh
|
Mesh or AbstractMesh
|
JAX mesh used by
|
None
|
matrix_specs
|
PartitionSpec or tuple / list[PartitionSpec]
|
Rank-2 matrix sharding. If omitted, read from the sharding of
|
None
|
in_specs
|
P | Tuple[P] | List[P] | None
|
Backwards-compatible alias for |
None
|
return_status
|
bool
|
If True, return the native per-rank
diagnostic status vector after |
False
|
pad
|
bool
|
If True (default), add tile-aligned local capacity
where required. If False, all participating local matrix shapes
must already be divisible by |
True
|
donate
|
bool
|
If True (default), the input may be donated
and overwritten by |
True
|
Returns:
| Type | Description |
|---|---|
Array
|
|
...
|
|
tuple[Array, ...]
|
sharding when |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the input dtype or sharding specification is unsupported. |
ValueError
|
If the matrix is wide or its shape, tile size, process grid, or output layout is incompatible with cuSOLVERMp. |
Notes
- If the native solver fails,
QandRare filled with NaN and the status is non-zero.
jaxmg.qr_shardmap_ctx(a, T_A, mesh=None, matrix_specs=None, *, in_specs=None, pad=True)
¤
Compute reduced QR inside a caller-owned jax.jit.
This interface performs the same validation, redistribution, and native
computation as :func:jaxmg.qr, but leaves the outer compilation and
donation boundary to the caller. The native Q output aliases the input
work buffer before any final restoration of replicated sharding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
A rank-2 real or complex tall or square matrix sharded over a one- or two-axis device mesh. |
required |
T_A
|
int
|
Square cuSOLVERMp tile width. |
required |
mesh
|
Mesh or AbstractMesh
|
JAX mesh used by
|
None
|
matrix_specs
|
PartitionSpec or tuple / list[PartitionSpec]
|
Rank-2 matrix sharding. If omitted, read from the sharding of
|
None
|
in_specs
|
P | Tuple[P] | List[P] | None
|
Backwards-compatible alias for |
None
|
pad
|
bool
|
If True (default), add tile-aligned local capacity
where required. If False, all participating local matrix shapes
must already be divisible by |
True
|
Returns:
| Type | Description |
|---|---|
Array
|
|
Array
|
enclosing compiled function can propagate native diagnostics. |
Array
|
and |
tuple[Array, Array, Array]
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If the input dtype or sharding specification is unsupported. |
ValueError
|
If the matrix is wide or its shape, tile size, process grid, or output layout is incompatible with cuSOLVERMp. |
Notes
- If the native solver fails,
QandRare filled with NaN and the status is non-zero.