AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

[BUG] Unable to run nanovdb on cuda #1855

Open anja-sheppard opened 3 months ago

anja-sheppard commented 3 months ago

Environment

Operating System: Ubuntu 20.04 Version / Commit SHA: Using the nachovizzo version of openvdb for vdbfusion, not many substantial differences: https://github.com/nachovizzo/openvdb.git

Describe the bug

My attempts to run nanovdb/openvdb with cuda have so far been unsuccessful. I build openvdb with -DOPENVDB_BUILD_NANOVDB=ON -DNANOVDB_USE_CUDA=ON but for the example ex_raytrace_level_set the rendering code within nanovdb.cu (around line 85) is not properly executed and my rendered images are blank. Changing nothing but whether NANOVDB_USE_CUDA is defined causes the rendering to happen properly.

I dug into the backend of this rendering code a bit (namely in ex_util/ComputePrimitives.h) and noticed that none of the code in the __CUDACC__ blocks were being run. I tried #define-ing this directive in the main file for the example, but got a bunch of errors about threadIdX and such not being declared in ComputePrimitives.h--it doesn't seem like those are declared anywhere in the codebase which had me scratching my head a bit.

I'm not sure if this is a bug, but if it isn't and this is user error then some more clear documentation would be greatly helpful. I wasn't able to find much about enabling cuda in the code.