I have been tasked with converting some Optix 5.0.0 code to Optix 7.0. I plan on building some Optix 7.0 code along side currently existing Optix 5.0.0 code. Can these two separate Optix codes coexist within the same CMake build?
I am not a CMake expert, having come from a Makefile background but am migrating.
You can use a different OptiX version per project inside a solution.
That is just a matter of picking the right OptiX versions for each project.
In my OptiX application frameworks that can be done by changing a find_package(OptiX<version>)
line inside the project’s CMakeLists.txt, resp. in the newest OptiX 7 examples by picking the desired OptiX include folder.
You can NOT use two different versions of OptiX inside the same project sources!
That will already clash at the OptiX root header optix.h
which has the same name but different contents in OptiX SDK 7 versions.
Also, generally speaking, how compatible is Optix 5.0.0 with Optix 7.0 ?
OptiX 7 uses a completely different explicit API. A rewrite of the host code is required
It’s a header-only API. The core implementation resides inside the display drivers.
The entry points of the API are loaded into a function table dynamically by the application.
The general OptiX device program structure is the same (no attribute programs like in OptiX 6), but variable declarations and scopes, as well as all built-in device function names are different.
OptiX 7 applications are programmed with the CUDA runtime API or CUDA driver API to do all resource management explicitly. OptiX 7 doesn’t know about multiple GPU devices or even textures. All that is done with native CUDA code which allows much more flexible and predictable application behavior.
OptiX 5 didn’t support the RT cores for hardware BVH traversal and triangle intersections present in RTX boards. There everything was a custom primitive. Support for RTX hardware was added in OptiX 6 with the GeometryTriangles nodes. This is is similar for OptiX 7, there you pick the “build input” type for triangle, curve, or custom geometric primitives.
Please find more explanations here:
https://forums.developer.nvidia.com/t/porting-to-optix-7/79249/2
https://forums.developer.nvidia.com/t/optix-7-breaking-changes/156801/2
Please follow these resources which are explicitly meant to show the difference between OptiX 5.x and OptiX 7 programs:
https://forums.developer.nvidia.com/t/optix-7-2-release/156619
https://forums.developer.nvidia.com/t/optix-advanced-samples-on-github/48410/2
Basically read all OptiX 7 related threads in this developer sub-forum. :-)
Please always read the OptiX Release Notes (link beneath the download button for each OptiX version) before setting up a development environment to use compatible CUDA toolkit and host compiler versions.