Optix and Optix Prime

I wanted to compare the runtime of ray tracing with and without GPU. At first, I installed the latest edition of Optix. But after working on it for a while, I found out that there’s no CPU fallback. Should I go for Optix Prime instead? What are the differences between Optix and Optix Prime? Are there any good examples out there to study from? Thank you in advance.

Hi @eugenechu98, welcome.

OptiX Prime is an older ray-casting only API, and it does not make use of the RTX hardware. OptiX 7.2 is the current version of OptiX that makes full use of the RTX hardware acceleration features and supports multi-level instancing, motion blur, and programmable shading. OptiX does not have a CPU fallback, you would need to implement a CPU renderer separately.

Of course, there’s no one single way to compare GPU ray tracing to CPU ray tracing, nor is there one single answer as to the runtime of each, and it could take years of work to compare them fairly and carefully. But there are quite a few companies, as well as some open source projects, that have built both kinds of renderers and have published various benchmarks and comparisons. Unless you have a very specific feature list you need to compare yourself, I would recommend doing a comprehensive survey of what others have found before diving into a project to try to implement both.

Obviously on the OptiX team we are biased and believe strongly in the benefits of GPU ray tracing, however there are certain kinds of scenes & data & features where CPU ray tracing has major advantages. If you have specific features in mind, we’d be happy to discuss some of the known tradeoffs, and/or try to point you in the direction of research that demonstrates what kinds of things work well on SIMD machines vs CPU multi-threading.


David.

1 Like

Dear David,

Thank you for your quick reply, I will briefly explain my case here. I’m pursuing a telecommunication degree and my project here is to try and implement ray tracing into doing radio propagation. The first phase of my project is to do something like a simple iterative line-triangle intersection program to demonstrate the gpu capability. I just want to launch rays from a source throughout a space with several objects with simple dimensions(cube, sphere), then place a receiver somewhere around the space and observe the results. The rays should reflect around the surface of the object and any ray that hits the receiver will be counted. I’m not trying to research if GPU or CPU computing is better. I just need to demonstrate that I got my GPU to work and I can have results to support my theory. I’m not doing much of the graphical programming (eg. shadowing, phong, shader). I believe Optix is much more scalable and customizable so I proposed it to my advisor. Is Optix suitable for this case?

Regards,
Chu Iou Jeng

Yes, you could use OptiX for this kind of radio simulation easily. There are other OptiX users doing simulations very similar to what you describe. I think you could demonstrate the feasibility of this by using or making minor modifications to the samples we provide with the OptiX SDK.

By the way, you might know this already, but just in case it helps you get a head start – if your receiver is large (like a sphere surrounding the scene) then tracing rays starting at the source can be relatively efficient. But if the receiver is small then the probability of rays hitting the receiver can be very low, and a lot of work might be wasted. There is a lot of research into this problem in the ray tracing community, so it’s worth studying. We even have some examples in the OptiX SDK: the optixPathTracer sample might be a reasonable place to start. The idea is to trace rays backwards starting from the receiver, not the source. When you hit any surfaces with a ray cast from the receiver, connect a reflecting ray to the source and compute the amount of signal received using a reflection function. (It’s mathematically the same function you would use to compute a reflected ray’s direction if you start from the source and reflect rays off of any surfaces you hit.) For example, imagine you’re rendering an image, then the source is the light, and the receiver is the camera. In rendering we usually start rays from the camera and work backwards to the light, because it’s much more efficient.


David.

So from what I understand, you’re suggesting me to use Optix Prime if I want to implement CPU fallback to compare the differences between CPU and GPU computing, is that right? May I know which samples you are talking about, because so far what I see from all the samples included are related to graphics programming. If I’m using the Optix 7, how do I differentiate Optix Prime from Optix? What examples are built from OptixPrime ?

Alright, I will look into the optixPathTracer example that you mentioned. I know there’s a way to do it, I just don’t understand how the code works, I will put some time into researching it.

Regards,
Chu Iou Jeng

you’re suggesting me to use Optix Prime if I want to implement CPU fallback to compare the differences between CPU and GPU computing, is that right?

No, sorry, OptiX Prime is not a CPU fallback. OptiX Prime runs only on the GPU, but it does not take advantage of the RTX hardware acceleration on newer GPUs. OptiX 7 also use the GPU, and it additionally makes use of the RTX hardware units. If you are starting a new project using OptiX, we recommend starting with the lastest version of OptiX, which is currently OptiX 7.2.

It’s true that our examples are all related to graphics programming. Radio simulation in OptiX can be achieved using graphics programming techniques, that’s really what I was hoping to communicate. You can take one of the OptiX samples, and with very little code change, modify the physical units of simulation from visible light colors to radio frequencies. Light & radio are just two special cases of EM radiation, after all.

It’s not required to learn or use graphics techniques, I just wanted to make you aware that you can use them for what you’re doing, and it might save a lot of work and also make your simulation far more efficient. Because it’s easy to start from a graphics program and convert it into a radio simulation, you may be able to borrow an existing sample or renderer instead of starting from scratch.


David.

1 Like

I forgot to answer this question:

If I’m using the Optix 7, how do I differentiate Optix Prime from Optix? What examples are built from OptixPrime?

OptiX Prime is included with the OptiX 6.5 SDK download. OptiX 7.2 is a separate download and does not include OptiX Prime. Also, all the examples that use OptiX Prime are prefixed with the name “prime”.


David.

So there’s no way to run Optix if my computer has no GPU ?

Regards,
Chu Iou Jeng

That’s correct, OptiX is only built for GPU ray tracing.


David.

Okay, thank you very much for your time and effort for answering my questions. I will work on Optix for a day or two first. I will contact you again if I have any questions.

Thank you and take care.

Regards,
Chu Iou Jeng

I’m sorry, I was completely wrong. Detlef reminded me that OptiX Prime does have a CPU fallback.

https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#prime#context


David.

Alright, thank you for your reply. Will work on it and see how it goes.

Regards,
Chu

While that CPU mode existed in that discontinued API, it’s meaningless to be used in GPU vs. CPU benchmark comparisons because it’s far from optimal.
You should just not use OptiX Prime anymore and definitely not on RTX boards.

For radio transmission ideas see this comment.
https://forums.developer.nvidia.com/t/sphere-intersection-with-ray-distance-dependent-radius/60405/6
Ignore what I said about the “cone spread angle” there. That should work without such a differential approach when considering the full reflection hemispheres. It’s just like a direct lighting algorithm with the receiver’s being the lights.

Hi Detlef,

Is the discontinued API with CPU fallback still available? If yes, which version will that be? I’m just curious and I want to try it out. For your information, I do not own a RTX card. I am currently using gtx Titan X, so the RTX capabilities are not available for me.

Regards,
Chu

Yes, in versions before OptiX 7.0.0.
Use the OptiX SDK 6.5.0 which is the most recent SDK release with both the older OptiX ray-casting API and OptiX Prime ray-intersection API.
Documentation for all of these is available online here: https://raytracing-docs.nvidia.com/

Both SDKs also contain an optixRaycasting example which shows how to do ray-triangle intersection testing only with the full OptiX API, which would use the RTX hardware and allow much more flexibility than the old OptiX Prime API, though GPU-only then.
See here: https://forums.developer.nvidia.com/t/optix-error-failed-to-load-optix-library/70671/53
Also it could be that there are issues with OptiX Prime on recent Linux drivers according to that thread, which is to be investigated internally.

Alright, I will work on it and get back to you if I have any questions. By the way, can I control the CPU fall back? What I mean is that is there a way to tell my Optix 6.5 to only run on CPU ?

Regards,

Yes, check this section of the OptiX 6.5.0 Programming Guide:
https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#prime#context
and look at the examples with the “prime” prefix inside the SDK.

Thank you for your response. I really appreciate it. I will work on it and get back to you if I encounter any issues.

Have a great weekend.

Regards,
Chu