set_csr_matrix_data#

Reset the data of a matrix_handle_t object with the provided CSR data.

Description and Assumptions

The oneapi::mkl::sparse::set_csr_matrix_data function sets new data to the matrix_handle_t object with the provided data.

In the case of buffers, the reference count of the provided buffer is incremented which extends the lifetime of the underlying buffer until the smhandle is destroyed with release_sparse_matrix or the data is reset with set_csr_matrix_data.

In the case of USM, the object does not take ownership of the data.

Also see init_csr_matrix.

set_csr_matrix_data (Buffer version)#

Syntax

namespace oneapi::mkl::sparse {

    template <typename dataType, typename indexType>
    void set_csr_matrix_data (sycl::queue                          &queue,
                              oneapi::mkl::sparse::matrix_handle_t smhandle,
                              std::int64_t                         num_rows,
                              std::int64_t                         num_cols,
                              std::int64_t                         nnz,
                              index_base                           index,
                              sycl::buffer<indexType, 1>           row_ptr,
                              sycl::buffer<indexType, 1>           col_ind,
                              sycl::buffer<dataType, 1>            val);

}

Template parameters

dataType

See supported template types. Must be the same type as was used when creating the matrix_handle_t.

indexType

See supported template types. Must be the same type as was used when creating the matrix_handle_t.

Input parameters

queue

The SYCL command queue which will be used for SYCL kernels execution.

smhandle

Handle already initialized with init_csr_matrix.

num_rows

Number of rows of the provided data val. Must be at least 0.

num_cols

Number of columns of the provided data val. Must be at least 0.

nnz

The number of explicit entries, also known as Number of Non-Zero elements. Must be at least 0.

index

Indicates how input arrays are indexed. The possible options are described in index_base enum class.

row_ptr

Buffer of length at least num_rows+1. Refer to CSR format for detailed description of row_ptr.

col_ind

Buffer of length at least nnz containing the column indices in index-based numbering. Refer to CSR format for detailed description of col_ind.

val

Buffer of length at least nnz. Contains the data of the input matrix which is not implicitly zero. The remaining input values are implicit zeros. Refer to CSR format for detailed description of val.

Notes

  • The parameters num_rows, num_cols and nnz may be zero if and only if row_ptr, col_ind and val are zero-sized, otherwise they must be strictly greater than zero.

Throws

This function 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.

set_csr_matrix_data (USM version)#

Syntax

namespace oneapi::mkl::sparse {

    template <typename dataType, typename indexType>
    void set_csr_matrix_data (sycl::queue                          &queue,
                              oneapi::mkl::sparse::matrix_handle_t smhandle,
                              std::int64_t                         num_rows,
                              std::int64_t                         num_cols,
                              std::int64_t                         nnz,
                              index_base                           index,
                              indexType                            *row_ptr,
                              indexType                            *col_ind,
                              dataType                             *val);

}

Template parameters

dataType

See supported template types. Must be the same type as was used when creating the matrix_handle_t.

indexType

See supported template types. Must be the same type as was used when creating the matrix_handle_t.

Input parameters

queue

The SYCL command queue which will be used for SYCL kernels execution.

smhandle

Handle already initialized with init_csr_matrix.

num_rows

Number of rows of the provided data val. Must be at least 0.

num_cols

Number of columns of the provided data val. Must be at least 0.

nnz

The number of explicit entries, also known as Number of Non-Zero elements. Must be at least 0.

index

Indicates how input arrays are indexed. The possible options are described in index_base enum class.

row_ptr

USM pointer of length at least num_rows+1. Refer to CSR format for detailed description of row_ptr. The data must be accessible on the device.

col_ind

USM pointer of length at least nnz containing the column indices in index-based numbering. Refer to CSR format for detailed description of col_ind. The data must be accessible on the device.

val

USM pointer of length at least nnz. Contains the data of the input matrix which is not implicitly zero. The remaining input values are implicit zeros. Refer to CSR format for detailed description of val. The data must be accessible on the device. Using a USM pointer with a smaller allocated memory size is undefined behavior.

Notes

  • The parameters num_rows, num_cols and nnz may be zero if and only if row_ptr, col_ind and val are null pointers, otherwise they must be strictly greater than zero.

Throws

This function 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.

Parent topic: Data handles