oneapi::mkl::sparse::set_csc_data
Takes a matrix handle and the user-provided Compressed Sparse Column (CSC) matrix arrays and fills the internal CSC data structure of the matrix handle.
Description
The oneapi::mkl::sparse::set_csc_data routine takes a sparse::matrix_handle_t for a sparse matrix of dimensions nrows -by- ncols represented in the CSC format, and fills the internal state of the matrix handle with the user provided arrays in CSC 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_csc_data (
sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t spMat,
const std::int64_t nrows,
const std::int64_t ncols,
const std::int64_t nnz,
oneapi::mkl::index_base index,
sycl::buffer<INT_TYPE, 1> &col_ptr,
sycl::buffer<INT_TYPE, 1> &row_ind,
sycl::buffer<DATA_TYPE, 1> &values);
}
Using USM pointers:
namespace oneapi::mkl::sparse {
sycl::event set_csc_data (
sycl::queue &queue,
oneapi::mkl::sparse::matrix_handle_t spMat,
const std::int64_t nrows,
const std::int64_t ncols,
const std::int64_t nnz,
oneapi::mkl::index_base index,
INT_TYPE *col_ptr,
INT_TYPE *row_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.
- nnz
-
Number of stored elements (sometimes called number of non-zeros) in 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.
- col_ptr
-
SYCL memory object containing an array of length ncols+1, containing col-wise starting and ending locations of non-zero row 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 col_ptr.
- row_ind
-
SYCL memory object which stores an array containing the row 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 CSC row_ind. Must be of length greater than or equal to nnz.
- 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. Must be of length greater than or equal to nnz.
- dependencies
-
USM API only. A vector of type const std::vector<sycl::event> & containing the list of events that the oneapi::mkl::sparse::set_csc_data routine depends on.
Summary of Input CSC Arrays
A summary of the CSC 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 CSC 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 |
|---|---|---|---|
col_ptr |
ncols + 1 |
INT_TYPE |
device accessible (USM device or USM shared or USM host) |
row_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 SYCL 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.