oneapi::mkl::sparse::omatcopy#
Performs an out-of-place copy/transpose of user data in a matrix handle into user data in a new handle without changing the sparse matrix format.
Description#
The oneapi::mkl::sparse::omatcopy
API copies user-provided sparse matrix
arrays stored in a given sparse matrix handle into those provided in another
sparse matrix handle. The routine enables users to perform a transpose operation
and/or a change in array indexing in the copy. Only out-of-place copy/transpose
is supported through this API.
Note
Refer to Error Handling for a detailed description of the possible exceptions thrown.
Note
This routine modifies arrays provided to oneMKL through the matrix handle
creation routines,
oneapi::mkl::sparse::set_<sparse_matrix_type>_data
. Arrays of only
the output matrix handle are modified, and those of the input handle are
not.
API#
Syntax#
Using USM and SYCL buffers:
namespace oneapi::mkl::sparse {
sycl::event omatcopy (
sycl::queue &queue,
oneapi::mkl::transpose transpose_val,
oneapi::mkl::sparse::matrix_handle_t spMat_in,
oneapi::mkl::sparse::matrix_handle_t spMat_out,
const std::vector<sycl::event> &dependencies = {});
}
Include Files#
oneapi/mkl/spblas.hpp
Input Parameters#
- queue
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- transpose_val
Specifies operation
op()
on input matrix.- oneapi::mkl::transpose::nontrans
Non-transpose,
op(A)
=A
.
- oneapi::mkl::transpose::trans
Transpose,
op(A)
=A
T.
- oneapi::mkl::transpose::conjtrans
Conjugate transpose,
op(A)
=A
H.
- spMat_in
Handle to object containing input sparse matrix and other internal data. Created using one of the
oneapi::mkl::sparse::set_<sparse_matrix_type>_data
routines.Note
The supported cases for
<sparse_matrix_type>
arecsr
andcoo
on both CPU and GPU devices.spMat_out
must be created with the same<sparse_matrix_type>
.- spMat_out
Handle to object containing output sparse matrix and other internal data. Created using one of the
oneapi::mkl::sparse::set_<sparse_matrix_type>_data
routines. Note that the sparse matrix dimensions/array lengths of this output handle must be same as that of the input handle in case ofoneapi::mkl::transpose::nontrans
operation. The number of rows and columns of this output matrix handle foroneapi::mkl::transpose::trans
andoneapi::mkl::transpose::conjtrans
operations must be the number of columns and rows of the input matrix handle, respectively. Also note that in case of a transpose operation, the number of non-zeros in the sparse matrix remains unchanged.Note
The supported cases for
<sparse_matrix_type>
arecsr
andcoo
on both CPU and GPU devices.spMat_in
must be created with the same<sparse_matrix_type>
.- dependencies
A vector of type
std::vector<sycl::event> &
containing the list of events that theoneapi::mkl::sparse::omatcopy
routine depends on.
Return Values#
sycl::event
SYCL event which can be waited upon or added as a dependency for the completion of the
omatcopy
routine.// Examples of API arguments and usage sycl::event ev_opt = sparse::omatcopy(queue, trans_val, spMat_in, spMat_out); // Allowed use in case of USM sycl::event ev_opt = sparse::omatcopy(queue, trans_val, spMat_in, spMat_out, {}); // Allowed use in case of USM sycl::event ev_opt = sparse::omatcopy(queue, trans_val, spMat_in, spMat_out, dependencies); // Allowed use in case of USM sparse::omatcopy(queue, trans_val, spMat_in, spMat_out); // Recommended use in case of sycl::buffer sparse::omatcopy(queue, trans_val, spMat_in, spMat_out, {}); // Not recommended in case of sycl::buffer, but supported; sparse::omatcopy(queue, trans_val, spMat_in, spMat_out, dependencies); // Not recommended in case of sycl::buffer, but supported; sycl::event ev_opt = sparse::omatcopy(queue, trans_val, spMat_in, spMat_out); // Not recommended in case of sycl::buffer, but supported. Note that most sycl::buffer oneMKL APIs do not have ability to pass in dependencies