Error while trying to execute an OptiX program


I’m beginning with OptiX and trying to run some of the examples given with the SDK.
I followed the instructions in the README file and successfully generated the corresponding projects, but while trying to execute one of them, I always get the same error :
OptiX Error: Unknown error (Details:
Function “_rtBufferCreateFromGLBO” caught exception: Encountered a CUDA error: cuGLGetDevices() returned (999): Unknown, [3801508])

This topic ( was reporting the same problem with no solution.

Any help would be appreciated.


Solved it.
Since I was not using my graphic card for display, the programs which were trying to actually display something wouldn’t work.
I just plugged the monitor on the graphic card and everything worked.

Hi, I meet the similar problem. I used to do with optix well, but somehow it doesnot work. The result is the same. I wonder how you plug your graphic card.

Actually, My optix SDK used to work well. Somehow it does not work with the problem above. This problem only occurs when the examples has “cgfx” file. I download the sdk(Optix 2.5.1) again. It does not work either for the examples which have cgfx shader file. I doubt this has something to do with opengl. But I don’t know how. Can anyone give advice?

You might not be using a valid device number for rendering. Most likely, you have more than 1 Graphics Card on your system.

It is best to do a debug and step through the specific code in SampleScene.cpp. You might be using your non-nvidia card for rendering when you set your device:

int max_num_devices = Context::getDeviceCount();
int actual_num_devices = std::min( max_num_devices, std::max( 1, m_num_devices ) );
std::vector devs(actual_num_devices);
for( int i = 0; i < actual_num_devices; ++i ) devs[i] = i;
m_context->setDevices( devs.begin(), devs.end() );

You might have to activate your Nvidia graphics card for customized rendering through your own nvidia drivers control panel (Under Manage 3D Settings) if i’m not wrong.

Thanks. But I only have a GTX 570 graphic card.
and I use the code
std::vector enabled_devices = rtContext->getEnabledDevices();
only one device index is in this vector.

and I use your code as
int max_num_devices = Context::getDeviceCount();
int actual_num_devices = std::min( max_num_devices, std::max( 1, max_num_devices ) );
std::vector devs(actual_num_devices);
for( int i = 0; i < max_num_devices; ++i ) devs[i] = i;
rtContext->setDevices( devs.begin(), devs.end() );
the error is still the same.

what can I do to deal with it?

I’m bumping this thread because I experienced the same “cuGLGetDevices Unknown error” problem today: my system (which also has a low-performance integrated graphic processor besides the NVIDIA one) was using the integrated graphic processor by default instead of the NVIDIA one.

I went into the NVIDIA Control Panel and changed

3D settings->Preferred Graphic Processor

to the NVIDIA one.

The error then disappeared. If you don’t have another graphic processor aside from the NVIDIA one then you should be all set and you won’t even have the “Preferred Graphic Processor” option in the NVIDIA Control Panel.

Regarding sienaiwun’s error: I also have only one NVIDIA card, but some systems come with pre-installed integrated graphics as well. Take a look at your control panel and verify to be sure that the error is actually caused by something else.