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
float
double
std::complex<float>
std::complex<double>
trsm_batch (Buffer Version)#
Description
The buffer version of trsm_batch supports only the strided API.
The 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 == onemkl::side::left) then
compute X such that op(A) * X = alpha * B
else
compute X such that X * op(A) = alpha * B
end if
B := X
end for
where:
op(A) is one of op(A) = A, or op(A) = AT,
or op(A) = AH,
alpha is a scalar,
A is a triangular matrix,
B and X are m x n general matrices,
A is either m x m or n x n,depending on whether
it multiplies X on the left or right. On return, the matrix B
is overwritten by the solution matrix X.
The a and b buffers contain all the input matrices. The stride
between matrices is given by the stride parameter. The total number
of matrices in a and b buffers are given by the batch_size parameter.
Strided API
Syntax
namespace oneapi::mkl::blas::column_major {
void trsm_batch(sycl::queue &queue,
onemkl::side left_right,
onemkl::uplo upper_lower,
onemkl::transpose trans,
onemkl::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)
}
namespace oneapi::mkl::blas::row_major {
void trsm_batch(sycl::queue &queue,
onemkl::side left_right,
onemkl::uplo upper_lower,
onemkl::transpose trans,
onemkl::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)
}
Input Parameters
- queue
The queue where the routine should be executed.
- left_right
Specifies whether the matrices
AmultiplyXon the left (side::left) or on the right (side::right). See oneMKL Defined Datatypes for more details.- upper_lower
Specifies whether the matrices
Aare upper or lower triangular. See oneMKL Defined Datatypes for more details.- trans
Specifies op(
A), the transposition operation applied to the matricesA. See oneMKL Defined Datatypes for more details.- unit_diag
Specifies whether the matrices
Aare assumed to be unit triangular (all diagonal elements are 1). See oneMKL Defined Datatypes for more details.- m
Number of rows of the
Bmatrices. Must be at least zero.- n
Number of columns of the
Bmatrices. Must be at least zero.- alpha
Scaling factor for the solutions.
- a
Buffer holding the input matrices
Awith sizestridea*batch_size.- lda
Leading dimension of the matrices
A. Must be at leastmifleft_right=side::left, and at leastnifleft_right=side::right. Must be positive.- stridea
Stride between different
Amatrices.- b
Buffer holding the input matrices
Bwith sizestrideb*batch_size.- ldb
Leading dimension of the matrices
B. It must be positive and at leastmif column major layout is used to store matrices or at leastnif row major layout is used to store matrices.- strideb
Stride between different
Bmatrices.- batch_size
Specifies the number of triangular linear systems to solve.
Output Parameters
- b
Output buffer, overwritten by
batch_sizesolution matricesX.
Notes
If alpha = 0, matrix B is set to zero and the matrices A
and B do not need to be initialized before calling trsm_batch.
Description
The USM version of trsm_batch supports the group API and strided API.
The 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 == onemkl::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
The 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 == onemkl::side::left) then
compute X such that op(A) * X = alpha * B
else
compute X such that X * op(A) = alpha * B
end if
B := X
end for
where:
op(A) is one of op(A) = A, or op(A) = AT,
or op(A) = AH,
alpha is a scalar,
A is a triangular matrix,
B and X are m x n general matrices,
A is either m x m or n x n,depending on whether
it multiplies X on the left or right. On return, the matrix B
is overwritten by the 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:
For strided API, a and b arrays contain all the input matrices. The total number of matrices
in a and b are given by the batch_size parameter.
Group API
Syntax
namespace oneapi::mkl::blas::column_major {
sycl::event trsm_batch(sycl::queue &queue,
onemkl::side *left_right,
onemkl::uplo *upper_lower,
onemkl::transpose *trans,
onemkl::diag *unit_diag,
std::int64_t *m,
std::int64_t *n,
T *alpha,
const T **a,
std::int64_t *lda,
T **b,
std::int64_t *ldb,
std::int64_t group_count,
std::int64_t *group_size,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event trsm_batch(sycl::queue &queue,
onemkl::side *left_right,
onemkl::uplo *upper_lower,
onemkl::transpose *trans,
onemkl::diag *unit_diag,
std::int64_t *m,
std::int64_t *n,
T *alpha,
const T **a,
std::int64_t *lda,
T **b,
std::int64_t *ldb,
std::int64_t group_count,
std::int64_t *group_size,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters
- queue
The queue where the routine should be executed.
- left_right
Array of
group_countonemkl::sidevalues.left_right[i]specifies whetherAmultipliesXon the left (side::left) or on the right (side::right) for everytrsmoperation in groupi. See oneMKL Defined Datatypes for more details.- upper_lower
Array of
group_countonemkl::uplovalues.upper_lower[i]specifies whetherAis upper or lower triangular for every matrix in groupi. See oneMKL Defined Datatypes for more details.- trans
Array of
group_countonemkl::transposevalues.trans[i]specifies the form of op(A) used for everytrsmoperation in groupi. See oneMKL Defined Datatypes for more details.- unit_diag
Array of
group_countonemkl::diagvalues.unit_diag[i]specifies whetherAis assumed to be unit triangular (all diagonal elements are 1) for every matrix in groupi. See oneMKL Defined Datatypes for more details.- m
Array of
group_countintegers.m[i]specifies the number of rows ofBfor every matrix in groupi. All entries must be at least zero.- n
Array of
group_countintegers.n[i]specifies the number of columns ofBfor every matrix in groupi. All entries must be at least zero.- alpha
Array of
group_countscalar elements.alpha[i]specifies the scaling factor in groupi.- a
Array of pointers to input matrices
Awith sizetotal_batch_count. See Matrix Storage for more details.- lda
Array of
group_countintegers.lda[i]specifies the leading dimension ofAfor every matrix in groupi. All entries must be at leastmifleft_rightisside::left, and at leastnifleft_rightisside::right. All entries must be positive.- b
Array of pointers to input matrices
Bwith sizetotal_batch_count. See Matrix Storage for more details.- ldb
Array of
group_countintegers.ldb[i]specifies the leading dimension ofBfor every matrix in groupi. All entries must be positive and at leastmand positive if column major layout is used to store matrices or at leastnif row major layout is used to store matrices.- group_count
Specifies the number of groups. Must be at least 0.
- group_size
Array of
group_countintegers.group_size[i]specifies the number oftrsmoperations in groupi. All entries must be at least 0.- dependencies
List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
Output Parameters
- b
Output buffer, overwritten by the
total_batch_countsolution matricesX.
Notes
If alpha = 0, matrix B is set to zero and the matrices 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
Syntax
namespace oneapi::mkl::blas::column_major {
sycl::event trsm_batch(sycl::queue &queue,
onemkl::side left_right,
onemkl::uplo upper_lower,
onemkl::transpose trans,
onemkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
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,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event trsm_batch(sycl::queue &queue,
onemkl::side left_right,
onemkl::uplo upper_lower,
onemkl::transpose trans,
onemkl::diag unit_diag,
std::int64_t m,
std::int64_t n,
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,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters
- queue
The queue where the routine should be executed.
- left_right
Specifies whether the matrices
AmultiplyXon the left (side::left) or on the right (side::right). See oneMKL Defined Datatypes for more details.- upper_lower
Specifies whether the matrices
Aare upper or lower triangular. See oneMKL Defined Datatypes for more details.- trans
Specifies op(
A), the transposition operation applied to the matricesA. See oneMKL Defined Datatypes for more details.- unit_diag
Specifies whether the matrices
Aare assumed to be unit triangular (all diagonal elements are 1). See oneMKL Defined Datatypes for more details.- m
Number of rows of the
Bmatrices. Must be at least zero.- n
Number of columns of the
Bmatrices. Must be at least zero.- alpha
Scaling factor for the solutions.
- a
Pointer to input matrices
Awith sizestridea*batch_size.- lda
Leading dimension of the matrices
A. Must be at leastmifleft_right=side::left, and at leastnifleft_right=side::right. Must be positive.- stridea
Stride between different
Amatrices.- b
Pointer to input matrices
Bwith sizestrideb*batch_size.- ldb
Leading dimension of the matrices
B. It must be positive and at leastmif column major layout is used to store matrices or at leastnif row major layout is used to store matrices.- strideb
Stride between different
Bmatrices.- batch_size
Specifies the number of triangular linear systems to solve.
Output Parameters
- b
Output matrices, overwritten by
batch_sizesolution matricesX.
Notes
If alpha = 0, matrix B is set to zero and the matrices 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.
Parent topic: BLAS-like Extensions