Including Optix in Project Build Issue

Hey all!

I’m trying to build an open-source project on Windows using cmake which includes Optix, but my build runs into the following issues:

error C3861: ‘optixModuleCreateFromPTX’: identifier not found

The offending call is on line 213, however it seems to run fine through the previous parts where it defines the OptixModuleCompileOptions.

I assume there’s some library missing or something is not properly configured in cmakelists but I couldn’t figure it out so far, any insights would be very helpful!

That means that this project source was developed against an older OptiX SDK version than you’re using in your development environment. Looking at the README there, it mentions OptiX SDK 7.2 multiple times and you’re most likely using 7.7.

The OptiX API function optixModuleCreateFromPTX has been renamed to optixModuleCreate because it accepts PTX and OptiX IR input now.

The fix would be to simply rename the function inside the repository to make that part compile again.
There might be other small code adjustments necessary when porting to a newer OptiX SDK version.

Please always read the OptiX Release Notes (link directly beneath the download button of each resp. OptiX SDK version) before setting up a development environment. It describes these API changes between OptiX SDK versions.

Hey, thanks a lot for the reply! I initially installed 7.7, but then I saw that the repo used 7.2 and installed that as well - I changed the environment variable to point to 7.2, but maybe it’s still pointing towards 7.7. somewhere, I’ll explore that further!

If your development environment, esp. the graphics display driver version, already supports OptiX SDK 7.7.0, it shouldn’t be too hard to adjust the repository’s source code to work with that.

I do that with my examples all the time. You can even make that work with any OptiX SDK version by checking the OPTIX_VERSION define.
Looks like this for example:

There were some more adjustments needed you’ll find when searching for the version 70700 in that file.
Similar for earlier commits adjusting to each different OptiX SDK version.

Great, thanks for the info - as a first test I cleaned and rebooted everything, and now the environment properly points to 7.2 and it builds! I’ll take a look at upgrading to 7.7 next when I have some free time your links should help me to get started :)

BTW, looking over the code inside your screenshot, I wouldn’t set the maxRegisterCount = 100.
That’s probably a left-over from some example code and can have a runtime performance impact.
The better option is to use OptiX’ define OPTIX_COMPILE_DEFAULT_MAX_REGISTER_COUNT (= 0) instead and only touch this when deeply analyzing device kernel performance.

1 Like