seek opencl SOP boilerplate

   2049   3   0
User Avatar
Member
101 posts
Joined: Feb. 2015
Offline
Hi, like all of you I imagine, I'v been playing around with houdini 16 new tools ( what an update ! ) I am especially excited about the opencl SOP, but I must admit I haven't been able to do anything with it so far. I never coded an opencl kernel before, and it seems pretty “hairy” right now ( it always does that at first I guess ^^ ).
I couldn't find any example code in the docs, and I had no success with the “generate kernel” button on the sop it self.

is there an example file, or a simple working snippet somewhere ?
https://vimeo.com/user43710534 [vimeo.com]
User Avatar
Staff
6187 posts
Joined: July 2005
Offline
Unfortunately, it is hairy. Unlike VEX that can automagically bind all your attributes/parameters, OpenCL requires you to setup explicit bindings in the Bindings tab.

After you have set up your bindings you can then hit the Generate Kernel to get a sample kernel that should compile and do nothing.

Attached I have a very simple example that runs over the Cd attribute and multiplies by a scale. The scale is a float bindings, allowing you to animate it with the rest of Houdini.

More complicated examples of OpenCL can be found in HeightField Slump (for working with volumes) and Attribute Blur (for working with attributes)

Attachments:
scalecd.hip (65.5 KB)

User Avatar
Member
101 posts
Joined: Feb. 2015
Offline
Thank you so much ,
I going to check that out right away ^^
https://vimeo.com/user43710534 [vimeo.com]
User Avatar
Member
101 posts
Joined: Feb. 2015
Offline
you example seem to run ok, but I get this message when I open the hip file :

“Unable to load HFS OpenCL platform.”

I am not shure it used my video card to compute at all.
I have two pretty recent nvidia cards, it shouldn't be the issue.
I noticed there are some houdini env variables related to opencl devices.
Do I have to set their value to something corresponding to my hardware ?
https://vimeo.com/user43710534 [vimeo.com]
  • Quick Links