Trying to run optixHello from NVIDIA-OptiX-SDK-7.7.0-linux64-x86_64/SDK/optixHello

Hi,

I’ve been trying to setup Optix and run my first example. I’m using Optix 7.7 with CUDA 12. However I’m not able to compile the optixHello example.

I first went to NVIDIA-OptiX-SDK-7.7.0-linux64-x86_64/SDK/ and did “cmake .” which was successful.

  1. Then I went to NVIDIA-OptiX-SDK-7.7.0-linux64-x86_64/SDK/optixHello and did “cmake .” which errored out with:
    Unknown CMake command “OPTIX add_sample executable”.

  2. I tried to compile only the draw_solid_color.cu with nvcc but even that fails with the error “cuda/helpers.h” not found.
    I want to look at the PTX code of this simple optixHello code for understanding it’s execution.

  3. I also tried building the examples as described by INSTALL_LINUX.txt in the SDK/ folder. But when I run ./bin/optixHello I get the error
    Caught exception: OPTIX_ERROR_LIBRARY_NOT_FOUND: Optix call ‘optixInit()’ failed: /home/anaitha2/NVIDIA-OptiX-SDK-7.7.0-linux64-x86_64/SDK/optixHello/optixHello.cpp:122)

What am I doing wrong? How can I resolve these errors?

1.) The individual CMakeLists.txt of the examples inside their sub-folders are not working standalone.
Instead you build the solution for all OptiX SDK examples starting at the top-most CMakeLists.txt which is inside the OptiX SDK <version>/SDK folder. That also defines the OPTIX_add_sample_executable function used by the individual example projects.

2.) To understand how the OptiX device programs work, you should look at their *.cu files first.
OptixModule input code can be either PTX or the newer (recommended) OptiX IR binary representation since OptiX 7.5.0.
While you can look at the generated PTX code which is sometimes helpful, that is also only an intermediate representation and will be compiled and optimized to final streaming assembly (SASS) code anyway, of which you can see your own device code in that form when analyzing a kernel with the Nsight Compute profiler.
That requires some specific options described here: https://raytracing-docs.nvidia.com/optix8/guide/index.html#program_pipeline_creation#program-input

3.) OptiX 7 and 8 versions are a header-only API. All libraries required to run OptiX applications come with the NVIDIA display driver for your GPU. Each OptiX SDK version requires a minimum display driver version supporting that and all older versions. Which display driver version is required can be found inside the OptiX Release Notes (link directly below the download button for each individual OptiX version).

If your system configuration has a required NVIDIA display driver version for OptiX 7.7.0 installed and running and is still not finding the necessary OptiX driver libraries, then your configuration might be missing these components somehow.
There have been issues with Docker images not mounting the required libraries:
https://forums.developer.nvidia.com/t/libnvoptix-so-1-not-installed-by-the-driver/221704

In case you install a recent enough display driver version, you could also switch to the OptiX SDK 8.0.0 which uses the same API but offers some additional features and performance.