cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
|
Wrappers for getting and setting CUDA's choice of which device is 'current'. More...
#include "constants.hpp"
#include "miscellany.hpp"
#include "current_context.hpp"
#include "primary_context.hpp"
#include <cuda_runtime_api.h>
Go to the source code of this file.
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) | |
Macros | |
#define | CUDA_DEVICE_FOR_THIS_SCOPE(_cuda_device) ::cuda::device::current::scoped_override_t scoped_device_override{ _cuda_device } |
This macro will set the current device for the remainder of the scope in which it is invoked, and will change it back to the previous value when exiting the scope. More... | |
Functions | |
void | cuda::device::current::set (const device_t &device) |
Tells the CUDA runtime API to consider the specified device as the current one. More... | |
void | cuda::device::current::set_to_default () |
Reset the CUDA Runtime API's current device to its default value - the default device. | |
Wrappers for getting and setting CUDA's choice of which device is 'current'.
CUDA has one device set as 'current'; and much of the Runtime API implicitly refers to that device only. This file contains wrappers for getting and setting it - as standalone functions - and a RAII class which can be used for setting it for the duration of a scope, popping back the old setting as the scope is exited.
#define CUDA_DEVICE_FOR_THIS_SCOPE | ( | _cuda_device | ) | ::cuda::device::current::scoped_override_t scoped_device_override{ _cuda_device } |
This macro will set the current device for the remainder of the scope in which it is invoked, and will change it back to the previous value when exiting the scope.
Use it as an opaque command, which does not explicitly expose the variable defined under the hood to effect this behavior.
|
inline |
Tells the CUDA runtime API to consider the specified device as the current one.