Writing Ray Tracing Applications in Python Using the Numba Extension for PyOptiX

Originally published at: https://developer.nvidia.com/blog/writing-ray-tracing-apps-in-python-using-numba-for-pyoptix/

Using Numba and PyOptiX, NVIIDA enables you to configure ray tracing pipeline and write kernels in Python compatible with the OptiX pipeline.

Thank you for reading the post! The example outlined in this blog post was adapted from the triangle example in the OptiX package. Several modifications was made to the kernel code to address the differences in python and CUDA C++. The extension currently have several hard coded constraints on some of the API calls, such as the number of payload registers for optix.Trace. While it’s trivial to expand the lowering of these methods to support more overloads, I’m exploring a more programmatic way to provide a full support to all APIs available in optix kernel. In general, this work is in active development and I’d love to hear from you while you are playing with the demo repository.

I have a few higher level questions, my background is previously using CUDA for doing ray tracing based simulations for medical imaging and computed tomography projections.

Does OptiX lend itself to these applications? Typically summing a path integral as a trilinear interpolation through a voxellized space.

Any idea what kind of performance difference with this and a CUDA implementation?

To what numerical precision does OptiX support (float or double)?

Hi Michael!

If you are able to say, is this work still in active development? Using Numba to access the OptiX API would be a perfect workflow for a new project that I am starting. I know it is not ready for prime time yet, but it would be useful to know whether there is value in planning my work to slot in to OptiX using Numba in the future, or whether I should assume that if I want to use OptiX’s features then I should assume I’ll only ever be able to use the c++ API directly.

I ask because I noticed that there’s been no development in the PyOptiX repository since before this post was made.