cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Namespaces | Macros | Functions
device.hpp File Reference

Implementations requiring the definitions of multiple CUDA entity proxy classes, and which regard devices, including primary contexts. More...

#include "../device.hpp"
#include "../event.hpp"
#include "../kernel_launch.hpp"
#include "../stream.hpp"
#include "../primary_context.hpp"
#include "../kernel.hpp"
#include "../apriori_compiled_kernel.hpp"
#include "../current_context.hpp"
#include "../current_device.hpp"
#include "../peer_to_peer.hpp"
Include dependency graph for device.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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::peer_to_peer::can_access (device_t accessor, device_t peer)
 Determine whether one CUDA device can access the global memory of another CUDA device. More...
 
void cuda::device::peer_to_peer::enable_access (device_t accessor, device_t peer)
 Enable access by one CUDA device to the global memory of another. More...
 
void cuda::device::peer_to_peer::disable_access (device_t accessor, device_t peer)
 Disable access by one CUDA device to the global memory of another. More...
 
bool cuda::device::peer_to_peer::can_access_each_other (device_t first, device_t second)
 Determine whether two CUDA devices can currently access each other.
 
void cuda::device::peer_to_peer::enable_bidirectional_access (device_t first, device_t second)
 Enable access both by the first to the second device and the other way around.
 
void cuda::device::peer_to_peer::disable_bidirectional_access (device_t first, device_t second)
 Disable access both by the first to the second device and the other way around.
 
attribute_value_t cuda::device::peer_to_peer::get_attribute (attribute_t attribute, device_t first, device_t second)
 Get one of the numeric attributes for a(n ordered) pair of devices, relating to their interaction. More...
 
void cuda::synchronize (const device_t &device)
 

Detailed Description

Implementations requiring the definitions of multiple CUDA entity proxy classes, and which regard devices, including primary contexts.

Specifically:

  1. Functions in the cuda::device namespace.
  2. Methods of cuda::device_t and possibly some relates classes.

Function Documentation

◆ can_access()

bool cuda::device::peer_to_peer::can_access ( device_t  accessor,
device_t  peer 
)
inline

Determine whether one CUDA device can access the global memory of another CUDA device.

Parameters
accessordevice interested in making a remote access
peerdevice to be accessed
Returns
true iff acess is possible

◆ 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

◆ disable_access()

void cuda::device::peer_to_peer::disable_access ( device_t  accessor,
device_t  peer 
)
inline

Disable access by one CUDA device to the global memory of another.

Parameters
accessordevice interested in making a remote access
peerdevice to be accessed
Todo:
Consider disabling this, given that access is context-specific

◆ enable_access()

void cuda::device::peer_to_peer::enable_access ( device_t  accessor,
device_t  peer 
)
inline

Enable access by one CUDA device to the global memory of another.

Parameters
accessordevice interested in making a remote access
peerdevice to be accessed
Todo:
Consider disabling this, given that access is context-specific

◆ 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

◆ get_attribute()

attribute_value_t cuda::device::peer_to_peer::get_attribute ( attribute_t  attribute,
device_t  first,
device_t  second 
)
inline

Get one of the numeric attributes for a(n ordered) pair of devices, relating to their interaction.

Note
This is the device-pair equivalent of device_t::get_attribute()
Parameters
attributeidentifier of the attribute of interest
firstthe device accessing an att
seconddestination device
Returns
the numeric attribute value