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.
Note
Refer to Sparse BLAS Supported Data and Integer Types for a list of supported <DATA_TYPE> and <INT_TYPE>
data and integer types and refer to Error Handling for a detailed description of
the possible exceptions thrown.
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);
}
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 = {} );
}
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::zeroZero-based (C-style) indexing: indices start at 0.
oneapi::mkl::index_base::oneOne-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 inindex-based numbering. Could be a SYCL buffer or a device-accessible USM pointer. Refer to Sparse Storage Formats for a detailed description ofrow_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 ofcol_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 theoneapi::mkl::sparse::set_csr_dataroutine 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 |
|
INT_TYPE |
device accessible (USM device or USM shared or USM host) |
col_ind |
|
|
device accessible (USM device or USM shared or USM host) |
values |
|
|
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::eventthat 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.