Skip to content

Commit 5a63c6f

Browse files
authored
[Docs] batched Serial/Team/TeamVector trsm (#2900)
* fix: trsv docs Signed-off-by: yasahi-hpc <[email protected]> * Add trsm documentation Signed-off-by: yasahi-hpc <[email protected]> --------- Signed-off-by: yasahi-hpc <[email protected]>
1 parent 338a93c commit 5a63c6f

File tree

3 files changed

+99
-5
lines changed

3 files changed

+99
-5
lines changed

docs/source/API/batched/dense-index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ API: Batched Dense (DLA)
2222
dense/batched_laswp
2323
dense/batched_apply_householder
2424
dense/batched_householder
25+
dense/batched_trsm
2526

2627
Our implementation of batched dense linear algebra (DLA) allows user to compose various batched DLA operations.
2728
For example, consider a case where small element matrices are created via `gemm` and those matrices are triangular solved by `lu` and `trsv`.
@@ -283,9 +284,9 @@ BLAS 3
283284
- `TeamTrmm`
284285
- `TeamVectorTrmm`
285286
* - TRSM
286-
- `SerialTrsm`
287-
- `TeamTrsm`
288-
- `TeamVectorTrsm`
287+
- :doc:`SerialTrsm <dense/batched_trsm>`
288+
- :doc:`TeamTrsm <dense/batched_trsm>`
289+
- :doc:`TeamVectorTrsm <dense/batched_trsm>`
289290

290291
LAPACK support
291292
==============
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
KokkosBatched::Trsm
2+
###################
3+
4+
Defined in header: :code:`KokkosBatched_Trsm_Decl.hpp`
5+
6+
.. code:: c++
7+
8+
template <typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, typename ArgAlgo>
9+
struct SerialTrsm {
10+
template <typename ScalarType, typename AViewType, typename BViewType>
11+
KOKKOS_INLINE_FUNCTION static int invoke(const ScalarType alpha, const AViewType &A, const BViewType &B);
12+
};
13+
14+
template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag,
15+
typename ArgAlgo>
16+
struct TeamTrsm {
17+
template <typename ScalarType, typename AViewType, typename BViewType>
18+
KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
19+
const BViewType &B);
20+
};
21+
22+
template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag,
23+
typename ArgAlgo>
24+
struct TeamVectorTrsm {
25+
template <typename ScalarType, typename AViewType, typename BViewType>
26+
KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
27+
const BViewType &B);
28+
};
29+
30+
31+
Solves a system of the linear equations :math:`op(A) \cdot X = \alpha B` or :math:`X \cdot op(A) = \alpha B` where :math:`\alpha` is a scalar, :math:`X` and :math:`B` are m-by-n matrices, :math:`A` is a unit or non-unit, upper or lower triangular matrix and
32+
:math:`op(A)` is one of :math:`A`, :math:`A^T`, or :math:`A^H`. The matrix :math:`X` is overwritten on :math:`B`.
33+
34+
1. For a real matrix :math:`A`, :math:`op(A)` is one of :math:`A` or :math:`A^T`.
35+
This operation is equivalent to the BLAS routine ``STRSM`` or ``DTRSM`` for single or double precision.
36+
37+
2. For a complex matrix :math:`A`, :math:`op(A)` is one of :math:`A`, :math:`A^T`, or :math:`A^H`
38+
This operation is equivalent to the BLAS routine ``CTRSM`` or ``ZTRSM`` for single or double precision.
39+
40+
Parameters
41+
==========
42+
43+
:member: Kokkos team member handle (only for ``TeamTrsm`` and ``TeamVectorTrsm``).
44+
:alpha: Scalar multiplier for :math:`B`.
45+
:A: Input view containing the upper or lower triangular matrix.
46+
:B: Input/output view containing the right-hand side on input and the solution on output.
47+
48+
Type Requirements
49+
-----------------
50+
51+
- ``MemberType`` must be a Kokkos team member handle (only for ``TeamTrsm`` and ``TeamVectorTrsm``).
52+
53+
- ``ArgSide`` must be one of the following:
54+
- ``KokkosBatched::Side::Left`` to solve a system :math:`op(A) \cdot X = \alpha B`
55+
- ``KokkosBatched::Side::Right`` to solve a system :math:`X \cdot op(A) = \alpha B`
56+
57+
- ``ArgUplo`` must be one of the following:
58+
- ``KokkosBatched::Uplo::Upper`` for upper triangular solve
59+
- ``KokkosBatched::Uplo::Lower`` for lower triangular solve
60+
61+
- ``ArgTrans`` must be one of the following:
62+
- ``KokkosBatched::Trans::NoTranspose`` for :math:`op(A) = A`
63+
- ``KokkosBatched::Trans::Transpose`` for :math:`op(A) = A^T`
64+
- ``KokkosBatched::Trans::ConjTranspose`` for :math:`op(A) = A^H`
65+
66+
- ``ArgDiag`` must be one of the following:
67+
- ``KokkosBatched::Diag::Unit`` for the unit triangular matrix :math:`A`
68+
- ``KokkosBatched::Diag::NonUnit`` for the non-unit triangular matrix :math:`A`
69+
70+
- ``ArgAlgo`` must be one of the following:
71+
- ``KokkosBatched::Algo::trsm::Blocked`` for the blocked algorithm
72+
- ``KokkosBatched::Algo::trsm::Unblocked`` for the unblocked algorithm
73+
74+
- ``ScalarType`` must be a built-in arithmetic type like ``float``, ``double``, ``Kokkos::complex<float>``, or ``Kokkos::complex<double>``.
75+
- ``AViewType`` must be a Kokkos `View <https://kokkos.org/kokkos-core-wiki/API/core/view/view.html>`_ of rank 2 containing the band matrix A
76+
- ``BViewType`` must be a Kokkos `View <https://kokkos.org/kokkos-core-wiki/API/core/view/view.html>`_ of rank 2 containing the right-hand side that satisfies
77+
- ``std::is_same_v<typename BViewType::value_type, typename BViewType::non_const_value_type> == true``
78+
79+
.. note::
80+
81+
Some combinations of template parameters may not be supported yet.
82+
83+
Example
84+
=======
85+
86+
.. literalinclude:: ../../../../../example/batched_solve/serial_trsm.cpp
87+
:language: c++
88+
89+
output:
90+
91+
.. code::
92+
93+
trsm works correctly!

docs/source/API/batched/dense/batched_trsv.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Type Requirements
6666
- ``KokkosBatched::Diag::NonUnit`` for the non-unit triangular matrix :math:`A`
6767

6868
- ``ArgAlgo`` must be one of the following:
69-
- ``KokkosBatched::Algo::tbsv::Blocked`` for the blocked algorithm
70-
- ``KokkosBatched::Algo::tbsv::Unblocked`` for the unblocked algorithm
69+
- ``KokkosBatched::Algo::trsv::Blocked`` for the blocked algorithm
70+
- ``KokkosBatched::Algo::trsv::Unblocked`` for the unblocked algorithm
7171

7272
- ``ScalarType`` must be a built-in arithmetic type like ``float``, ``double``, ``Kokkos::complex<float>``, or ``Kokkos::complex<double>``.
7373
- ``AViewType`` must be a Kokkos `View <https://kokkos.org/kokkos-core-wiki/API/core/view/view.html>`_ of rank 2 containing the band matrix A

0 commit comments

Comments
 (0)