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:
T |
---|
|
|
|
|
axpy_batch (Buffer Version)¶
Buffer version of axpy_batch
supports only strided API.
Strided API¶
Strided API operation is defined as:
for i = 0 … batch_size – 1
X and Y are vectors at offset i * stridex and i * stridey in x and y
Y = alpha * X + Y
end for
where:
alpha
is scalarX
andY
are vectors
For strided API, all vectors X
and Y
have same parameters (size, increments) and are stored at constant stride given by stridex
and stridey
from each other.
The x
and y
arrays contain all the input vectors. Total number of vectors in x
and y
are given by batch_size
parameter.
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 vectors
X
andY
.- alpha
Specifies the scalar
alpha
.- x
Buffer holding input vectors
X
. Size of the buffer must be at leastbatch_size
*stridex
.- incx
Stride between two consecutive elements of
X
vectors.- stridex
Stride between two consecutive
X
vectors. Must be at least (1 + (n
-1)*abs(incx
)). See Matrix Storage for more details.- y
Buffer holding input/output vectors
Y
. Size of the buffer must be at leastbatch_size
*stridey
.- incy
Stride between two consecutive elements of
Y
vectors.- stridey
Stride between two consecutive
Y
vectors. Must be at least (1 + (n
-1)*abs(incy
)). See Matrix Storage for more details.- batch_size
Number of
axpy
computations to perform. Must be at least zero.
Output Parameters¶
- y
Output buffer overwritten by
batch_size
axpy
operations of the formalpha
*X
+Y
.
axpy_batch (USM Version)¶
USM version of axpy_batch
supports group API and strided API.
Group API¶
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 at x[idx] and y[idx]
Y = alpha[i] * X + Y
idx = idx + 1
end for
end for
where:
alpha
is scalarX
andY
are vectors
For group API, each group contains vectors with the same parameters (size and increment).
The x
and y
arrays contain the pointers for all the input vectors. Total number of vectors in x
and y
are given by:
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_count
integers.n[i]
specifies number of elements in vectorsX
andY
for every vector in groupi
.- alpha
Array of
group_count
scalar elements.alpha[i]
specifies scaling factor for vectorX
in groupi
.- x
Array of pointers to input vectors
X
with sizetotal_batch_count
. Size of the array allocated for theX
vector of the groupi
must be at least (1 + (n[i]
– 1)*abs(incx[i]
)). See Matrix Storage for more details.- incx
Array of
group_count
integers.incx[i]
specifies stride of vectorX
in groupi
.- y
Array of pointers to input/output vectors
Y
with sizetotal_batch_count
. Size of the array allocated for theY
vector of the groupi
must be at least (1 + (n[i]
– 1)*abs(incy[i]
)). See Matrix Storage for more details.- incy
Array of
group_count
integers.incy[i]
specifies the stride of vectorY
in groupi
.- group_count
Number of groups. Must be at least zero.
- group_size
Array of
group_count
integers.group_size[i]
specifies the number ofaxpy
operations in groupi
. Each element ingroup_size
must be at least zero.- 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
Y
vectors, overwritten bytotal_batch_count
axpy
operations of the formalpha
*X
+Y
.
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
X and Y are vectors at offset i * stridex and i * stridey in x and y
Y = alpha * X + Y
end for
where:
alpha
is scalarX
andY
are vectors
For strided API, all vectors X
and Y
have same parameters (size, increments) and are stored at constant stride given by stridex
and stridey
from each other.
The x
and y
arrays contain all the input vectors. Total number of vectors in x
and y
are given by batch_size
parameter.
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 vectors
X
andY
.- alpha
Specifies the scalar
alpha
.- x
Pointer to input vectors
X
. Size of the array must be at leastbatch_size
*stridex
.- incx
Stride between two consecutive elements of
X
vectors.- stridex
Stride between two consecutive
X
vectors. Must be at least (1 + (n
-1)*abs(incx
)). See Matrix Storage for more details.- y
Pointer to input/output vectors
Y
. Size of the array must be at leastbatch_size
*stridey
.- incy
Stride between two consecutive elements of
Y
vectors.- stridey
Stride between two consecutive
Y
vectors. Must be at least (1 + (n
-1)*abs(incy
)). See Matrix Storage for more details.- batch_size
Number of
axpy
computations to perform. Must be at least zero.- dependencies
List of events to wait for before starting computation, if any. If omitted, defaults to no dependencies.
Output Parameters¶
- y
Pointer to output vectors
Y
overwritten bybatch_size
axpy
operations of the formalpha
*X
+Y
.
Return Values¶
Output event to wait on to ensure computation is complete.