Jump to content
art3mis

Converting VEX to OpenCL

Recommended Posts

Hi

My understanding is that VEX runs entirely on the CPU. But with the right hardware (ie latest Pascal based GPU)  the same functionality in OpenCl could be magnitudes faster.

Is anyone aware of any OTL or other project which have converted VEX code to OpenCL?

 

Share this post


Link to post
Share on other sites

There are some concepts shared but OpenCL is an entirely different beast. That's like asking how to power a gasoline car with batteries. There are electric cars but they're completely different from gasoline powered cars.

  • Like 1

Share this post


Link to post
Share on other sites

Much of VEX functionality is actually implemented as C++ code interacting with Houdini's and Mantra libraries and most importantly data structures. Reimplementing them so they can be called from OpenCL wouldn't be trivial and most probably would ruin OpenCL performance. Compiling VEX code without calls to built-in functions other than math expression, so that it can be evaluated on OCL device would't be hard at all AFAIK - thanks to LLVM, which compiles code to intermediate format anyway, but the functionality would be very very limited and I doubt in any benefits. 

There are rare cases, like filter like kernels when OCL has big advantage. It's like 2% of all use cases. 

Are you really so advanced in using VEX so that VEX performance slows you down?  There is always C++ waiting. 

Share this post


Link to post
Share on other sites

That is an interesting example but I get errors on my system and it does not work. It even converted my desktop into a basic color scheme, for some reason..? The Gas OpenCL node is in an error state. If I click Generate Kernel I do see some cooking message but then it returns to an error state.

 

Edited by Atom

Share this post


Link to post
Share on other sites

@Atom,  Generate Kernel button simply makes template based on parameter setup. Normally, it pops window with text for copy-pasting. Well, I can't do much there, since I also have no idea how the whole thing works. Hope to see more comprehensive examples of utilizing Gas OpenCL in future Houdini builds.

Edited by f1480187

Share this post


Link to post
Share on other sites
On 12/21/2016 at 8:33 PM, f1480187 said:

hey, thanks for sharing this file, I was having trouble with my implementation and good to see yours.

Plus that openCL approach is amazing!!!

 

opencl_reaction_diffusion.gif

Here is 2D reaction diffusion in VEX (from "VEX in Houdini") and OpenCL. Also check "Grains" masterclass and it's OpenCL ripples example.

opencl_reaction_diffusion.hipnc

 

Share this post


Link to post
Share on other sites

Since I was working with the new H16 height fields, I re-implemented the reaction diffusion using those rather than points. I also did it without DOPs, using just an openCL within a SOP solver.
I've attached a new file.

reactionDiffusion.hip

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, Daryl Dunlap said:

Thanks for that sample file, it took me a few hours, but I finally understand the OpenCL SOP and the data I/O between Houdini and the GPU

Maybe 3 scene files(in comments) from this video will be useful too(sadly russian,very good quick start).

p.s 
It will also be useful to look inside Attribute Blur(principle of organization of variables with various input data types) and HeightFiledErode(principle of operation with volumes via openCL)nodes.And inside files in /opt/hfs16.0/houdini/ocl/

 

Edited by Iskander

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×