Last active
June 30, 2023 20:10
-
-
Save daskol/0837c4331017d6eba66b788fb7a5a416 to your computer and use it in GitHub Desktop.
Reset CUDA device if program counter was corrupted.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* reset-device.cc | |
* | |
* Simple program which resets a devices if kernel launch was failed. This | |
* could happend due to invalida program counter as an example. | |
* | |
* $ nvcc -o reset-device reset-device.cc | |
* $ ./reset-device | |
* cudaSuccess: no error | |
*/ | |
#include <iostream> | |
#include <cuda.h> | |
int main(int argc, char *argv[]) { | |
cudaError_t err = cudaDeviceSynchronize(); | |
std::cout << cudaGetErrorName(err) << ": " << cudaGetErrorString(err) | |
<< std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment