Loading...
Searching...
No Matches
Opm::gpuistl::detail::CuSparseResource< T > Class Template Reference

The CuSparseResource class wraps a CuSparse resource in a proper RAII pattern. More...

`#include <CuSparseResource.hpp>`

## Public Types

using | CreatorType = typename std::function<cusparseStatus_t(T*)>
using | DeleterType = typename std::function<cusparseStatus_t(T)>

## Public Member Functions

| CuSparseResource (CreatorType creator, DeleterType deleter)
| CuSparseResource creates a new instance by calling creator, and will delete using deleter.
| CuSparseResource ()
| CuSparseResource will automatically select the proper creator and deleter based on the type (and throw an exception if not available).
| ~CuSparseResource ()
| Calls the deleter functor.
| CuSparseResource (const CuSparseResource &)
CuSparseResource & | operator= (const CuSparseResource &)=delete
T | get ()
| get returns the raw pointer to the resource.

## Detailed Description

template<class T>
class Opm::gpuistl::detail::CuSparseResource< T >

The CuSparseResource class wraps a CuSparse resource in a proper RAII pattern.

Current we support the following types for T:

- bsrilu02Info_t
- bsrsv2Info_t
- cusparseMatDescr_t

More types are in principle supported by supplying a manual Creator and Destructor.

In addition to acting as an easier-to-use smart_ptr specialized for these types, it also adds error checking in the construction and deletion of these resources, which a plain std::smart_ptr would not support out of the box. It also solves the caveat of the pointer types of cuSparse resources not being exposed properly.

Example usage:

#include <opm/simulator/linalg/gpuistl/detail/CuSparseResource.hpp>
void someFunction() {
auto resource = CuSparseResource<cuSparseMatDescr_t>();
}
Opm::gpuistl::detail::CuSparseResource::CuSparseResource
CuSparseResource()
CuSparseResource will automatically select the proper creator and deleter based on the type (and thro...
Definition CuSparseResource_impl.hpp:91

## Constructor & Destructor Documentation

## CuSparseResource()

template<class T>

Opm::gpuistl::detail::CuSparseResource< T >::CuSparseResource | ( | CreatorType | creator,
|  | DeleterType | deleter )

CuSparseResource creates a new instance by calling creator, and will delete using deleter.

Parameters

  creator | a functor used to create an instance
  deleter | a functor used to delete the instance

Note
  Using this constructor it is possible to add support for new types not already accounted for.

The documentation for this class was generated from the following files:

- opm/simulators/linalg/gpuistl/detail/CuSparseResource.hpp
- opm/simulators/linalg/gpuistl/detail/CuSparseResource_impl.hpp