Difficulty with upgrading my application


Four years ago, I added Optix ray tracing to me OpenGL realtime dance animation program. I used Optix 3.0 and Cuda 5.0. Recently, with a newer driver, I noticed that my program no longer supports ray tracing. I am attempting to upgrade the Optix/Cuda libraries, but have run into problems.

My PC has a Quadro K2000m with a 354.13 version driver. The OS is Windows 7 64 bit. I choose Optix 3.7/Cuda 6.5 in order to maintain 32 bit compatibility with other third party libraries I need to link in.

When I get to

rtResult = rtProgramCreateFromPTXFile(rtContext, rtHDLightingProgramFileName, “ClosestHitRadiance”, &rtClosestHitProgram);

I get this error

Load LightingProgram for ClosestHitRadiance: Parse error (Details: Function “_rtProgramCreateFromPTXFile” caught exception: (string): error: Cannot parse input PTX string
HDLighting.ptx, line 7; : error : Unsupported .version 4.1; current version is ‘3.1’

I compile my .cu programs with this command

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc” -m32 -ptx -I “C:\ProgramData\NVIDIA Corporation\OptiX SDK 3.7.0\include” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin” -o HDLighting.ptx HDLighting.cu

The top of HDLighting.ptx is

// Generated by NVIDIA NVVM Compiler
// Compiler built on Fri Jul 25 04:36:16 2014 (1406288176)
// Cuda compilation tools, release 6.5, V6.5.13

.version 4.1
.target sm_20
.address_size 32

Can anyone think of what I might be doing wrong? It’s been a while since I wrote the ray tracing code and my memory is a bit rusty on some of the details.


The .version numbers in these error messages come from the CUDA compiler nvcc.
In this case it means you used a newer CUDA toolkit to compile the PTX code than the OptiX version you used it with understands.

But the release notes of OptiX 3.7.0 say that CUDA 6.5 was used to compile it and mentions support for it explicitly. That would indicate that you used and older OptiX DLL when running with the CUDA 6.5 compiled PTX code.

Check which OptiX versions was actually loaded inside the app. Here’s some code doing that for all versions:

unsigned int optixVersion;

  unsigned int major = optixVersion / 1000; // Check major with old formula.
  unsigned int minor;
  unsigned int micro;
  if (3 < major) // New encoding since OptiX 4.0.0 to get two digits micro numbers?
    major =  optixVersion / 10000;
    minor = (optixVersion % 10000) / 100;
    micro =  optixVersion % 100;
  else // Old encoding with only one digit for the micro number.
    minor = (optixVersion % 1000) / 10;
    micro =  optixVersion % 10;
  std::cout << "OptiX " << major << "." << minor << "." << micro << std::endl;

Thanks for your reply, Detlef. I forgot to update the dll when I updated the lib file. I’ve got more work, though. Setup now runs with no error, but when I attempt to render a frame

rtResult = rtContextLaunch2D(rtContext, 0 /* entry point /, WindowXkAntiAliasFactor, WindowY*kAntiAliasFactor);// Change to current window size

I get this error and a hard crash of the graphics driver.

“Context Launch 2D: Unknown error (Details: Function “_rtContextLaunch2D” caught exception: Encountered a CUDA error: result returned (700): Unknown, [6619204])”

I verified that my window size arguments are still valid and rtContext isn’t null. This code ran fine on Optix 3/Cuda 5 with an older Nvidia driver. It looks like I’ll have to simplify my cu files to find the problem.


Right, the CUDA error 700 is a general “launch failed” error which isn’t really helpful feedback from the CUDA driver and could be anything.

For example, it could be a bug inside older CUDA drivers which only happens on the newly generated code.
I would normally test more recent display drivers first. There are the 377.11 from the R375 branch and the 378.66 from the R378 branch available for your configuration. I would try them in that order.

If that doesn’t help, you’d need to debug the code itself and see if you can isolate which parts work and which don’t. I’ve provided some exception handling code, an "rtAssert"implementation, and debug printing code and tips on this forums before. The search option in the top right should be able to find these.
(Search for something, then click the “Show” link on the resulting page and limit the search to only the OptiX forum to get the relevant hits.)

It looks like I found a solution. Removing the number of models being ray traced fixed the driver crashes. I then made temporary adjustments to my program to bypass old 32 bit libraries and build with the 64 bit Optix. Now it renders all the models (less then 100 parts consisting of around 140,000 polygons).

Now I need to fix incompatibilities with newer 64 bit versions of the other libraries.

Thanks for your help.