how to use cudaGLSetGLDevice(), Is there any problem if i miss it.

I’m using opengl buffers with cuda.
How to use cudaGLSetGLDevice() for initialising cuda.
My kernels are working fine without calling cudaGLSetGLDevice() .
but now I got an issue,
In some cases , the mapped buffer object pointer contain invalid values.

Is there any problem if i use OPengl buffers without cudaGLSetGLDevice.

Thanks in advance.