NVPL Sparse Management API#
The NVPL Sparse functions for managing the library are described in this section.
nvpl_sparse_create()#
nvpl_sparse_status_t
nvpl_sparse_create(nvpl_sparse_handle_t *handle)
This function initializes the NVPL Sparse library and creates a handle on the NVPL Sparse context. It must be called before any other NVPL Sparse API function is invoked.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
The pointer to the handle to the NVPL Sparse context |
See nvpl_sparse_status_t for the description of the return status
nvpl_sparse_destroy()#
nvpl_sparse_status_t
nvpl_sparse_destroy(nvpl_sparse_handle_t handle)
This function releases CPU resources used by the NVPL Sparse library.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
The handle to the NVPL Sparse context |
See nvpl_sparse_status_t for the description of the return status
nvpl_sparse_get_version()#
nvpl_sparse_status_t
nvpl_sparse_get_version(nvpl_sparse_handle_t handle,
int* version)
This function returns the version number of the NVPL Sparse library.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
NVPL Sparse handle |
|
OUT |
The version number of the library |
See nvpl_sparse_status_t for the description of the return status
nvpl_sparse_get_max_threads()#
int
nvpl_sparse_get_max_threads(void)
Returns the maximum number of threads that NVPL Sparse may use.
nvpl_sparse_get_num_threads()#
int
nvpl_sparse_get_num_threads(void)
Returns the number of threads in the current OpenMP team when called inside a parallel region.
Notes
When called inside an OpenMP parallel region, this reflects the actual team size (for example, the result of
omp_get_num_threads()).When called outside a parallel region, this function returns
1.
nvpl_sparse_set_num_threads()#
void
nvpl_sparse_set_num_threads(const int numthreads)
Sets the desired number of threads to be used by subsequent OpenMP parallel regions in NVPL Sparse.
Param. |
In/out |
Meaning |
|---|---|---|
|
IN |
Desired number of threads for future regions |
Notes
This forwards to the underlying runtime (for example,
omp_set_num_threads(numthreads)).
nvpl_sparse_get_thread_num()#
int
nvpl_sparse_get_thread_num(void)
Returns the zero-based thread index of the calling thread within the current OpenMP team when called inside a parallel region.
Notes
When called inside an OpenMP parallel region, this reflects the calling thread’s index (for example, the result of
omp_get_thread_num()).When called outside a parallel region, this function returns
0.