My Project
Loading...
Searching...
No Matches
Opm::cuistl::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 &)=delete
 
CuSparseResourceoperator= (const CuSparseResource &)=delete
 
get ()
 get returns the raw pointer to the resource.
 

Detailed Description

template<class T>
class Opm::cuistl::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/cuistl/detail/CuSparseResource.hpp>
void someFunction() {
}
Definition AquiferInterface.hpp:35

Constructor & Destructor Documentation

◆ CuSparseResource()

template<class T >
Opm::cuistl::detail::CuSparseResource< T >::CuSparseResource ( CreatorType  creator,
DeleterType  deleter 
)

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

Parameters
creatora functor used to create an instance
deletera 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: