trsm_batch#
Computes a group of trsm operations.
Description#
The trsm_batch routines are batched versions of trsm, performing multiple trsm operations in a single call. Each trsm solves an equation of the form op(A) * X = alpha * B or X * op(A) = alpha * B.
trsm_batch supports the following precisions:
T |
|---|
|
|
|
|
trsm_batch (Buffer Version)#
Buffer version of trsm_batch supports only strided API.
Strided API#
Strided API operation is defined as:
for i = 0 … batch_size – 1
A and B are matrices at offset i * stridea and i * strideb in a and b.
if (left_right == side::left) then
compute X such that op(A) * X = alpha * B
else
compute X such that X * op(A) = alpha * B
B = X
end for
where:
op(
A) is one of op(A) =A, or op(A) =AT, or op(A) =AHalphais a scalarAis eithermxmornxntriangular matrixBandXaremxngeneral matrices
On return, matrix B is overwritten by solution matrix X.
For strided API, a and b buffers contains all the input matrices. The stride between matrices is given by the stride parameters. Total number of matrices in a and b buffers is given by batch_size parameter.
Syntax#
namespace oneapi::mkl::blas::column_major {
void trsm_batch(sycl::queue &queue,
oneapi::mkl::side left_right,
oneapi::mkl::uplo upper_lower,
oneapi::mkl::transpose trans,
oneapi::mkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
T alpha,
sycl::buffer<T,1> &a,
std::int64_t lda,
std::int64_t stridea,
sycl::buffer<T,1> &b,
std::int64_t ldb,
std::int64_t strideb,
std::int64_t batch_size,
compute_mode mode = compute_mode::unset)
}
namespace oneapi::mkl::blas::row_major {
void trsm_batch(sycl::queue &queue,
oneapi::mkl::side left_right,
oneapi::mkl::uplo upper_lower,
oneapi::mkl::transpose trans,
oneapi::mkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
T alpha,
sycl::buffer<T,1> &a,
std::int64_t lda,
std::int64_t stridea,
sycl::buffer<T,1> &b,
std::int64_t ldb,
std::int64_t strideb,
std::int64_t batch_size,
compute_mode mode = compute_mode::unset)
}
Input Parameters#
- queue
The queue where the routine should be executed.
- left_right
Specifies whether matrices
Aare on the left side or right side of the multiplication. See Data Types for more details.- upper_lower
Specifies whether matrices
Aare upper or lower triangular. See Data Types for more details.- trans
Specifies op(
A), transposition operation applied to matricesA. See Data Types for more details.- unit_diag
Specifies whether matrices
Aare unit triangular or not. See Data Types for more details.- m
Number of rows of matrices
B. Must be at least zero.- n
Number of columns of matrices
B. Must be at least zero.- alpha
Scaling factor for the solution.
- a
Buffer holding input matricees
A. Size of the buffer must be at leaststridea*batch_size.- lda
Leading dimension of matrices
A. Must be at leastmifleft_right=side::leftor at leastnifleft_right=side::right. Must be positive.- stridea
Stride between two consecutive
Amatrices.- b
Buffer holding input/output matrices
B. Size of the buffer must be at leaststrideb*batch_size.- ldb
Leading dimension of matrices
B. Must be at leastmif column major layout or at leastnif row major layout is used. Must be positive.- strideb
Stride between two consecutive
Bmatrices.- batch_size
Specifies number of triangular linear systems to solve.
- mode
Optional. Compute mode settings. See Compute Modes for more details.
Output Parameters#
- b
Output buffer overwritten by
batch_sizesolution matricesX.
Note
If alpha = 0, matrices B are set to zero, and A and B do not need to be initialized before calling trsm_batch..
trsm_batch (USM Version)#
USM version of trsm_batch supports group API and strided API.
Group API#
The type Ti of integer pointers in the group API may be either std::int64_t or std::int32_t.
Group API operation is defined as:
idx = 0
for i = 0 … group_count – 1
for j = 0 … group_size – 1
A and B are matrices in a[idx] and b[idx]
if (left_right == side::left) then
compute X such that op(A) * X = alpha[i] * B
else
compute X such that X * op(A) = alpha[i] * B
end if
B = X
idx = idx + 1
end for
end for
where:
op(
A) is one of op(A) =A, or op(A) =AT, or op(A) =AHalphais a scalarAis eithermxmornxntriangular matrixBandXaremxngeneral matrices
On return, matrix B is overwritten by solution matrix X.
For group API, a and b arrays contain the pointers for all the input matrices.
The total number of matrices in a and b are given by:
Syntax#
namespace oneapi::mkl::blas::column_major {
sycl::event trsm_batch(sycl::queue &queue,
const oneapi::mkl::side *left_right,
const oneapi::mkl::uplo *upper_lower,
const oneapi::mkl::transpose *trans,
const oneapi::mkl::diag *unit_diag,
const Ti *m,
const Ti *n,
const T *alpha,
const T **a,
const Ti *lda,
T **b,
const Ti *ldb,
std::int64_t group_count,
const Ti *group_size,
compute_mode mode = compute_mode::unset,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event trsm_batch(sycl::queue &queue,
const oneapi::mkl::side *left_right,
const oneapi::mkl::uplo *upper_lower,
const oneapi::mkl::transpose *trans,
const oneapi::mkl::diag *unit_diag,
const Ti *m,
const Ti *n,
const T *alpha,
const T **a,
const Ti *lda,
T **b,
const Ti *ldb,
std::int64_t group_count,
const Ti *group_size,
compute_mode mode = compute_mode::unset,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters#
- queue
The queue where the routine should be executed.
- left_right
Array of
group_countoneapi::mkl::sidevalues.left_right[i]specifies whether matricesAare on the left side or right side of the multiplication in groupi. See Data Types for more details.- upper_lower
Array of
group_countoneapi::mkl::uplovalues.upper_lower[i]specifies whether matricesAare upper or lower triangular in groupi. See Data Types for more details.- trans
Array of
group_countoneapi::mkl::transposevalues.trans[i]specifies op(A), transposition operation applied to matricesAin each groupi. See Data Types for more details.- unit_diag
Array of
group_countoneapi::mkl::diagvalues.unit_diag[i]specifies whether matricesAare unit triangular or not. See Data Types for more details.- m
Array of
group_countintegers.m[i]specifies number of rows of matricesBin groupi. All entries must be at least zero.- n
Array of
group_countintegers.n[i]specifies number of columns of matricesBin groupi. All entries must be at least zero.- alpha
Array of
group_countscalar elements.alpha[i]specifies scaling factors for the solutions in groupi.- a
Array of
total_batch_countpointers for input matricesA. See Matrix Storage for more details.- lda
Array of
group_countintegers.lda[i]specifies leading dimension of matricesAin groupi. Must be at leastm[i]ifleft_right[i]=side::leftor at leastn[i]ifleft_right[i]=side::right. All entries must be positive.- b
Array of
total_batch_countpointers for input/output matricesB. See Matrix Storage for more details.- ldb
Array of
group_countintegers.ldb[i]specifies leading dimension of matricesBin groupi. Must be at leastm[i]if column major layout or at leastn[i]if row major layout is used. All entries must be positive.- group_count
Number of groups. Must be at least zero.
- group_size
Array of
group_countintegers.group_size[i]specifies the number oftrsmoperations in groupi. Each element ingroup_sizemust be at least zero.- mode
Optional. Compute mode settings. See Compute Modes for more details.
- dependencies
Optional. List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
modeanddependenciesmay be omitted independently; it is not necessary to specifymodein order to provide dependencies.
Output Parameters#
- b
Array of pointers to output matrices
Boverwritten bytotal_batch_countsolution matricesX.
Note
If alpha = 0, matrices B are set to zero, and A and B do not need to be initialized before calling trsm_batch..
Return Values#
Output event to wait on to ensure computation is complete.
Strided API#
Strided API operation is defined as:
for i = 0 … batch_size – 1
A and B are matrices at offset i * stridea and i * strideb in a and b.
if (left_right == side::left) then
compute X such that op(A) * X = alpha * B
else
compute X such that X * op(A) = alpha * B
B = X
end for
where:
op(
A) is one of op(A) =A, or op(A) =AT, or op(A) =AHalphais a scalarAis eithermxmornxntriangular matrixBandXaremxngeneral matrices
On return, matrix B is overwritten by solution matrix X.
For strided API, a and b arrays contain all the input matrices. The stride between matrices is given by the stride parameters. Total number of matrices in a and b arrays is given by batch_size parameter.
Syntax#
namespace oneapi::mkl::blas::column_major {
sycl::event trsm_batch(sycl::queue &queue,
oneapi::mkl::side left_right,
oneapi::mkl::uplo upper_lower,
oneapi::mkl::transpose trans,
oneapi::mkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
oneapi::mkl::value_or_pointer<T> alpha,
const T *a,
std::int64_t lda,
std::int64_t stridea,
T *b,
std::int64_t ldb,
std::int64_t strideb,
std::int64_t batch_size,
compute_mode mode = compute_mode::unset,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event trsm_batch(sycl::queue &queue,
oneapi::mkl::side left_right,
oneapi::mkl::uplo upper_lower,
oneapi::mkl::transpose trans,
oneapi::mkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
oneapi::mkl::value_or_pointer<T> alpha,
const T *a,
std::int64_t lda,
std::int64_t stridea,
T *b,
std::int64_t ldb,
std::int64_t strideb,
std::int64_t batch_size,
compute_mode mode = compute_mode::unset,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters#
- queue
The queue where the routine should be executed.
- left_right
Specifies whether matrices
Aare on the left side or right side of the multiplication. See Data Types for more details.- upper_lower
Specifies whether matrices
Aare upper or lower triangular. See Data Types for more details.- trans
Specifies op(
A), transposition operation applied to matricesA. See Data Types for more details.- unit_diag
Specifies whether matrices
Aare unit triangular or not. See Data Types for more details.- m
Number of rows of matrices
B. Must be at least zero.- n
Number of columns of matrices
B. Must be at least zero.- alpha
Scaling factor for the solution. See Scalar Arguments for more information on the
value_or_pointerdata type.- a
Pointer to input matricees
A. Size of the array must be at leaststridea*batch_size.- lda
Leading dimension of matrices
A. Must be at leastmifleft_right=side::leftor at leastnifleft_right=side::right. Must be positive.- stridea
Stride between two consecutive
Amatrices.- b
Pointer to input/output matrices
B. Size of the array must be at leaststrideb*batch_size.- ldb
Leading dimension of matrices
B. Must be at leastmif column major layout or at leastnif row major layout is used. Must be positive.- strideb
Stride between two consecutive
Bmatrices.- batch_size
Specifies number of triangular linear systems to solve.
- mode
Optional. Compute mode settings. See Compute Modes for more details.
- dependencies
Optional. List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
modeanddependenciesmay be omitted independently; it is not necessary to specifymodein order to provide dependencies.
Output Parameters#
- b
Pointer to output matrix
Boverwritten bybatch_sizesolution matricesX.
Note
If alpha = 0, matrices B are set to zero, and A and B do not need to be initialized before calling trsm_batch..
Return Values#
Output event to wait on to ensure computation is complete.