Back to Taskflow

tf::cudaScopedDevice class

docs/classtf_1_1cudaScopedDevice.html

4.0.0950 B
Original Source

tf::cudaScopedDevice class

class to create an RAII-styled context switch

Sample usage:

{tf::cudaScopedDevice device(1);// switch to the device context 1// create a stream under device context 1cudaStream\_t stream;cudaStreamCreate(&stream);}// leaving the scope and goes back to the previous device context

cudaScopedDevice is neither movable nor copyable.

Constructors, destructors, conversion operators

cudaScopedDevice(int device) explicit constructs a RAII-styled device switcher~cudaScopedDevice()destructs the guard and switches back to the previous device context

Function documentation

tf::cudaScopedDevice::cudaScopedDevice(int device) explicit

constructs a RAII-styled device switcher

Parameters
device