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

A proxy class for CUDA devices, providing access to all Runtime API calls involving their use and management; and some device-related standalone functions. More...

#include "types.hpp"
#include "current_device.hpp"
#include "device_properties.hpp"
#include "memory.hpp"
#include "pci_id.hpp"
#include "primary_context.hpp"
#include "error.hpp"
#include <cuda_runtime_api.h>
#include <string>
#include <cstring>
#include <type_traits>
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.

Classes

class  cuda::device_t
 Wrapper class for a CUDA device. More...
 

Namespaces

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

Typedefs

using cuda::device::limit_t = context::limit_t
 
using cuda::device::limit_value_t = context::limit_value_t
 
using cuda::device::shared_memory_bank_size_t = context::shared_memory_bank_size_t
 
using cuda::device::stream_priority_range_t = context::stream_priority_range_t
 

Functions

void cuda::synchronize (const device_t &device)
 Waits for all previously-scheduled tasks on all streams (= queues) on a specified device to conclude. More...
 
device_t cuda::device::wrap (id_t id) NOEXCEPT_IF_NDEBUG
 Returns a wrapper for the CUDA device with a given id. More...
 
device_t cuda::device::get (id_t id)
 Returns a proxy for the CUDA device with a given id. More...
 
device_t cuda::device::default_ ()
 Obtains (a proxy for) the default CUDA device, being the device with the default CUDA device id.
 
device_t cuda::device::cpu ()
 A named constructor idiom for a "dummy" CUDA device representing the CPU. More...
 
device_t cuda::device::current::get ()
 Obtains (a proxy for) the device which the CUDA runtime API considers to be current.
 
void cuda::device::current::set (const device_t &device)
 Tells the CUDA runtime API to consider the specified device as the current one. More...
 
device_t cuda::device::get (pci_location_t pci_id)
 Obtain a proxy to a device using its PCI bus location. More...
 
device_t cuda::device::get (const ::std::string &pci_id_str)
 Obtain a proxy to a device using a string with its PCI bus location. More...
 

Detailed Description

A proxy class for CUDA devices, providing access to all Runtime API calls involving their use and management; and some device-related standalone functions.

Function Documentation

◆ set()

void cuda::device::current::set ( const device_t &  device)
inline

Tells the CUDA runtime API to consider the specified device as the current one.

Note
this will replace the top of the context stack, if the stack isn't empty; and will create/activate the device's primary context if it isn't already active.