Compiler errors trying CUDA and OptiX interop

Hello,
I am trying to use CUDA for some post processing work on the OptiX ray tracing result buffers, and found that CUDA is a potential candidate.

In order to get started, I changed sample6 from the OptiXsamples as follows:

  1. added “cuda_funcs.cu” file to the folder, then tagged this file to be compiled as OBJ file in the CMakeLists.txt
  2. Then tried to call the cuda functions in cuda_funcs.cu file from the sample6.cpp file after including “cuda_runtime.h” file
  3. When compiling I get a lot (>100) errors from the “cuda_runtime_api.h” file.

Is there some kind of a compatibility issue?! for your reference I have attached the files required for compiling the sample6 project.

Within the sample6.cpp I have the following lines added: 450-478 and 547-560

FYI I am using CUDA 7.0 and Optix 3.8.0 on windows 7 system with GeForce GTX760

CMakeLists.txt (1.07 KB)
funcs_CUDA.cu (1.51 KB)
sample6.cpp (24.8 KB)

Hi. Try including cuda_runtime.h first, before any OptiX headers.

There is also an SDK sample, optixRaycasting, that post-processes an OptiX buffer using a separate CUDA runtime kernel. The OptiX part of the sample might not be relevant to what you’re doing, but it could help you chase down issues with the CUDA part.

And if you’re doing pixel-by-pixel post processing and the kernel is fairly simple, consider writing an OptiX ray generation program and attaching it as another entry point. It can process pixels instead of generating rays. This may be less boilerplate than a full CUDA kernel since you already have the OptiX context.

One other option just in case it matters for you: there is a simple builtin tonemapper as a post-processing stage in 5.0, along with a denoiser option. Check the OptiX Programming Guide in the SDK and look for the “Post-processing framework” section.

Dear Moderator dlacewell,

Thank you for your suggestions.
Including the cuda_runtime before optix headers did fix the issue.
The idea of using raygen program is very relavent in my application and I will definetly give it a try.

Thank you once again and I wish you happy Holidays and a Merry Christmas.