cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Classes | Typedefs | Enumerations | Functions
cuda::device Namespace Reference

Definitions and functionality related to CUDA devices (not including the device wrapper type device_t itself) More...

Classes

struct  compute_architecture_t
 A numeric designator of an architectural generation of CUDA devices. More...
 
struct  compute_capability_t
 A numeric designator of the computational capabilities of a CUDA device. More...
 
struct  pci_location_t
 Location "coordinates" for a CUDA device on a PCIe bus. More...
 
class  primary_context_t
 A class for holding the primary context of a CUDA device (device_t). More...
 
struct  properties_t
 A structure holding a collection various properties of a device. More...
 

Typedefs

using multiprocessor_count_t = int
 Type of the number of mutiprocessors within a single GPU.
 
using id_t = CUdevice
 Numeric ID of a CUDA device used by the CUDA Runtime API. More...
 
using attribute_t = CUdevice_attribute
 CUDA devices have both "attributes" and "properties". More...
 
using attribute_value_t = int
 All CUDA device attributes (cuda::device::attribute_t) have a value of this type.
 
using flags_t = context::flags_t
 
using host_thread_sync_scheduling_policy_t = context::host_thread_sync_scheduling_policy_t
 

Enumerations

enum  : device::id_t { default_device_id = 0 }
 

Functions

constexpr compute_capability_t make_compute_capability (unsigned combined) noexcept
 A named constructor idiom for {compute_capability_t}. More...
 
constexpr compute_capability_t make_compute_capability (unsigned major, unsigned minor) noexcept
 A named constructor idiom for {compute_capability_t}.
 
device::id_t count ()
 Get the number of CUDA devices usable on the system (with the current CUDA library and kernel driver) More...
 

Detailed Description

Definitions and functionality related to CUDA devices (not including the device wrapper type device_t itself)

Typedef Documentation

◆ attribute_t

using cuda::device::attribute_t = typedef CUdevice_attribute

CUDA devices have both "attributes" and "properties".

This is the type for attribute identifiers/indices.

◆ id_t

using cuda::device::id_t = typedef CUdevice

Numeric ID of a CUDA device used by the CUDA Runtime API.

Note
at the time of writing and the foreseeable future, this type should be an int.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : device::id_t
Enumerator
default_device_id 

If the CUDA runtime has not been set to a specific device, this is the ID of the device it defaults to.

Function Documentation

◆ count()

device::id_t cuda::device::count ( )
inline

Get the number of CUDA devices usable on the system (with the current CUDA library and kernel driver)

Note
This should be returning an unsigned value; unfortunately, device::handle_t is signed in CUDA for some reason and we maintain compatibility (although this might change in the future). So... the returned type is the same as in cudaGetDeviceCount, a signed integer.
Returns
the number of CUDA devices on this system
Exceptions
cuda::errorif the device count could not be obtained

◆ make_compute_capability()

constexpr compute_capability_t cuda::device::make_compute_capability ( unsigned  combined)
noexcept

A named constructor idiom for {compute_capability_t}.

Parameters
combinedA combination of the major and minor version number, e.g. 91 for major 9, minor 1