schwz  Generated automatically from develop
Public Member Functions | List of all members
schwz::device_guard Class Reference

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_guardoperator= (const device_guard &other)=delete
 
 device_guard (device_guard &&other)=delete
 
device_guard const & operator= (device_guard &&other)=delete
 

Detailed Description

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.


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