Visible to Intel only — GUID: GUID-EF33E6BF-2A46-4481-869D-406706483CC4
Visible to Intel only — GUID: GUID-EF33E6BF-2A46-4481-869D-406706483CC4
oneapi::mkl::sparse::set_csr_data
Takes a matrix handle and the user-provided Compressed Sparse Row (CSR) matrix arrays and fills the internal CSR data structure of the matrix handle.
Description
The oneapi::mkl::sparse::set_csr_data routine takes a sparse::matrix_handle_t for a sparse matrix of dimensions nrows -by- ncols represented in the CSR format, and fills the internal state of the matrix handle with the user provided arrays in CSR format. Refer to the user/library contract for information on the use of the sparse::matrix_handle_t object.
API
Syntax
Using SYCL buffers:
namespace oneapi::mkl:sparse {
void set_csr_data (
sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t spMat,
const INT_TYPE nrows,
const INT_TYPE ncols,
oneapi::mkl::index_base index,
sycl::buffer<INT_TYPE, 1> &row_ptr,
sycl::buffer<INT_TYPE, 1> &col_ind,
sycl::buffer<DATA_TYPE, 1> &values);
//deprecated in 2023.0
[[deprecated("Use oneapi::mkl::sparse::set_csr_data(queue, spMat, ...) instead.")]]
void set_csr_data (
oneapi::mkl::sparse::matrix_handle_t spMat,
const INT_TYPE nrows,
const INT_TYPE ncols,
oneapi::mkl::index_base index,
sycl::buffer<INT_TYPE, 1> &row_ptr,
sycl::buffer<INT_TYPE, 1> &col_ind,
sycl::buffer<DATA_TYPE, 1> &values);
}
Using USM pointers:
namespace oneapi::mkl:sparse {
sycl::event set_csr_data (
sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t spMat,
const INT_TYPE nrows,
const INT_TYPE ncols,
oneapi::mkl::index_base index,
INT_TYPE *row_ptr,
INT_TYPE *col_ind,
DATA_TYPE *values,
const std::vector<sycl::event> &dependencies = {} );
// deprecated in 2023.0
[[deprecated("Use oneapi::mkl::sparse::set_csr_data(queue, spMat, ...) instead.")]]
void set_csr_data (
oneapi::mkl::sparse::matrix_handle_t spMat,
const INT_TYPE nrows,
const INT_TYPE ncols,
oneapi::mkl::index_base index,
INT_TYPE *row_ptr,
INT_TYPE *col_ind,
DATA_TYPE *values);
}
Include Files
oneapi/mkl/spblas.hpp
Input Parameters
- queue
-
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- spMat
-
Handle to object containing sparse matrix and other internal data for subsequent Sparse BLAS operations.
- nrows
-
Number of rows of the input matrix.
- ncols
-
Number of columns of the input matrix.
- index
-
Indicates how input arrays are indexed.
oneapi::mkl::index_base::zero
Zero-based (C-style) indexing: indices start at 0.
oneapi::mkl::index_base::one
One-based (Fortran-style) indexing: indices start at 1.
- row_ptr
-
SYCL memory object containing an array of length nrows+1, containing row-wise starting and ending locations of non-zero column indices and values in index-based numbering. Could be a SYCL buffer or a device-accessible USM pointer. Refer to Sparse Storage Formats for a detailed description of row_ptr.
- col_ind
-
SYCL memory object which stores an array containing the column indices in index-based numbering. Could be a SYCL buffer or a device-accessible USM pointer. Refer to Sparse Storage Formats for a detailed description of col_ind.
- values
-
SYCL memory object which stores an array containing the non-zero elements of the input matrix. Could be a SYCL buffer or a device-accessible USM pointer. Refer to Sparse Storage Formats for a detailed description of values.
- dependencies
-
USM API only. A vector of type const std::vector<sycl::event> & containing the list of events that the oneapi::mkl::sparse::set_csr_data routine depends on.
Summary of Input CSR Arrays
A summary of the CSR input arrays, sizes, and types (see Sparse BLAS Supported Data and Integer Types) is contained in the following table. We use the term number of non-zeros or for short, nnz, to refer to the count of elements of the matrix and sparsity pattern represented by the CSR matrix format as described in Sparse Storage Formats.
For sycl::buffer inputs, the arrays are of type sycl::buffer<T, 1> &.
For USM inputs, the arrays must be device-accessible and of type T *. The recommended USM memory type is described in the following table. In general, using USM device memory will provide a better performance than USM shared, which in turn will give better performance than USM host, but all are supported as they are all device-accessible.
array |
length (elements) |
T |
USM Memory Type |
---|---|---|---|
row_ptr |
nrows + 1 |
INT_TYPE |
device accessible (USM device or USM shared or USM host) |
col_ind |
nnz |
INT_TYPE |
device accessible (USM device or USM shared or USM host) |
values |
nnz |
DATA_TYPE |
device accessible (USM device or USM shared or USM host) |
Output Parameters
- spMat
-
Handle to object containing sparse matrix and other internal data for subsequent DPC++ Sparse BLAS operations.
- sycl::event
-
USM API only. A sycl::event that can be used to track the completion of asynchronous events that were enqueued during the API call that continue the chain of events from the input dependencies.