Optix error: OPTIX_ERROR_LIBRARY_NOT_FOUND in nvidia docker while running optixHello

Hello.
I’m trying to run a project which requires cuda 11.4 and Optix 7.0 in a docker container.

I pulled from this docker image nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04 and followed this installation guide. After running cmake and make there’re some example programs in /root/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/build/bin. However I encountered this error when running one of the examples:

root@bb491c107d01:~/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/build/bin# ./optixHello 
Caught exception: OPTIX_ERROR_LIBRARY_NOT_FOUND: Optix call 'optixInit()' failed: /root/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/optixHello/optixHello.cpp:125)

This is my nvidia-smi command output in the container:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.11    Driver Version: 525.60.11    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla V100-SXM2...  Off  | 00000000:60:00.0 Off |                    0 |
| N/A   37C    P0    47W / 300W |      0MiB / 16384MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  Tesla V100-SXM2...  Off  | 00000000:B2:00.0 Off |                    0 |
| N/A   37C    P0    48W / 300W |      0MiB / 16384MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Hi @3095332731,

maybe your problem is just setting the LD_LIBRARY_PATH, see how to do that in this post: Problem running OptiX 7.6 in WSL - #8 by dhart

Let us know how it goes.

Thanks for helping and I finally found I missed the library libnvoptix.so.1 in the container,I tried to mount this library in the container and set the LD_LIBRARY_PATH, it seems to be resolved, but a new error occurred:

root@3b9d06a6b950:~/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/build/bin# ./optixHello 
[ 4][       KNOBS]: All knobs on default.

[ 2][       ERROR]: Error initializing RTX library
Caught exception: OPTIX_ERROR_UNKNOWN: Optix call 'optixDeviceContextCreate( cuCtx, &options, &context )' failed: /root/NVIDIA-OptiX-SDK-7.0.0-linux64/SDK/optixHello/optixHello.cpp:129)


My $LD_LIBRARY_PATH is /usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/lib64:/usr/lib64, and this is what I have in the LD_LIBRARY_PATH:

Hi. Probably you miss some other component or there is a version mismatch. Try ldd optixHello to see the dependencies.