oneapi::mkl::sparse::omatcopy

Performs an out-of-place copy of a CSR matrix handle into a new one.

Description

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.

The oneapi::mkl::sparse::omatcopy copies the user-provided sparse matrix arrays stored in a given sparse matrix handle into those provided in another sparse matrix handle. The routine enables one 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.

API

Syntax

Note

Currently, complex types are not supported.

Using USM and SYCL buffers:

namespace oneapi::mkl::sparse {
    sycl::event omatcopy (
        sycl::queue &queue,
        oneapi::mkl::transpose transpose_flag,
        oneapi::mkl::sparse::matrix_handle_t from_handle,
        oneapi::mkl::sparse::matrix_handle_t to_handle,
        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_flag

Specifies operation op() on input matrix.

oneapi::mkl::transpose::nontrans
  • Non-transpose, op(A) = A.

oneapi::mkl::transpose::trans
  • Transpose, op(A) = AT.

oneapi::mkl::transpose::conjtrans
  • Conjugate transpose, op(A) = AH.

Note

Currently, only operations oneapi::mkl::transpose::nontrans and oneapi::mkl::transpose::trans are supported.

from_handle

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

Currently, the only supported matrix format for <sparse_matrix_type> is the csr format.

to_handle

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 of oneapi::mkl::transpose::nontrans operation. The number of rows and columns of this output matrix handle for oneapi::mkl::transpose::trans and oneapi::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

Currently, csr is the only supported matrix format for <sparse_matrix_type>.

dependencies

A vector of type std::vector<sycl::event> & containing the list of events that the oneapi::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, from_handle, to_handle);               // Allowed use in case of USM
sycl::event ev_opt = sparse::omatcopy(queue, trans_val, from_handle, to_handle, {});           // Allowed use in case of USM
sycl::event ev_opt = sparse::omatcopy(queue, trans_val, from_handle, to_handle, dependencies); // Allowed use in case of USM
sparse::omatcopy(queue, trans_val, from_handle, to_handle);                                    // Recommended use in case of sycl::buffer
sparse::omatcopy(queue, trans_val, from_handle, to_handle, {});                                // Not recommended in case of sycl::buffer, but supported;
sparse::omatcopy(queue, trans_val, from_handle, to_handle, dependencies);                      // Not recommended in case of sycl::buffer, but supported;
sycl::event ev_opt = sparse::omatcopy(queue, trans_val, from_handle, to_handle);               // Not recommended in case of sycl::buffer, but supported. Note that most sycl::buffer oneMKL APIs do not have ability to pass in dependencies