cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Classes | Namespaces | Functions
primary_context.hpp File Reference
#include "current_context.hpp"
#include "context.hpp"
Include dependency graph for primary_context.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cuda::device::primary_context_t
 A class for holding the primary context of a CUDA device (device_t). More...
 

Namespaces

 cuda
 All definitions and functionality wrapping the CUDA Runtime API.
 
 cuda::device
 Definitions and functionality related to CUDA devices (not including the device wrapper type device_t itself)
 

Functions

bool cuda::device::primary_context::is_active (const device_t &device)
 
void cuda::device::primary_context::destroy (const device_t &device)
 Destroy and clean up all resources associated with the specified device's primary context. More...
 
primary_context_t cuda::device::primary_context::get (const device_t &device)
 Obtain a handle to the primary context of a given device - creating it ("activating" it) if it doesn't exist. More...
 
bool cuda::device::primary_context::is_current ()
 

Function Documentation

◆ destroy()

void cuda::device::primary_context::destroy ( const device_t &  device)
inline

Destroy and clean up all resources associated with the specified device's primary context.

Parameters
deviceThe device whose primary context is to be destroyed

◆ get()

primary_context_t cuda::device::primary_context::get ( const device_t &  device)
inline

Obtain a handle to the primary context of a given device - creating it ("activating" it) if it doesn't exist.

Note
This method and its returned object will "perform their own" reference accounting vis-a-vis the driver, i.e. the caller does not need to worry about increasing or decreasing the CUDA driver reference count for the primary context. Naturally, though, the caller must not interfere with this reference accounting by decreasing the reference count arbitrarily by more than it has increased it, by destroying the primary context etc.
Parameters
deviceThe device whose primary context is to be proxied
Returns
A proxy object for the specified device