As far as I know, OpenCL is the default way (the only way?) to properly utilize GPU power in Houdini.
But writing OpenCL is just so painful. Much more than writing VEX. I understand SideFX isn't responsible for OpenCL's design, but do you think it's possible for SideFX to at least provide a library of common functions to make it slightly closer to VEX?
OpenCL libraries?
867 9 0- kodra
- Member
- 373 posts
- Joined: June 2023
- Offline
- alexwheezy
- Member
- 277 posts
- Joined: Jan. 2013
- Offline
There is already a standard library $HFS/houdini/ocl that Houdini actively uses in so many places where OpenCL is needed.
In addition, since H20.5 it is now possible to import prequel code.
Use #import for Prequel Code
Several common headers are always included. These can be brought in with either a #include or #import directive, this option will pick the latter. #import results in messier results in the Generate Code output, but can speed up caching of kernels on Windows.
In addition, since H20.5 it is now possible to import prequel code.
Use #import for Prequel Code
Several common headers are always included. These can be brought in with either a #include or #import directive, this option will pick the latter. #import results in messier results in the Generate Code output, but can speed up caching of kernels on Windows.
- PHENOMDESIGN
- Member
- 144 posts
- Joined: May 2021
- Offline
kodra
As far as I know, OpenCL is the default way (the only way?) to properly utilize GPU power in Houdini.
But writing OpenCL is just so painful. Much more than writing VEX. I understand SideFX isn't responsible for OpenCL's design, but do you think it's possible for SideFX to at least provide a library of common functions to make it slightly closer to VEX?
You can also do Karma Shaders that run on the GPU depending on how familiar you are with shader languages or nodes. They should compile to GPU.
That approach was used in the "Turbulence" video for the background clouds:
Timestamp: Starting at 33.45
Turbulence | Christopher Rutledge & Magnus Møller | Annecy HIVE 2024 [www.youtube.com]
It is worth looking at Python with vectorized numpy (included in Houdini 20+) and then something like jax with jit compilation (import) for GPU. This will let you be very specific on the GPU to CPU handling in a more semantic writing style. Also all the wonderful physics libraries in those packages that are super obtuse to do in OpenCL. Also possible to use MPI or something to do parallel compute.
I know that historically python is slow but vectorization and broadcasting speeds it up with Numpy.
Brave, Big-hearted Rebel
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
- PHENOMDESIGN
- Member
- 144 posts
- Joined: May 2021
- Offline
Also, since there is the ONNX nodes, you could just write "Device" kernels that and run on the GPU in a ML language like Pytorch etc. and then compile to ONNX for use in Houdini as GPU kernel computations as opposed to inference neural network training.
You just need to wrap the function in pytorch and convert to ONNX.
Uses for this is calculating the derivatives for physics simulations, using AD etc.
You just need to wrap the function in pytorch and convert to ONNX.
Uses for this is calculating the derivatives for physics simulations, using AD etc.
Edited by PHENOMDESIGN - July 19, 2024 13:51:55
Brave, Big-hearted Rebel
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
- jsmack
- Member
- 7981 posts
- Joined: Sept. 2011
- Offline
kodra
As far as I know, OpenCL is the default way (the only way?) to properly utilize GPU power in Houdini.
But writing OpenCL is just so painful. Much more than writing VEX. I understand SideFX isn't responsible for OpenCL's design, but do you think it's possible for SideFX to at least provide a library of common functions to make it slightly closer to VEX?
They already did make it a lot easier. It is almost like writing VEX now.
https://www.sidefx.com/docs/houdini/vex/ocl.html [www.sidefx.com]
- jsmack
- Member
- 7981 posts
- Joined: Sept. 2011
- Offline
PHENOMDESIGN
Also, since there is the ONNX nodes, you could just write "Device" kernels that and run on the GPU in a ML language like Pytorch etc. and then compile to ONNX for use in Houdini as GPU kernel computations as opposed to inference neural network training.
You just need to wrap the function in pytorch and convert to ONNX.
Uses for this is calculating the derivatives for physics simulations, using AD etc.
good luck getting the onnx node to run on gpu. I've yet to get it to find the cuda libs.
- PHENOMDESIGN
- Member
- 144 posts
- Joined: May 2021
- Offline
- tamte
- Member
- 8724 posts
- Joined: July 2007
- Offline
PHENOMDESIGN
You can also do Karma Shaders that run on the GPU depending on how familiar you are with shader languages or nodes. They should compile to GPU.
I'm not aware of SideFX exposing any shading language for Karma XPU, so I don't see how you could write your own shaders for XPU beyond building simple ones with the very limited MtlX nodegraph at the moment
Edited by tamte - July 19, 2024 17:55:37
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- PHENOMDESIGN
- Member
- 144 posts
- Joined: May 2021
- Offline
tamte
XPU beyond building simple ones with the very limited MtlX nodegraph at the moment
Yes, MaterialX not specific Karma Shaders, sorry for the confusion. But they can run on the GPU and you can load in MaterialX so you could write outside of Houdini if you wanted to.
Of note is the Storm glslfx inline USD reference as well. Maybe that works for Karma too?:
Houdini | Testing glslfx with hdStorm, Fresnel Halftone Shader [www.youtube.com]
Brave, Big-hearted Rebel
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
- tamte
- Member
- 8724 posts
- Joined: July 2007
- Offline
PHENOMDESIGNthat's pretty cool
Of note is the Storm glslfx inline USD reference as well. Maybe that works for Karma too?:
PHENOMDESIGNI inquired about Karma supporting OSL or MDL since both are shading languages that MtlX nodes tend to have code equivalent for by default, but as far as I know Karma doesn't support any of them so any support for MtlX nodes has to be explicitly written by SideFX, which limits artist's control only to the supported nodes and unfortunately MtlX node library is very poor compared to the features of any of those shading languages
But they can run on the GPU and you can load in MaterialX so you could write outside of Houdini if you wanted to.
Edited by tamte - July 19, 2024 20:10:33
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links