schwz
Generated automatically from develop
|
This class defines a device guard for the cuda functions and the cuda module. More...
#include <device_guard.hpp>
Public Member Functions | |
device_guard (int device_id) | |
device_guard (device_guard &other)=delete | |
device_guard & | operator= (const device_guard &other)=delete |
device_guard (device_guard &&other)=delete | |
device_guard const & | operator= (device_guard &&other)=delete |
This class defines a device guard for the cuda functions and the cuda module.
The guard is used to make sure that the device code is run on the correct cuda device, when run with multiple devices. The class records the current device id and uses cudaSetDevice
to set the device id to the one being passed in. After the scope has been exited, the destructor sets the device_id back to the one before entering the scope.