Skip to content

Commit de4d3a3

Browse files
Aaron Johnsonrscohn2
andauthored
[oneMKL] Add BLAS APIs (#383)
* [oneMKL] add BLAS APIs. * use python 3.9 instead of 3.10 to avoid sphinx internal errors Co-authored-by: Robert Cohn <[email protected]>
1 parent d9d350a commit de4d3a3

File tree

12 files changed

+2266
-41
lines changed

12 files changed

+2266
-41
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-python@v2
13+
with:
14+
python-verson: '3.9'
1315
- name: Install prerequisites
1416
run: |
1517
sudo apt-get update -qq
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
.. SPDX-FileCopyrightText: 2019-2020 Intel Corporation
2+
..
3+
.. SPDX-License-Identifier: CC-BY-4.0
4+
5+
.. _onemkl_blas_axpby:
6+
7+
axpby
8+
=====
9+
10+
Computes a vector-scalar product added to a scaled-vector.
11+
12+
.. _onemkl_blas_axpby_description:
13+
14+
.. rubric:: Description
15+
16+
The ``axpby`` routines compute two scalar-vector product and add them:
17+
18+
.. math::
19+
20+
y \leftarrow beta * y + alpha * x
21+
22+
where ``x`` and ``y`` are vectors of ``n`` elements and ``alpha`` and ``beta`` are scalars.
23+
24+
``axpby`` supports the following precisions.
25+
26+
.. list-table::
27+
:header-rows: 1
28+
29+
* - T
30+
* - ``float``
31+
* - ``double``
32+
* - ``std::complex<float>``
33+
* - ``std::complex<double>``
34+
35+
.. _onemkl_blas_axpby_buffer:
36+
37+
axpby (Buffer Version)
38+
----------------------
39+
40+
.. rubric:: Syntax
41+
42+
.. code-block:: cpp
43+
44+
namespace oneapi::mkl::blas::column_major {
45+
void axpby(sycl::queue &queue,
46+
std::int64_t n,
47+
T alpha,
48+
sycl::buffer<T,1> &x, std::int64_t incx,
49+
T beta,
50+
sycl::buffer<T,1> &y, std::int64_t incy)
51+
}
52+
.. code-block:: cpp
53+
54+
namespace oneapi::mkl::blas::row_major {
55+
void axpby(sycl::queue &queue,
56+
std::int64_t n,
57+
T alpha,
58+
sycl::buffer<T,1> &x, std::int64_t incx,
59+
T beta,
60+
sycl::buffer<T,1> &y, std::int64_t incy)
61+
}
62+
63+
.. container:: section
64+
65+
.. rubric:: Input Parameters
66+
67+
queue
68+
The queue where the routine should be executed.
69+
70+
n
71+
Number of elements in vector ``x`` and ``y``.
72+
73+
alpha
74+
Specifies the scalar ``alpha``.
75+
76+
x
77+
Buffer holding input vector ``x``. The buffer must be of size at least
78+
(1 + (``n`` – 1)*abs(``incx``)). See :ref:`matrix-storage` for
79+
more details.
80+
81+
incx
82+
Stride between two consecutive elements of the ``x`` vector.
83+
84+
beta
85+
Specifies the scalar ``beta``.
86+
87+
y
88+
Buffer holding input vector ``y``. The buffer must be of size at least
89+
(1 + (``n`` – 1)*abs(``incy``)). See :ref:`matrix-storage` for
90+
more details.
91+
92+
incy
93+
Stride between two consecutive elements of the ``y`` vector.
94+
95+
.. container:: section
96+
97+
.. rubric:: Output Parameters
98+
99+
y
100+
Buffer holding the updated vector ``y``.
101+
102+
.. container:: section
103+
104+
.. rubric:: Throws
105+
106+
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
107+
108+
:ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>`
109+
110+
:ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>`
111+
112+
:ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>`
113+
114+
:ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>`
115+
116+
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
117+
118+
.. _onemkl_blas_axpby_usm:
119+
120+
axpby (USM Version)
121+
-------------------
122+
123+
.. rubric:: Syntax
124+
125+
.. code-block:: cpp
126+
127+
namespace oneapi::mkl::blas::column_major {
128+
sycl::event axpby(sycl::queue &queue,
129+
std::int64_t n,
130+
T alpha,
131+
const T *x, std::int64_t incx,
132+
const T beta,
133+
T *y, std::int64_t incy,
134+
const std::vector<sycl::event> &dependencies = {})
135+
}
136+
.. code-block:: cpp
137+
138+
namespace oneapi::mkl::blas::row_major {
139+
sycl::event axpby(sycl::queue &queue,
140+
std::int64_t n,
141+
T alpha,
142+
const T *x, std::int64_t incx,
143+
const T beta,
144+
T *y, std::int64_t incy,
145+
const std::vector<sycl::event> &dependencies = {})
146+
}
147+
148+
.. container:: section
149+
150+
.. rubric:: Input Parameters
151+
152+
queue
153+
The queue where the routine should be executed.
154+
155+
n
156+
Number of elements in vector ``x`` and ``y``.
157+
158+
alpha
159+
Specifies the scalar alpha.
160+
161+
beta
162+
Specifies the scalar beta.
163+
164+
x
165+
Pointer to the input vector ``x``. The allocated memory must be
166+
of size at least (1 + (``n`` – 1)*abs(``incx``)). See
167+
:ref:`matrix-storage` for more details.
168+
169+
incx
170+
Stride between consecutive elements of the ``x`` vector.
171+
172+
y
173+
Pointer to the input vector ``y``. The allocated memory must be
174+
of size at least (1 + (``n`` – 1)*abs(``incy``)). See
175+
:ref:`matrix-storage` for more details.
176+
177+
incy
178+
Stride between consecutive elements of the ``y`` vector.
179+
180+
dependencies
181+
List of events to wait for before starting computation, if any.
182+
If omitted, defaults to no dependencies.
183+
184+
.. container:: section
185+
186+
.. rubric:: Output Parameters
187+
188+
y
189+
Array holding the updated vector ``y``.
190+
191+
.. container:: section
192+
193+
.. rubric:: Return Values
194+
195+
Output event to wait on to ensure computation is complete.
196+
197+
.. container:: section
198+
199+
.. rubric:: Throws
200+
201+
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
202+
203+
:ref:`oneapi::mkl::invalid_argument<onemkl_exception_invalid_argument>`
204+
205+
:ref:`oneapi::mkl::unsupported_device<onemkl_exception_unsupported_device>`
206+
207+
:ref:`oneapi::mkl::host_bad_alloc<onemkl_exception_host_bad_alloc>`
208+
209+
:ref:`oneapi::mkl::device_bad_alloc<onemkl_exception_device_bad_alloc>`
210+
211+
:ref:`oneapi::mkl::unimplemented<onemkl_exception_unimplemented>`
212+
213+
**Parent topic:** :ref:`blas-like-extensions`
214+

source/elements/oneMKL/source/domains/blas/axpy_batch.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ The total number of vectors in ``x`` and ``y`` are given by the ``batch_size`` p
244244

245245
x
246246
Array of pointers to input vectors ``X`` with size ``total_batch_count``.
247-
The size of array allocated for the ``X`` vector of the group ``i`` must be at least (1 + (``n[i]`` – 1)*abs(``incx[i]``))``.
247+
The size of array allocated for the ``X`` vector of the group ``i`` must be at least (1 + (``n[i]`` – 1)*abs(``incx[i]``)).
248248
See :ref:`matrix-storage` for more details.
249249

250250
incx
251251
Array of ``group_count`` integers. ``incx[i]`` specifies the stride of vector ``X`` in group ``i``.
252252

253253
y
254254
Array of pointers to input/output vectors ``Y`` with size ``total_batch_count``.
255-
The size of array allocated for the ``Y`` vector of the group ``i`` must be at least (1 + (``n[i]`` – 1)*abs(``incy[i]``))``.
255+
The size of array allocated for the ``Y`` vector of the group ``i`` must be at least (1 + (``n[i]`` – 1)*abs(``incy[i]``)).
256256
See :ref:`matrix-storage` for more details.
257257

258258
incy

source/elements/oneMKL/source/domains/blas/blas-like-extensions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ BLAS-like Extensions
4646
:hidden:
4747

4848
axpy_batch
49+
axpby
50+
copy_batch
51+
dgmm_batch
4952
gemm_batch
53+
gemv_batch
54+
syrk_batch
5055
trsm_batch
5156
gemmt
5257
gemm_bias

0 commit comments

Comments
 (0)