Visible to Intel only — GUID: GUID-EECFDF45-4B44-436C-ABC0-6DEC6859BC5E
Visible to Intel only — GUID: GUID-EECFDF45-4B44-436C-ABC0-6DEC6859BC5E
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 num_rows -by- num_cols represented in the CSR format, and fills the internal state of the matrix handle with the user provided arrays in CSR format. Please familiarize yourself with the user/library contract surrounding 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 handle, const INT_TYPE num_rows, const INT_TYPE num_cols, oneapi::mkl::index_base index, sycl::buffer<INT_TYPE, 1> &rowptr, sycl::buffer<INT_TYPE, 1> &colinds, sycl::buffer<DATA_TYPE, 1> &values); //deprecated in 2023.0 void set_csr_data ( oneapi::mkl::sparse::matrix_handle_t handle, const INT_TYPE num_rows, const INT_TYPE num_cols, oneapi::mkl::index_base index, sycl::buffer<INT_TYPE, 1> &rowptr, sycl::buffer<INT_TYPE, 1> &colinds, 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 handle, const INT_TYPE num_rows, const INT_TYPE num_cols, oneapi::mkl::index_base index, INT_TYPE *rowptr, INT_TYPE *colinds, DATA_TYPE *values, const std::vector<sycl::event> &dependencies = {} ); // deprecated in 2023.0 void set_csr_data ( oneapi::mkl::sparse::matrix_handle_t handle, const INT_TYPE num_rows, const INT_TYPE num_cols, oneapi::mkl::index_base index, INT_TYPE *rowptr, INT_TYPE *colinds, 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.
- handle
-
Handle to object containing sparse matrix and other internal data for subsequent Sparse BLAS operations.
- num_rows
-
Number of rows of the input matrix.
- num_cols
-
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.
- rowptr
-
SYCL memory object containing an array of length num_rows+1. Could be a SYCL buffer or a device-accessible USM pointer. Refer to Sparse Storage Formats for a detailed description of rowptr.
- colinds
-
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 colind.
- 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>.
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 |
---|---|---|---|
rowptr |
num_rows + 1 |
INT_TYPE |
device accessible (USM device or USM shared or USM host) |
colinds |
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
- handle
-
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.