Optix 7.4 cudaMallocManaged


I have been building a ray tracing application using pure CUDA, now I am trying to port it to Optix. My entire application’s GPU memory management is using cudaMallocManaged.

When I call optixAccelBuild, it complains as such:

“ERROR, “outputBuffer” does not point to memory allocated with cudaMalloc() or cuMemAlloc()”

I assumed that OptiX (at least for writing data) required cudaMalloc usage. However, my triangle data pointers are from cudaMallocManaged and the function does not throw an error. I fear that this may be a silent error.

My question is; Can OptiX API read memory from pointers that are created with “cudaMallocManaged”? (SBT (or a pointer inside of SBT), etc.)

Thanks in Advance,

We’ve discussed this yesterday and nobody has been using UVM allocations for OptiX applications, which means it’s unclear how the CUDA UVM manager would interact with the OptiX kernels. As such it’s generally not recommended to use UVM for OptiX applications at this time.

Using UVM will result in portability issues since this is mostly a Linux thing.
There are a multitude of issues when using that under Windows, as described inside the cudaMallocManaged manual.

That the optixAccelBuild() function is actually checking if the memory is managed is an indication of the potential issues.
It’s not only that the writes might be a problem because there could be issues with atomic operations, it would be catastrophic for performance if the acceleration structure memory actually doesn’t reside on device memory like it can happen under Linux and will definitely happen under Windows. We’d need to evaluate what other areas could be affected negatively.

I understand, thank you for your time