I am working on an OptiX 7.5-based wrapper library. However, adding the library in cmake project, the build is success but whenever I am running the code-base and calling functions from the library it is returning error:
/home/UserDirectory/Desktop/rt_mpi_viewer/cmake-build-release/bin/rt_mpi_viewer
[ 4][ KNOBS]: All knobs on default.
[ 4][ DISK CACHE]: Opened database: "/var/tmp/OptixCache_luciaUserDirectoryno/optix7cache.db"
[ 4][ DISK CACHE]: Cache data size: "204.4 MiB"
terminate called after throwing an instance of 'std::runtime_error'
what(): NVRTC Compilation failed.
/home/UserDirectory/Desktop/rt_mpi_viewer/rt_mpi_viewer/cuda/../../prayground/prayground.h(45): catastrophic error: cannot open source file "optix.h"
1 catastrophic error detected in the compilation of "/home/UserDirectory/Desktop/rt_mpi_viewer/rt_mpi_viewer/cuda/raygen.cu".
Compilation terminated.
Sorry to bother. It was somehow CMake error. I wondered because I could see the library could have the optix.h header, and it build success. Now I have solved this problem and working fine. Thanks for your suggestion.
[ 4][ DISK CACHE]: Opened database: "/var/tmp/OptixCache_luciano/optix7cache.db"
[ 4][ DISK CACHE]: Cache data size: "210.2 MiB"
terminate called after throwing an instance of 'std::runtime_error'
what(): NVRTC Compilation failed.
/home/luciano/NVIDIA-OptiX-SDK-7.5.0-linux64-x86_64/include/optix_7_device.h(36): catastrophic error: #error directive: Device code for OptiX requires at least C++11. Consider adding "--std c++11" to the nvcc command-line.
1 catastrophic error detected in the compilation of "/home/luciano/Desktop/rt_mpi_viewer/rt_mpi_viewer/cuda/raygen.cu".
Compilation terminated.
I have a prayground_config.h.in file which indicated in the CMakeLists root as configure_file(prayground_config.h.in prayground_config.h ) The prayground_config.h.in looks like this:
#pragma once
#define RT_MPI_VIEWER_PTX_DIR "@RT_MPI_VIEWER_PTX_DIR@"
#define RT_MPI_VIEWER_CUDA_DIR "@RT_MPI_VIEWER_CUDA_DIR@"
// Include directories
#define RT_MPI_VIEWER_RELATIVE_INCLUDE_DIRS @RT_MPI_VIEWER_RELATIVE_INCLUDE_DIRS@
#define RT_MPI_VIEWER_ABSOLUTE_INCLUDE_DIRS @RT_MPI_VIEWER_ABSOLUTE_INCLUDE_DIRS@
// Signal whether to use NVRTC or not
#cmakedefine01 CUDA_NVRTC_ENABLED
// NVRTC compiler options
#define CUDA_NVRTC_OPTIONS @CUDA_NVRTC_OPTIONS@
The Build is a success, but I cannot see the -std c++11 in prayground_config.h in build folder. I Guess that is the problem. It looks like this: