How to create a CUDA context?

The canonical way to force runtime API context establishment is to call cudaFree(0). If you have multiple devices, call cudaSetDevice() with the ID of the device you want to establish a context on, then cudaFree(0) to establish the context. EDIT: Note that as of CUDA 5.0, it appears that the heuristics of context establishment are … Read more

Reset Cuda Context after exception

The only method to restore proper device functionality after a non-recoverable (“sticky”) CUDA error is to terminate the host process that initiated (i.e. issued the CUDA runtime API calls that led to) the error. Therefore, for a single-process application, the only method is to terminate the application. It should be possible to design a multi-process … Read more