axpy_batch#
Computes a group of axpy operations.
Description
The axpy_batch routines are batched versions of axpy, performing
multiple axpy operations in a single call. Each axpy
operation adds a scalar-vector product to a vector.
axpy_batch supports the following precisions for data.
T
float
double
std::complex<float>
std::complex<double>
axpy_batch (Buffer Version)#
Description
The buffer version of axpy_batch supports only the strided API.
The strided API operation is defined as:
for i = 0 … batch_size – 1
X and Y are vectors at offset i * stridex, i * stridey in x and y
Y := alpha * X + Y
end for
where:
alpha is scalar,
X and Y are vectors.
Strided API
Syntax
namespace oneapi::mkl::blas::column_major {
void axpy_batch(sycl::queue &queue,
std::int64_t n,
T alpha,
sycl::buffer<T,
1> &x,
std::int64_t incx,
std::int64_t stridex,
sycl::buffer<T,
1> &y,
std::int64_t incy,
std::int64_t stridey,
std::int64_t batch_size)
}
namespace oneapi::mkl::blas::row_major {
void axpy_batch(sycl::queue &queue,
std::int64_t n,
T alpha,
sycl::buffer<T,
1> &x,
std::int64_t incx,
std::int64_t stridex,
sycl::buffer<T,
1> &y,
std::int64_t incy,
std::int64_t stridey,
std::int64_t batch_size)
}
Input Parameters
- queue
The queue where the routine should be executed.
- n
Number of elements in
XandY.- alpha
Specifies the scalar
alpha.- x
Buffer holding input vectors
Xwith sizestridex*batch_size.- incx
Stride of vector
X.- stridex
Stride between different
Xvectors.- y
Buffer holding input/output vectors
Ywith sizestridey*batch_size.- incy
Stride of vector
Y.- stridey
Stride between different
Yvectors.- batch_size
Specifies the number of
axpyoperations to perform.
Output Parameters
- y
Output buffer, overwritten by
batch_sizeaxpyoperations of the formalpha*X+Y.
axpy_batch (USM Version)#
Description
The USM version of axpy_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
X and Y are vectors in x[idx] and y[idx]
Y := alpha[i] * X + Y
idx := idx + 1
end for
end for
The strided API operation is defined as
for i = 0 … batch_size – 1
X and Y are vectors at offset i * stridex, i * stridey in x and y
Y := alpha * X + Y
end for
where:
alpha is scalar,
X and Y are vectors.
For group API, x and y arrays contain the pointers for all the input vectors.
The total number of vectors in x and y are given by:
For strided API, x and y arrays contain all the input vectors.
The total number of vectors in x and y are given by the batch_size parameter.
Group API
Syntax
namespace oneapi::mkl::blas::column_major {
sycl::event axpy_batch(sycl::queue &queue,
std::int64_t *n,
T *alpha,
const T **x,
std::int64_t *incx,
T **y,
std::int64_t *incy,
std::int64_t group_count,
std::int64_t *group_size,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event axpy_batch(sycl::queue &queue,
std::int64_t *n,
T *alpha,
const T **x,
std::int64_t *incx,
T **y,
std::int64_t *incy,
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.
- n
Array of
group_countintegers.n[i]specifies the number of elements in vectorsXandYfor every vector in groupi.- alpha
Array of
group_countscalar elements.alpha[i]specifies the scaling factor for vectorXin groupi.- x
Array of pointers to input vectors
Xwith sizetotal_batch_count. The size of array allocated for theXvector of the groupimust be at least (1 + (n[i]– 1)*abs(incx[i])). See Matrix Storage for more details.- incx
Array of
group_countintegers.incx[i]specifies the stride of vectorXin groupi.- y
Array of pointers to input/output vectors
Ywith sizetotal_batch_count. The size of array allocated for theYvector of the groupimust be at least (1 + (n[i]– 1)*abs(incy[i])). See Matrix Storage for more details.- incy
Array of
group_countintegers.incy[i]specifies the stride of vectorYin groupi.- group_count
Number of groups. Must be at least 0.
- group_size
Array of
group_countintegers.group_size[i]specifies the number ofaxpyoperations in groupi. Each element ingroup_sizemust be at least 0.- dependencies
List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
Output Parameters
- y
Array of pointers holding the
Yvectors, overwritten bytotal_batch_countaxpyoperations of the formalpha*X+Y.
Return Values
Output event to wait on to ensure computation is complete.
Strided API
Syntax
namespace oneapi::mkl::blas::column_major {
sycl::event axpy_batch(sycl::queue &queue,
std::int64_t n,
T alpha,
const T *x,
std::int64_t incx,
std::int64_t stridex,
T *y,
std::int64_t incy,
std::int64_t stridey,
std::int64_t batch_size,
const std::vector<sycl::event> &dependencies = {})
}
namespace oneapi::mkl::blas::row_major {
sycl::event axpy_batch(sycl::queue &queue,
std::int64_t n,
T alpha,
const T *x,
std::int64_t incx,
std::int64_t stridex,
T *y,
std::int64_t incy,
std::int64_t stridey,
std::int64_t batch_size,
const std::vector<sycl::event> &dependencies = {})
}
Input Parameters
- queue
The queue where the routine should be executed.
- n
Number of elements in
XandY.- alpha
Specifies the scalar
alpha.- x
Pointer to input vectors
Xwith sizestridex*batch_size.- incx
Stride of vector
X.- stridex
Stride between different
Xvectors.- y
Pointer to input/output vectors
Ywith sizestridey*batch_size.- incy
Stride of vector
Y.- stridey
Stride between different
Yvectors.- batch_size
Specifies the number of
axpyoperations to perform.- dependencies
List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
Output Parameters
- y
Output vectors, overwritten by
batch_sizeaxpyoperations of the formalpha*X+Y.
Return Values
Output event to wait on to ensure computation is complete.
Parent topic:BLAS-like Extensions