tf::cudaScopedDevice
taskflow/cuda/cuda_device.hpp
int int tf::cudaScopedDevice::_p _p
tf::cudaScopedDevice::cudaScopedDevice
(int device)
cudaScopedDevice
int device

constructs a RAII-styled device switcher

device

device context to scope in the guard

tf::cudaScopedDevice::~cudaScopedDevice
()
~cudaScopedDevice

destructs the guard and switches back to the previous device context

tf::cudaScopedDevice::cudaScopedDevice
()=delete
cudaScopedDevice
tf::cudaScopedDevice::cudaScopedDevice
(const cudaScopedDevice &)=delete
cudaScopedDevice
const cudaScopedDevice &
tf::cudaScopedDevice::cudaScopedDevice
(cudaScopedDevice &&)=delete
cudaScopedDevice
cudaScopedDevice &&

class to create an RAII-styled context switch

Sample usage:

    {
    tf::cudaScopedDevicedevice(1);//switchtothedevicecontext1

    //createastreamunderdevicecontext1
    cudaStream_tstream;
    cudaStreamCreate(&stream);

    }//leavingthescopeandgoesbacktothepreviousdevicecontext

cudaScopedDevice is neither movable nor copyable.

- tf::cudaScopedDevice
  _p
- tf::cudaScopedDevice
  cudaScopedDevice
- tf::cudaScopedDevice
  cudaScopedDevice
- tf::cudaScopedDevice
  cudaScopedDevice
- tf::cudaScopedDevice
  cudaScopedDevice
- tf::cudaScopedDevice
  ~cudaScopedDevice