OpenCL Wrangle SOP: Geometry Manipulation on the GPU using OpenCL

   18030   20   3
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
This operator allows you to run an OpenCL kernel as part of your SOP network. Depending on the GPU, some operators can be orders of magnitude faster than even VEX.

In this case the OpenCL code is 144 times faster than VEX on GTX 970.

Edited by animatrix_ - Sept. 8, 2016 11:49:59
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
1737 posts
Joined: May 2006
Offline
Cool! How do the opencl geometry functions compare to vex? Is there a library of things to play with, or is it pretty much access points, that's it? Can it create/destroy geo, or is it closer in style to the old vopsop, ie modify only?

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
OpenCL library functions are pretty slim compared to VEX, i.e. no point clouds, etc. You can access point/prim/vertex/detail attributes of int/float/int array/float array, scalar/vector/matrix fields, etc. So the code is more convoluted compared to VEX, but speed bonus is always nice

You can't create new geometry without using geometry shaders which are not supported by Houdini AFAIK. So you can only modify what you have.

Hope SESI adds an OpenCL Wrangle SOP to H16.
Edited by animatrix_ - June 12, 2016 02:59:58
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
Awesome!
How did you import that in Houdini? by API?
Cheers.
Edited by Nima - June 13, 2016 18:47:45
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
No, Houdini has OpenCL support out of the box.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
So how can we use OpenCL in Houdini?
cheers.
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
Gas OpenCL DOP

The only missing thing is to be able to run OpenCL on the CPU which should still be faster than C++.

I submitted an RFE for this.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
Great!
Thanks.
User Avatar
Member
373 posts
Joined: March 2009
Offline
pusat
Gas OpenCL DOP

The only missing thing is to be able to run OpenCL on the CPU which should still be faster than C++.

I submitted an RFE for this.

http://archive.sidefx.com/docs/houdini15.0/news/13/opencl [archive.sidefx.com] << you mean this?
Ian Farnsworth
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
Thanks Ian I didn't know that. It would be nice to be able to do this directly inside Houdini using a toggle though, so it's useable in a studio environment.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
You can download the operator here:
OpenCL Wrangle SOP [dropbox.com]

Relax geometry OpenCL kernel shown in the video is included as a preset inside the HDA.

Time to put those Titans to use
Edited by animatrix_ - June 21, 2016 21:57:40
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
I added another preset for accurate smoothing of meshes. It's the same code I use in my Smooth SOP which now works in real time even for 100 iterations.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
6 posts
Joined: Dec. 2011
Offline
Thx a lot Pusat to share this !
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
Np man, enjoy it
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
8 posts
Joined: Dec. 2013
Offline
pusat
I added another preset for accurate smoothing of meshes. It's the same code I use in my Smooth SOP which now works in real time even for 100 iterations.
I have some questions.

I noticed that as I scrub back and forth on the timeline and watch the Geometry Spreadsheet window, position values change ever so slightly in both the Smooth and Relax preset examples. From my limited knowledge in this area, my understanding is that this is the nature of GPU programming and the fact that the order of kernels isn't guaranteed. Are there any precautions I'd need to take for this concurrent modification of data values? In this case it is fine given the nature of the problem, but I am just curious for things I might need to look out for as I attempt my own programming.

The point of this otl is for facilitating general purpose opencl in Houdini, correct?

What is the point of the “barrier ( CLK_LOCAL_MEM_FENCE );” in the Smooth code?

There is a “Recompile Kernel” check box, but intuitively I'd assume this should be a button. Is this doing something I'm not understanding?

Is copying memory back and forth between the device and the GPU handled automatically in opencl? I was learning a bit of CUDA and I had to handle that myself.

I hope you can shed some light on these issues. I'm not a Houdini expert but my current area of research requires the power of the GPU to show promising results.
User Avatar
Member
4495 posts
Joined: Feb. 2012
Offline
I noticed that as I scrub back and forth on the timeline and watch the Geometry Spreadsheet window, position values change ever so slightly in both the Smooth and Relax preset examples. From my limited knowledge in this area, my understanding is that this is the nature of GPU programming and the fact that the order of kernels isn't guaranteed. Are there any precautions I'd need to take for this concurrent modification of data values? In this case it is fine given the nature of the problem, but I am just curious for things I might need to look out for as I attempt my own programming.

That's because right now there is no way to have a true timeless DOPnet as a SOP node. Hopefully H16 will address this issue. So if this node was time-independent, then the results would not change from frame to frame.

Currently your best bet is to use a TimeShift SOP afterwards.


The point of this otl is for facilitating general purpose opencl in Houdini, correct?

- Yes

What is the point of the “barrier ( CLK_LOCAL_MEM_FENCE );” in the Smooth code?

https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#page=99 [khronos.org]

There is a “Recompile Kernel” check box, but intuitively I'd assume this should be a button. Is this doing something I'm not understanding?

“When loading kernels from disk the kernel is cached to avoid regenerating it every solve. Turning this on forces the re-loading and recompiling of the kernel. This is useful if #include files refer to code that has changed, or the kernel file is changed in an external text editor.

It should always be disabled when protoyping is complete.”


Is copying memory back and forth between the device and the GPU handled automatically in opencl? I was learning a bit of CUDA and I had to handle that myself.

Yes.

I hope you can shed some light on these issues. I'm not a Houdini expert but my current area of research requires the power of the GPU to show promising results.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
8 posts
Joined: Dec. 2013
Offline
pusat
I hope you can shed some light on these issues. I'm not a Houdini expert but my current area of research requires the power of the GPU to show promising results.
Thank you for your answers, they helped me get started.

One last thing, I'm having trouble getting a scalar field to work. It may just be my inexperience with houdini, but I created a volume node and added it's name as a parameter to the OpenCL wrangle node, but I get this error on the gasopencl solver.



Can you show/explain a simple setup for this? I tried merging the volume with the points, but houdini didn't like that. The field is passed in as a float array. Do I need to pass in the width/height/depth separately? If so, what would the order of the values be?

In the end, I want the node to run a calculation on each point in a set against both a volume and another set of points. In my HDK implmentation, I had 3 inputs, so I was able to do this, but I can't figure out how I would go about this with only 1 input. Merging the points seems like a bad idea because I'd need to figure out which are which and the mismatched attributes worries me.

Hopefully you can help, I understand if what I'm trying to do is complicated.
User Avatar
Member
32 posts
Joined: Aug. 2010
Offline
Hey guys,

Now that we have the OpenCL SOP, I've been playing around a bit, and I'd like to create a work buffer in local memory. Is there anyway to do this? More specifically, I want to process my P attribute (which I can access as global float *) in a local work buffer , which I would like to be a local float * of size get_local_size(0). Is there any way for me to create/allocate this local work buffer using the OpenCL SOP? It seems like the OpenCL bindings only allow me to create bindings to attributes, and kernel arguments (of int, float, float3, float4 types, and not arrays)

Thanks!
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
Did you say Attribut blur and point relax in OpenCL???

Where where ? Tell me boy please
The link are broken @animatrix_ ...
Edited by vinyvince - March 25, 2022 14:51:47
Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
8525 posts
Joined: July 2007
Online
vinyvince
Did you say Attribut blur and point relax in OpenCL???
Attribute Blur has always been OpenCL, dive inside if you are interested in code itself
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links