Setting up Optix in Nsight

Hello,

I want to use Optix via Nsight since I’m using a Linux system. Unfortunately, I couldn’t find much information about including Optix to Nsight and I’m not really experienced in C/C++. Here is what I did until now:

  1. added path of 'include' and 'include/optixu' to Properties>Settings>Tool Settings>Includes
  2. unchecked all boxes in Properties>Settings>Tool Settings>Debug
  3. Properties>Settings>Tool Settings>Libraries: added 'libopitx' and 'liboptixu' to -l and the path to 'lib64' to -L
  4. added path to 'lib64' to LD_LIBRARY_PATH and CLASSPATH

I tested it on the first part of the tutorial, but now I’m ending up with this error message:

make all 
Building file: ../src/box.cu
Invoking: NVCC Compiler
/usr/local/cuda-8.0/bin/nvcc -I/home/nburkard/Downloads/NVIDIA-OptiX-SDK-5.0.0-linux64/include -I/home/nburkard/Downloads/NVIDIA-OptiX-SDK-5.0.0-linux64/include/optixu -O0 -gencode arch=compute_20,code=sm_20  -odir "src" -M -o "src/box.d" "../src/box.cu"
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/local/cuda-8.0/bin/nvcc -I/home/nburkard/Downloads/NVIDIA-OptiX-SDK-5.0.0-linux64/include -I/home/nburkard/Downloads/NVIDIA-OptiX-SDK-5.0.0-linux64/include/optixu -O0 --compile --relocatable-device-code=false -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=sm_20  -x cu -o  "src/box.o" "../src/box.cu"
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; error   : Label expected for argument 0 of instruction 'call'
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; error   : Function '_rt_potential_intersection' not declared in this scope
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 160; error   : Label expected for argument 0 of instruction 'call'
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 160; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 160; error   : Function '_rt_report_intersection' not declared in this scope
src/subdir.mk:34: recipe for target 'src/box.o' failed
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 160; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 167; error   : Label expected for argument 0 of instruction 'call'
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 167; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 167; error   : Function '_rt_potential_intersection' not declared in this scope
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 167; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 196; error   : Label expected for argument 0 of instruction 'call'
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 196; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 196; error   : Function '_rt_report_intersection' not declared in this scope
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 196; error   : Call target not recognized
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; error   : Unknown symbol '_rt_potential_intersection'
ptxas /tmp/tmpxft_000014e9_00000000-6_box.ptx, line 131; fatal   : Label expected for forward reference of '_rt_potential_intersection'
ptxas fatal   : Ptx assembly aborted due to errors
make: *** [src/box.o] Error 255

Any help would be really appreciated!

I have an idea that you may try cmake.
Optix have cmakelist

If your question is about building OptiX applications, yes, that would be easiest with the CMake approach used inside all OptiX SDK examples or the more standalone OptiX Advanced Samples on github. (Link in the third sticky post on this sub-forum. Don’t mix latter with the OptiX SDK examples. They use a different framework, GLFW instead of GLUT). All of them should build for Linux and Windows.

Compiling *.cu files with OptiX programs is not done to object files, but only to PTX source code which is then fed into OptiX via the createProgramFromPTXFile() function for example.
Your setup seems to try to compile *.cu to CUDA object code, which will fail because of the OptiX intrinsics macros (all the rti ones) which are expanded to PTX assembly and later translated by OptiX internally. Means you need to generate *.ptx files only, not CUDA object files.

Also use the SM 3.0 targets to get rid of the deprecation warning in CUDA 8.0. OptiX 5 only supports Kepler GPUs and up anyway, which are at least SM 3.0.

If you mean you want to use OptiX via Nsight to do source code debugging, that unfortunately isn’t going to work. See this post about OptiX debugging methods: https://devtalk.nvidia.com/default/topic/1026591/optix/how-could-i-debug-the-code-in-cuda-files-in-a-optix-project-/

Thanks a lot!