NVIDIA NvNeural SDK
2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
ILibraryContext is a generic library handle wrapper. More...
#include <nvneural/CoreTypes.h>
Public Types | |
using | LibraryId = std::uint64_t |
Library IDs should be generated randomly similar to interface IDs. | |
![]() | |
using | RefCount = std::uint32_t |
Typedef used to track the number of active references to an object. | |
using | TypeId = std::uint64_t |
Every interface must define a unique TypeId. This should be randomized. | |
Public Member Functions | |
virtual NeuralResult | bindCurrentThread (INetworkBackend *pBackend) noexcept=0 |
Thread rebinding callback. More... | |
virtual LibraryId | libraryId () const noexcept=0 |
Retrieves a stable identifier for the library being tracked in this object. | |
virtual NeuralResult | synchronize (INetworkBackend *pBackend) noexcept=0 |
Synchronization callback. More... | |
![]() | |
virtual RefCount | addRef () const noexcept=0 |
Increments the object's reference count. More... | |
virtual const void * | queryInterface (TypeId interface) const noexcept=0 |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
virtual void * | queryInterface (TypeId interface) noexcept=0 |
Retrieves a new object interface pointer. More... | |
virtual RefCount | release () const noexcept=0 |
Decrements the object's reference count and destroy the object if the reference count reaches zero. More... | |
Static Public Attributes | |
static const IRefObject::TypeId | typeID = 0x1ec1c40bfc1e45a4ul |
Interface TypeId for InterfaceOf purposes. | |
![]() | |
static const TypeId | typeID = 0x14ecc3f9de638e1dul |
Interface TypeId for InterfaceOf purposes. | |
Additional Inherited Members | |
![]() | |
virtual | ~IRefObject ()=default |
A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr. | |
ILibraryContext is a generic library handle wrapper.
External libraries such as cuBLAS, cuSolver, or NPP are generally shareable across multiple layers and wasteful to instantiate on a per-layer basis. Not all layers require such libraries, however, and so including them directly in the backend-specific interfaces is undesirable.
We compromise by providing a key-value store in INetworkBackend; for more details, see INetworkBackend::getLibraryContext and related functions.
ILibraryContext objects have callback support, so that they can be notified when their owning network backend performs a CPU/GPU synchronization or rebinds to a new thread.
There is no default getHandle() method; clients should downcast to the appropriate leaf interface (e.g., ICublasLibraryContext) and use type-safe accessors.
|
pure virtualnoexcept |
Thread rebinding callback.
The implementation should rebind its library context to the current thread.
pBackend | Owning backend binding current thread |
|
pure virtualnoexcept |
Synchronization callback.
The implementation should perform a CPU/GPU sync if the library provides such an API.
pBackend | Owning backend performing synchronization |