Unknown error from cudaMalloc cudaMalloc returuns unknown error using cudaGLSetGLDevice

I have a project with two working CUDA kernels that I want to convert to use the built-in OpenGL interoperability feature. To do this I need to substitute a call to cudaGLSetGLDevice for the current cudaSetDevice call. As soon as I try this all my existing calls to cudaMalloc cause an “Unknown error” and no longer work.

I have not found any prohibition against using cudaMalloc with the interoperability feature and the “Unknown error” tells me absolutely nothing about what’s happening.

Has anyone had a similar problem or can anyone offer some advice from experience. I’m still a novice at this stuff and will be grateful for any help I can get.

The device is a Quadro 2000D and the drivers are from the file 276.14… which were the latest as of a couple of weeks ago. The OS is Windows XP pro running on a 3.3 GHz quad procesor with 3.3 GB RAM.

I solved this by changing the order of things so the rendering context is created before any calls to cudaMalloc.

I have no idea why this works. And I think “Unknown error” is not an appropriate response to something that somewhere in CUDA it’s known exactly what the problem is.

Problem solved! About a day lost on trial and error, searching the Internet and holding a wet finger in the air.