oneapi::mkl::sparse::init_matrix_handle

Allocates memory on the heap for a oneapi::mkl::sparse::matrix_handle_t object, initializes the internals of that object to default values, and returns with the address to that object.

Description

The oneapi::mkl::sparse::init_matrix_handle function initializes the oneapi::mkl::sparse::matrix_handle_t object with default values, otherwise it throws an exception.

Note

Refer to Error Handling for a detailed description of the exceptions thrown.

The following is a recommended usage model:

using namespace oneapi::mkl;

// set newly created handle to nullptr before sending to
// init_matrix_handle for initialization

sparse::matrix_handle_t handle = nullptr;
sparse::init_matrix_handle(&handle);

// handle is now initialized and can be filled and used

sycl::event ev_set = sparse::set_csr_data(queue, handle, /*matrix sizes and arrays */);

// when finished, clean up the handle
sycl::event ev_release = sparse::release_matrix_handle(queue, &handle, dependencies);
ev_release.wait();  // make it blocking

API

Syntax

namespace oneapi::mkl::sparse {
    void init_matrix_handle (
        oneapi::mkl::sparse::matrix_handle_t *p_handle)
}

Include Files

  • oneapi/mkl/spblas.hpp

Input Parameters

p_handle

The address of the sparse::matrix_handle_t handle to be initialized. We recommend that the sparse::matrix_handle_t handle object be set to nullptr before entry to this function to avoid confusion if it is previously initialized or not. This function allocates and initializes a matrix_handle_t object and sets the p_handle to this new object. This initialization routine must only be called on an uninitialized matrix_handle object.

Output Parameters

p_handle

On return, the address is updated to point to a newly allocated and initialized matrix_handle_t object that can be filled and used to perform sparse BLAS operations.