Forgot your password?   Click here   •   No account yet?   Please Register    •   Or login using  
EN Login
SideFX Homepage
  • Products
    • What's New in H20.5
      • Overview
      • VFX
      • Copernicus
      • Animation
      • Rigging
      • Lookdev
    • Houdini
      • Overview
      • FX Features
      • CORE Features
      • Solaris
      • PDG
    • Houdini Engine
      • Overview
      • Engine Plug-Ins
      • Batch
    • Karma Renderer
    • Compare
    • SideFX Labs
    • Partners
  • Industries
    • Film & TV
    • Game Development
    • Motion Graphics
    • Virtual Reality
    • Synthetic Data for AI/ML
  • Community
    • Forum
    • News Feed
      • Overview
      • Project Profiles
      • Houdini HIVE Events
      • Contests & Jams
    • Gallery
    • Event Calendar
    • User Groups
    • Artist Directory
  • Learn
    • Tutorials
      • Overview
      • My Learning
      • Learning Paths
      • Tutorial Library
    • Content Library
    • Tech Demos
    • Talks & Webinars
    • Education Programs
      • Overview
      • Students
      • Instructors
      • Administrators
      • List of Schools
      • Resources
  • Support
    • Customer Support
    • Help Desk | FAQ
    • System Requirements
    • Documentation
    • Changelog / Journal
    • Report a Bug/RFE
  • Try | Buy
    • Try
    • Buy
    • Download
    • Contact Info
 
Advanced Search
Forums Search
Found 29 posts.

Search results Show results as topic list.

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Dec. 13, 2024 13:43:00
w1755396536
Hello, have you solved it? I also encountered the same problem.
Hey, yes I solved it.
Make sure your CMakeLists.txt includes :
project(XXX LANGUAGES CXX CUDA)

# ------- Find CUDA -----------
find_package(CUDAToolkit REQUIRED)
string(APPEND CMAKE_CUDA_FLAGS " --extended-lambda")
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
set(BUILD_SHARED_LIBS ON)

add_subdirectory(src/Cuda)
# ------- End CUDA -----------

Then in your .cpp / .cu file make sure you have :

#define NANOVDB_USE_OPENVDB
#include <NanoVDB.h> 
#include <nanovdb/util/CreateNanoGrids.h>

nanovdb::GridHandle<nanovdb::CudaDeviceBuffer> handle = nanovdb::CreateNanoGrid(*grid); //grid is a pointer to a openvdb grid
See full post 

Technical Discussion » [HDK] Building NanoVDB grids in Houdini

User Avatar
ZephirFX
29 posts
Offline
 Sept. 4, 2024 19:24:16
Oh cool I didn't look hard enough at fvdb

The problem isn't really traversal and memory efficiency, the problem is how to convert a NanoVDB grid back into OpenVDB since Houdini can only build openvdb::Grid<T> types.

I just managed to find a solution 20x faster than the NanoToOpen function :p this will do the work for now but i'll look more into fvdb to see if there's interesting stuff.

the commit if anyone wants to dive in : https://github.com/ZephirFXEC/HNanoSolver/commit/edc5d009c9575cb3089f73dab4edc4fc55996309 [github.com]
Edited by ZephirFX - Sept. 4, 2024 19:25:50
See full post 

Technical Discussion » [HDK] Building NanoVDB grids in Houdini

User Avatar
ZephirFX
29 posts
Offline
 Sept. 4, 2024 18:56:29
PHENOMDESIGN
here are some branches on the OpenVDB github that could help. I believe one is specifically dynamic (they call it adaptive) and the fVDB which would be the new version of the GVDB. Both are branches off the main OpenVDB github.

I saw those but the adaptive openvdb branch is CPU based so unusable in my case and fvdb is python based and i'm kind of a python hater . No but i'd need to do some test as i'm really not as comfortable in python as I am in cpp.


PHENOMDESIGN
As far as transfer, have the grids already built and read/stream with text or json. I saw this in a thread in python but I definitely know you can do this in C++. So you are just transferring string data which should be super-fast.

Yes i'm not using strings as it is very inefficient but I'm traversing the tree on gpu and keeping track of active voxels and the value. Then I loop over those pair on the Host to build the grid.
See full post 

Technical Discussion » [HDK] Building NanoVDB grids in Houdini

User Avatar
ZephirFX
29 posts
Offline
 Sept. 4, 2024 15:16:34
After some test, I came up with this :
https://github.com/ZephirFXEC/HNanoSolver/blob/master/src/SOP/ReadWrite/SOP_VDBFromGrid.cpp#L114 [github.com]

That i will couple with my Kernels :
https://github.com/ZephirFXEC/HNanoSolver/issues/7 [github.com]

It's veryyyy hacky but it seems like the only solution :/ Nvidia GVDB addresses that issue by having sparse dynamic grids on the GPU but is discontinued
See full post 

Technical Discussion » [HDK] Building NanoVDB grids in Houdini

User Avatar
ZephirFX
29 posts
Offline
 Sept. 2, 2024 17:02:54
Hey folks,
I'm running computations on NanoVDB grids on the device then convert them back to OpenVDB in order to build the grid in Houdini.
This round trip Open -> Nano -> Open is really slow, especially the NanoVDB to OpenVDB part.
The HDK allows to build VDB using GU_PrimVDB by exposing
    GU_PrimVDB* buildFromGrid(GU_Detail& gdp, openvdb::GridBase::Ptr grid,
	const GEO_PrimVDB* src = NULL, const char* name = NULL)
    {
	return GU_PrimVDB::buildFromGridAdapter(gdp, &grid, src, name);
    }
which is pretty much an overload of the private function :
    static GU_PrimVDB*	buildFromGridAdapter(
			    GU_Detail& gdp,
			    void* grid,
			    const GEO_PrimVDB*,
			    const char* name);

I was wondering if there was faster way to build a grid by specifying a array of value / positions. So I could extract the necessary information of a NanoVDB grid using a kernel on the device without having to download the whole data on the host.

I already managed to build nanovdb Grids on the device, which increased the speed of the VDB From Particle node by 10x, but writting them back is really challenging.

Any help would be appreciated !
Thanks
See full post 

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 5, 2024 14:45:19
PHENOMDESIGN
Sorry I cannot help any more than this as I am not building for CUDA hardware in my code base right now.
Np

I cut a ticket to SESI, I'm waiting for them to answer since I'd rather find a solution than a workaround. But if I have no choices i'll look into those

Thanks
See full post 

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 3, 2024 09:23:17
Same issue with Cuda 12.2...

Is there some sesi specific cuda libs ? I can only find some ONNX cuda runtime provider stuff.
See full post 

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 3, 2024 08:35:03
Yes i'm building against openvdb_sesi.lib

I'll try with Cuda 12.2 and see how it goes
See full post 

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 3, 2024 05:31:10
Hey,
So I just tried and managed to compile OpenVDB / NanoVDB and the example in question :
3>------ Build started: Project: ex_openvdb_to_nanovdb_cuda, Configuration: Debug x64 ------
3>Building Custom Rule C:/Users/zphrfx/Desktop/hdk/openvdb/nanovdb/nanovdb/examples/CMakeLists.txt
3>Compiling CUDA source file ..\..\..\..\nanovdb\nanovdb\examples\ex_openvdb_to_nanovdb_cuda\openvdb_to_nanovdb_cuda_kernel.cu...
3>openvdb_to_nanovdb_cuda_kernel.cu
3>tmpxft_0000356c_00000000-7_openvdb_to_nanovdb_cuda_kernel.cudafe1.cpp
3>openvdb_to_nanovdb_cuda.cc
3>   Creating library C:/Users/zphrfx/Desktop/hdk/openvdb/build/nanovdb/nanovdb/examples/Debug/ex_openvdb_to_nanovdb_cuda.lib and object C:/Users/zphrfx/Desktop/hdk/openvdb/build/nanovdb/nanovdb/examples/Debug/ex_openvdb_to_nanovdb_cuda.exp
3>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
3>ex_openvdb_to_nanovdb_cuda.vcxproj -> C:\Users\zphrfx\Desktop\hdk\openvdb\build\nanovdb\nanovdb\examples\Debug\ex_openvdb_to_nanovdb_cuda.exe
3>Done building project "ex_openvdb_to_nanovdb_cuda.vcxproj".
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 10:26 and took 02:10.260 minutes ==========

So there's a lib missing for Cuda somewhere in the HDK, or maybe the version of OpenVDB used for Houdini isn't available for the version of cuda i'm using ?

I'm currently using Cuda v12.5 and I just saw that Houdini uses Cuda v12.2 : https://www.sidefx.com/docs/houdini/licenses/index.html [www.sidefx.com]
See full post 

Technical Discussion » [HDK] Create a NanoVDB grid using a Cuda Device Buffer ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 2, 2024 15:42:08
Hey folks, I'm struggling with some linker issues when trying to initialize a NanoVDB Grid or even convert a OpenVDB Grid to NanoVDB using a
nanovdb::CudaDeviceBuffer
instead of a
nanovdb::HostBuffer
My project is Open Source if anyone has time to dive in : https://github.com/ZephirFXEC/HNanoSolver [github.com]

Otherwise, here's some more details :
I'm following this example : https://github.com/AcademySoftwareFoundation/openvdb/tree/master/nanovdb/nanovdb/examples/ex_openvdb_to_nanovdb_cuda [github.com]

There's my code to first convert a regular GridCPtr to a const openvdb::FloatGrid then to a NanoVDB grid :
const auto densityFloatGrid = openvdb::gridConstPtrCast<openvdb::FloatGrid>(density);
// Converts the OpenVDB to NanoVDB and returns a GridHandle that uses CUDA for memory management.
auto handle = nanovdb::createNanoGrid<openvdb::FloatGrid, float, nanovdb::CudaDeviceBuffer>(*densityFloatGrid); 

Where this line to convert throws this linking error :
error LNK2019: unresolved external symbol "public: __cdecl nanovdb::GridHandle<class nanovdb::CudaDeviceBuffer>::GridHandle<class nanovdb::CudaDeviceBuffer><class nanovdb::CudaDeviceBuffer,0>(class nanovdb::CudaDeviceBuffer &&)" (??$?0VCudaDeviceBuffer@nanovdb@@$0A@@?$GridHandle@VCudaDeviceBuffer@nanovdb@@@nanovdb@@QEAA@$$QEAVCudaDeviceBuffer@1@@Z) referenced in function "private: class nanovdb::GridHandle<class nanovdb::CudaDeviceBuffer> __cdecl nanovdb::CreateNanoGrid<class openvdb::v11_0_sesi::Grid<class openvdb::v11_0_sesi::tree::Tree<class openvdb::v11_0_sesi::tree::RootNode<class openvdb::v11_0_sesi::tree::InternalNode<class openvdb::v11_0_sesi::tree::InternalNode<class openvdb::v11_0_sesi::tree::LeafNode<float,3>,4>,5> > > > >::initHandle<float,class nanovdb::CudaDeviceBuffer>(class nanovdb::CudaDeviceBuffer const &)" (??$initHandle@MVCudaDeviceBuffer@nanovdb@@@?$CreateNanoGrid@V?$Grid@V?$Tree@V?$RootNode@V?$InternalNode@V?$InternalNode@V?$LeafNode@M$02@tree@v11_0_sesi@openvdb@@$03@tree@v11_0_sesi@openvdb@@$04@tree@v11_0_sesi@openvdb@@@tree@v11_0_sesi@openvdb@@@tree@v11_0_sesi@openvdb@@@v11_0_sesi@openvdb@@@nanovdb@@AEAA?AV?$GridHandle@VCudaDeviceBuffer@nanovdb@@@1@AEBVCudaDeviceBuffer@1@@Z)
The same code works when using a nanovdb::HostBuffer.

I tried linking with every Cuda & Houdini Lib without success. I hope someone can help !

Thanks
Edited by ZephirFX - Aug. 2, 2024 15:47:01
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 Aug. 1, 2024 17:58:52
PHENOMDESIGN
Maybe none of this is speculative? Could be that it is already done and new to you.
Yes true, but I'm afraid the complexity is absolutely overwhelming for someone who's not a specialist in the field :/

PHENOMDESIGN
Nice, from what I can tell it is Taichi that is backing the Differentiability?
yess looks like it.

I started a few thing to get myself familiar with the HDK and openvdb :
https://github.com/ZephirFXEC/HNanoSolver [github.com]
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 30, 2024 16:14:16
On a less speculative note, I believe this person is working on some Differentiable Fluid Sim in Houdini : https://github.com/HinaPE [github.com]
Also there's some realllly interesting stuff on his profile.
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 23, 2024 04:38:03
Thanks for the ressources, yes I imagine OpenCL is not suitable for deep optimisations. For me it was a first step before digging deeper .
Also I take Embergen as the optimisations upper limit, I probably won't achieve that.

If anyone reading this thread is interested / want to contribute feel free to contact me !
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 21, 2024 05:45:31
PHENOMDESIGN
Inlinecpp too that you can reference in the nanovdb headers or a compiled Julia library . There will have to be some clever decomposition, abstraction, or/and multi-res.

I mean I'd rather do full on HDK than this tbh.

There's no need to have compiled Julia Libs or even implement NeuralVDB to have good performance to simulate a "realtime" or at least fast Smoke solver. I just need more control on the memory and avoid data transfer done when using nodes. I believe this is easily achievable.

How do I define performance ?
You can take Embergen as a benchmark as I believe this is peak performance for fluid solving. The guy who's working on it is really smart.


how large is the simulation domain
I'm not working on a specific simulation but on a solver, so with my current hardware I can probably go up to 500M active voxels.
So let's say a 1500^3 grid max with a 0.05 voxelscale
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 20, 2024 04:58:00
PHENOMDESIGN
Vellum Fluids is looking pretty good in Christopher Rutledge's demo:

how to use the SUPER FAST fluid and grains in Houdini 20.5 [www.youtube.com]
I mean for the amount of particles used this is extremely slow :/

PHENOMDESIGN
This channel provides a great explaination of Julia and the Spectral approach.
3D Pseudo-Spectral Navier-Stokes Solver in Julia

This looks interesting.

The thing is yes Houdini gives you that visual feedback which needed when working on Physics / Graphics stuff. But when building performance critical apps then Houdini is not powerfull enough, you'll then need to work on the HDK.
For example, every realtime-ish fluid solver are based on "Stable Fluids" algorithm by Jos Stam [www.researchgate.net] which is sadly not possible in Houdini due to poor performance and transfer when working on VDBs or native volumes.
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 19, 2024 19:41:55
PHENOMDESIGN
OHHH I forgot, there is also the Linear Solver SOP that you can use to factorize the simulation and find your sparsity etc.
yep good point, I absolutely don't understand this node tho

It seems highly specific and I think making this performant would requiere learning some really advanced linear algebra :/
Edited by ZephirFX - July 19, 2024 19:48:55
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 19, 2024 19:38:42
Well it works to put VDB data in dops yes but that node just use the VDB to init the corresponding dense field. You can't perform calculation on only VDB in dops. You can bind it to a OpenCL node but then it will be transformed back and forth.


Edited by ZephirFX - July 19, 2024 19:39:53
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 19, 2024 19:04:35
PHENOMDESIGN
ZephirFX
Nope my project is about running the simulation in SOP level using opencl & nanovdb which is not possible in microsolvers.
That is possible in DOPs. It is essentiall what DOPs is. GasOpenCL etc.

Micro solver don't use VDBs but Houdini native volumes I believe.
Also "Sparsity" in DOPs is just computed using a Gas Occupancy Mask which is just a 16^3 blocks grid around your fields ( density most of the time ).

Enabling OpenCL in any node will result in disabling Sparsity. Even if I want to go this route and using the active field as a compute mask in my opencl nodes i'd need to check for every voxels to see if i'm within the active field, which creates lots of overhead.

I've optimized many times the solver, created my own in micro solvers etc and never had that much performance than running the sim in SOP with straight VDBs and OpenCL but it's still not enough lol. I can run sim with 150M voxels only for the density field in 1sec which is wayy above the performance of DOPs already.

Edit :
Compared to the native OpenVDB node i'm 40x faster for the Project Non Divergent and 20x faster for the advection.
I'm not trying to be scientificaly accurate but it needs to look accurate enough not to be odd ahah
Edited by ZephirFX - July 19, 2024 19:11:21
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 19, 2024 18:21:05
Yes there's 5 opencl sops, I ran test using compiles blocks too but it didn't really improve performances.
For a better overview :


🟥 velocity advection
🟨 project non divergent
🟩 density advection
🟦 output

the only node besides the opencl ones are Name / blast / merge in order to create the temp field as efficiently as possible.

Are you using any GAS Microsolvers yet?


Nope my project is about running the simulation in SOP level using opencl & nanovdb which is not possible in microsolvers.
Edited by ZephirFX - July 19, 2024 18:22:37
See full post 

Technical Discussion » [OpenCL] Temporary NanoVDB Buffers ?

User Avatar
ZephirFX
29 posts
Offline
 July 19, 2024 16:18:23
After running some test it's way slower to init a field to 0 and write to it than overwriting an existing field :/
Edited by ZephirFX - July 19, 2024 16:18:44
See full post 
  • First
  • 1
  • 2
  • Last
  • Quick Links
Search links
Show recent posts
Show unanswered posts
PRODUCTS
  • Houdini
  • Houdini Engine
  • Houdini Indie
LEARN
  • Talks & Webinars
  • Education Programs
SUPPORT
  • Customer Support
  • Help Desk | FAQ
  • Documentation
  • Report a Bug/RFE
  • Sales Inquiry
LEGAL
  • Terms of Use
  • Privacy Policy
  • License Agreement
  • Accessibility
  • Responsible Disclosure Program
COMPANY
  • About SideFX
  • Careers
  • Press
  • T-Shirt Store
  • Internships
  • Contact Info
Copyright © SideFX 2025. All Rights Reserved.

Choose language