Crash in rtBufferCreate() using Ubuntu 16.04

I get a crash when running any optix SDK programs on my Gigabyte P57 laptop running Ubuntu 16.04.3 LTS. For instance:

/data/Code/build_optix_sdk/bin$ ./optixHello
pure virtual method called
terminate called without an active exception
Aborted (core dumped)

Running inside gdb results in this stack trace:

#0 0x00007ffff4f71428 in __GI_raise (sig=sig@entry=6) at …/sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff4f7302a in __GI_abort () at abort.c:89
#2 0x00007ffff6ac88e7 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#3 0x00007ffff6abea9a in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#4 0x00007ffff6abeac2 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#5 0x00007ffff6ac9792 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#6 0x00007ffff5f1492b in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#7 0x00007ffff5f14f67 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#8 0x00007ffff5f13e4a in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#9 0x00007ffff5ebf932 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#10 0x00007ffff5a87d7f in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#11 0x00007ffff5a92b43 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#12 0x00007ffff5a19ba1 in ?? () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#13 0x00007ffff59be676 in rtBufferCreate () from /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/
#14 0x0000000000405f76 in main (argc=1, argv=0x7fffffffde18) at /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/SDK/optixHello/optixHello.cpp:93

Line 93 of optixHello.cpp is:

    RT_CHECK_ERROR( rtBufferCreate( context, RT_BUFFER_OUTPUT, &buffer ) );

so the function rtBufferCreate() is crashing.

My driver version is 384.90. I set LD_LIBRARY_PATH="/usr/lib/nvidia-384". The output of optixDeviceQuery is:

OptiX 4.1.1
Number of Devices = 1

Device 0: GeForce GTX 1060
Compute Support: 6 1
Total Memory: 6367739904 bytes
Clock Rate: 1670500 kilohertz
Max. Threads per Block: 1024
SM Count: 10
Execution Timeout Enabled: 1
Max. HW Texture Count: 1048576
TCC driver enabled: 0
CUDA Device Ordinal: 0

Constructing a context…
Created with 1 device(s)
Supports 2147483647 simultaneous textures
Free memory:
Device 0: 5889589248 bytes

ldd returns; /data/Code/build_optix_sdk/bin$ ldd ./optixHello => (0x00007ffd1ac50000) => /data/Code/build_optix_sdk/lib/ (0x00007f6172528000) => /data/Code/NVIDIA-OptiX-SDK-4.1.1-linux64/lib64/ (0x00007f61702c9000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616ff47000) => /lib/x86_64-linux-gnu/ (0x00007f616fd31000) => /lib/x86_64-linux-gnu/ (0x00007f616f967000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616f71f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616f4b0000) => /usr/lib/nvidia-384/ (0x00007f616f20c000) => /lib/x86_64-linux-gnu/ (0x00007f616ef03000) => /lib/x86_64-linux-gnu/ (0x00007f616ece6000) => /lib/x86_64-linux-gnu/ (0x00007f616eae2000)
/lib64/ (0x00007f6172802000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616e7a8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616e598000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616e392000) => /usr/lib/nvidia-384/ (0x00007f616e162000) => /usr/lib/nvidia-384/ (0x00007f616de94000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616dc72000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616da60000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616d85c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f616d656000)

Does anyone have an idea what is wrong, or a way to diagnose the problem?

Hi Philip, this could be tough to diagnose remotely, but one thing to try is the optixConsole sample, which does not bring up a GUI window. If that works, then the problem is mostly likely related to the GL setup on your system.

If you get that far, the next thing I would try is to stop using LD_LIBRARY_PATH to point to the GL libraries from the driver, and instead install the driver libraries to the standard places, e.g., /usr/lib/x86_64-linux-gnu/ This may require an uninstall/reinstall of the driver. Did you perhaps do a custom install to get them into the /usr/lib/nvidia-384 path?

Good luck with it.

Thanks for this, it is true that there is something non-standard in my install, and I should probably rebuild my OS at some point to clean it up. However the /usr/lib/nvidia-384 folder was created automatically by the “deb (local)” Cuda install option for Ubuntu. Anyway, a colleague and I narrowed down the problem using strace, and found a message towards the end of the strace log indicating permission denied for a file. It turned out that the .nv/ComputeCache folder was owned by root, and this was causing the problem. Removing this folder fixed the problem. I’m not sure how this would cause the “pure virtual method called” problem, but somehow it did.