Back to Taskflow

Taskflow: A General

docs/classtf_1_1cudaScopedDevice.html

4.1.01.9 KB
Original Source

| | Taskflow: A General-purpose Task-parallel Programming System |

Loading...

Searching...

No Matches

Public Member Functions | List of all members

tf::cudaScopedDevice Class Reference

class to create an RAII-styled context switch More...

#include <taskflow/cuda/cuda_device.hpp>

|

Public Member Functions

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

Detailed Description

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 1

cudaStream_t stream;

cudaStreamCreate(&stream);

} // leaving the scope and goes back to the previous device context

tf::cudaScopedDevice

class to create an RAII-styled context switch

Definition cuda_device.hpp:289

cudaScopedDevice is neither movable nor copyable.

Constructor & Destructor Documentation

cudaScopedDevice()

|

| tf::cudaScopedDevice::cudaScopedDevice | ( | int | device | ) | |

| inlineexplicit |

constructs a RAII-styled device switcher

Parameters

| device | device context to scope in the guard |


The documentation for this class was generated from the following file: