We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › OpenCL 4 Java
Page Index Toggle Pages: 1
OpenCL 4 Java (Read 6484 times)
OpenCL 4 Java
Oct 30th, 2009, 10:14am
 
Here's an example on using OpenCL for java + processing.

http://www.pixelnerve.com/v/2009/10/30/opencl-4-java/

have fun!

thanks to ruimadeira for the motivation.
Re: OpenCL 4 Java
Reply #1 - Nov 3rd, 2009, 11:53am
 
Very cool!!! So what is the main driver to port a Processing application from OpenGL to OpenCL.  I really don't know the difference... just that CL is newer.  Performance?
Re: OpenCL 4 Java
Reply #2 - Nov 3rd, 2009, 2:38pm
 
hi jeffg,

OpenCL is like a cousin to OpenGL. its a language based/like C and is to be used on a major of devices, like cpus and gpus for massice parallell computing. hopefully to be "the future" cutting out the limits of shaders  and bringing a new world for computation.

look into OpenCL at: http://www.khronos.org/opencl/
Re: OpenCL 4 Java
Reply #3 - Nov 4th, 2009, 7:56am
 
When ever I try to run the examples, it gets stuck on "vgl.ortho( WIDTH, HEIGHT );" stating that ortho(float,float,float,float) is invalid for arguments ortho(int,int).

Reading a bit on the OpenCL, it looks like it could really improve all aspects of running a sketch by utilizing the most efficient computing resources - it's sort of like CUDA as well.  Is this something that can be added where if the user has OpenCL, great.. improved performance... if not, it just doesn't use those features?
Re: OpenCL 4 Java
Reply #4 - Nov 4th, 2009, 9:29am
 
i think you need the newest Vitamin library
get it at http://www.pixelnerve.com/processing/libraries/vitamin

if you have some kind of fallback code that runs in case some device doesnt support CL it will run just fine. but thats like any other case. for example games that can use shader model 1.1 up to 3.0.
indeed it can help alot in performance. im still playing with it and testing out the capabilities.

let me know if it worked out for you.
Re: OpenCL 4 Java
Reply #5 - Nov 4th, 2009, 10:57am
 
Any chance to get a SL 10.6 working version ?  Smiley
Re: OpenCL 4 Java
Reply #6 - Nov 4th, 2009, 11:47am
 
SL 10.6 as for Snow Leopard right ?

if thats the case i dont think so. no SL mac around me for testing.
what is the problem ? maybe i can solve it using my WXP64.
Re: OpenCL 4 Java
Reply #7 - Nov 4th, 2009, 3:45pm
 
They work for me on SL.  Memo performs great, Ruimm not so much.
Re: OpenCL 4 Java
Reply #8 - Nov 4th, 2009, 4:29pm
 
My bad  Embarrassed
When i saw the requirements (ATI Stream SDK), i thought it was not compiled for Snow Leopard.

Just tried it with the latest Vitamin lib and it works just like jeffg mentioned it. Smiley

Too bad the Ati Mobility Radeon 1600XT with 256MB is not supported by OpenCL. Sad
Re: OpenCL 4 Java
Reply #9 - Feb 16th, 2010, 11:12pm
 
Updated to library version 1.4b and also the examples:

http://www.pixelnerve.com/v/2010/02/17/javacl-the-new-opencl4java/

have fun!
Re: OpenCL 4 Java
Reply #10 - Feb 17th, 2010, 9:08am
 
I saw this post on your blog and downloaded.. I got some errors.

GreeblesCL gives me an error

Quote:
available platforms:
   name: 'Apple'   profile: 'FULL_PROFILE'   Vendor: Apple'   Version: 'OpenCL 1.0 (Oct 16 2009 04:12:08)'
----------------------------------------------
Using platform: 'Apple {vendor: Apple, version: OpenCL 1.0 (Oct 16 2009 04:12:08), profile: FULL_PROFILE, extensions: []}'
Device 'GeForce 9600M GT'
     maxWorkItemSizes = [512, 512, 64]'
     maxWorkGroupSize = 512
Device 'GeForce 9400M'
     maxWorkItemSizes = [512, 512, 64]'
     maxWorkGroupSize = 512
Device 'Intel(R) Core(TM)2 Duo CPU     T9900  @ 3.06GHz'
     maxWorkItemSizes = [1, 1, 1]'
     maxWorkGroupSize = 1
Loading CL Program: /Applications/Processing.app/Contents/Resources/Java/libraries/JavaCL/examples/G
reeblesCL/data/MyProgram.cl

com.nativelibs4java.opencl.CLBuildException: Compilation failure ! (code = -11)
kernel referenced an external function __sind, that could not be found.
     at com.nativelibs4java.opencl.CLProgram.build(CLProgram.java:238)
     at GreeblesCL.loadProgramAndCompile(GreeblesCL.java:393)
     at GreeblesCL.setup(GreeblesCL.java:151)
     at processing.core.PApplet.handleDraw(PApplet.java:1402)
     at processing.core.PApplet.run(PApplet.java:1327)
     at java.lang.Thread.run(Thread.java:637)
Failed to load and compile Kernel program.


dataSize: 161604
java.lang.NullPointerException
(ShaderGLSL)  Loading GLSL vertex shader: /Applications/Processing.app/Contents/Resources/Java/libraries/JavaCL/examples/G
reeblesCL/data/vtf_v.glsl
(ShaderGLSL)  Loading GLSL fragment shader: /Applications/Processing.app/Contents/Resources/Java/libraries/JavaCL/examples/G
reeblesCL/data/vtf_f.glsl
(ShaderGLSL)  Shader was compiled sucessfully! 1

(ShaderGLSL)  Error occured with object parameter: 0

Invalid memory access of location 0x0 eip=0x86816856


OpenCLTryout gives me this error on line:
FloatBuffer particleMemTemp = memOut.map( queue, CLMem.MapFlags.Read );

Quote:
available platforms:
   name: 'Apple'   profile: 'FULL_PROFILE'   Vendor: Apple'   Version: 'OpenCL 1.0 (Oct 16 2009 04:12:08)'
----------------------------------------------
Using platform: 'Apple {vendor: Apple, version: OpenCL 1.0 (Oct 16 2009 04:12:08), profile: FULL_PROFILE, extensions: []}'
Using device 'GeForce 9600M GT'
     maxWorkItemSizes = [512, 512, 64]'
     maxWorkGroupSize = 512
Using device 'GeForce 9400M'
     maxWorkItemSizes = [512, 512, 64]'
     maxWorkGroupSize = 512
Using device 'Intel(R) Core(TM)2 Duo CPU     T9900  @ 3.06GHz'
     maxWorkItemSizes = [1, 1, 1]'
     maxWorkGroupSize = 1
java.lang.RuntimeException: Failed to create an OpenCL context based on the current OpenGL context

Exception in thread "Animation Thread" java.lang.NullPointerException
     at OpenCLTryout.draw(OpenCLTryout.java:351)
     at processing.core.PApplet.handleDraw(PApplet.java:1425)
     at processing.core.PApplet.run(PApplet.java:1327)
     at java.lang.Thread.run(Thread.java:637)
Re: OpenCL 4 Java
Reply #11 - Feb 18th, 2010, 3:59am
 
I have updated the examples to fix these errors. It should be fine.

TODO! Check for double-precision. Some cards crash when using double-precision values, so make sure you are setting up your values as floating-point.

Download it from the same place, stated above.

Have fun!
Re: OpenCL 4 Java
Reply #12 - Mar 5th, 2010, 8:32pm
 
Hi, I'm running your OpenCL library and the memo example runs, but the rui one does not. I'm getting the following error:

Invalid memory access of location 0x2b eip=0x923d141a

Any hints on what might be causing this would be greatly appreciated. Thanks.
Re: OpenCL 4 Java
Reply #13 - Mar 6th, 2010, 12:18am
 
nice, thanks for sharing! Smiley need to check this out soon.
Re: OpenCL 4 Java
Reply #14 - Mar 6th, 2010, 6:18am
 
Hi gneumatic,
I haven't updated the ruimm example so i wouldn't really know what's going on. You should move to the newest version and the new examples anyway, i've fixed quite few things, and it should be enough to get you started.

have fun
Page Index Toggle Pages: 1