Hi there!
I'm currently working on a gravity simulation.
I was able to get quite good perfomance using OpenCL node, using brute force approach I'm getting around 30fps at 20 000 points.
But I want to improve the speed thurther, so I stumbled upon Barnes-Hut approximation approach, and it uses QuadTree/OctTree to minimize the amount of calculations needed.
Article on this exact problem [diglib.eg.org]
So naturally I tried to create a QuadTree using OpenCL, but run into a couple of roadblocks.
Firstly, I couldn't find any documentation on how the OpenCL implemented in Houdini, maybe i missed something?
Secondly, as far as I ubderstand, to create a QuadTree, I need to declare a certain datastructure for a node in the tree, and it needs to hold an array of points.
So I need an array of arrays, but then I try to include this variables in the main kernel, it gives an error that this variable is not bound to an attribute as i undarstand.
It works in a separate kernel it seems, but not in the main one(see the screenshot)
I would appreciate any comments.
Granted, I am absolutely not a coder, so these questions might be stupid, but I'm trying to solve this problem for a solid week now, and running out of ideas where to look for answers.
OpenCL QuadTree for N body optimisation
842 3 1- 3dsmile.cg
- Member
- 2 posts
- Joined: Aug. 2023
- Offline
- alexwheezy
- Member
- 296 posts
- Joined: Jan. 2013
- Online
Hi,
Houdini is not open source software so you won't find detailed documentation on how a feature is implemented, we can only guess or when the developers themselves can share it. We can only use official documentation and use cases in HDA, header files, etc. Perhaps you should watch official masterclasses on this subject.
Before you try to implement everything from scratch it is always worth looking for a ready-made solution who has already tried to do it before you. Here is a rather interesting implementation using OpenCL and optimisations to speed up the process.
nbody [github.com]
And lastly, always before you have a desire to rewrite something on OpenCL it is better to do performance profiling and really make sure that you have done everything possible to make some function work fast enough, sometimes even a simple algorithm change is enough.
3dsmile.cg
Firstly, I couldn't find any documentation on how the OpenCL implemented in Houdini, maybe i missed something?
Houdini is not open source software so you won't find detailed documentation on how a feature is implemented, we can only guess or when the developers themselves can share it. We can only use official documentation and use cases in HDA, header files, etc. Perhaps you should watch official masterclasses on this subject.
3dsmile.cg
Secondly, as far as I ubderstand, to create a QuadTree, I need to declare a certain datastructure for a node in the tree, and it needs to hold an array of points.
Before you try to implement everything from scratch it is always worth looking for a ready-made solution who has already tried to do it before you. Here is a rather interesting implementation using OpenCL and optimisations to speed up the process.
nbody [github.com]
And lastly, always before you have a desire to rewrite something on OpenCL it is better to do performance profiling and really make sure that you have done everything possible to make some function work fast enough, sometimes even a simple algorithm change is enough.
- 3dsmile.cg
- Member
- 2 posts
- Joined: Aug. 2023
- Offline
- ObeidaZakzak
- Member
- 117 posts
- Joined: Dec. 2019
- Offline
In Houdini 20, SideFX introduced a new syntaxe for OpenCL, similar to VEX with @-syntaxe, and they provided a documentation for this one https://www.sidefx.com/docs/houdini/vex/ocl.html [www.sidefx.com]
So it might help in case you are familiar with VEX.
So it might help in case you are familiar with VEX.
Houdini Pipeline Supervisor @ TAT Studio
-
- Quick Links