Records the calling thread's current OpenGL context as the OpenGL context to use for OpenGL interoperability with the CUDA device device and sets device as the current device for the calling host thread.
If device has already been initialized then this call will fail with the error cudaErrorSetOnActiveProcess. In this case it is necessary to reset device using cudaDeviceReset() before OpenGL interoperability on device may be enabled.