OpenCL in Jitter, part one: jit.cl.noise
Dear friends, foes and others,
Here’s my first jitter external made while experimenting how to integrate OpenCL into Jitter.
I’ve used the noise-generating OpenCL example from apple’s dev site, and tried to integrate it into an Jitter external. It seems that it works fairly well and since it is useful on its own I thought I’d share it.
It comes with three files: external, help file and .cl kernel file.
The kernel file source code is compiled on the object instantiation, so you can tweak it to generate completely different output instead of the noise. Only caveat is that you can’t change function names and parameters as these are hardcoded into external.
Many thanks to all the people posting in dev forums,
Tim for posting the new max sdk/manual which is understandable even to n00bs like me and
Jean-Marc Pelletier for making his library open-source, I learned a lot from looking at his code.
The external is mac, 10.6.2, intel only.
Source available on request.
This is a great news, Nesa. Thanks for sharing…
So this will only work under 10.6.2?
And do we need recent graphics card?
It’s compiled with 10.6 sdk, and I never tested it on anything else, so I can’t tell.
I use 2008 macbook pro with a nvidia 8600M GT, and it works nice.
What are your specs?
@efe: did it work for you?
It worked like a charm. As far as i know openCL only works with snow leopard and with certain video cards
specs: 10.6.2 nvidia GeForce 9600 GT
@nesa: are u planning to make the source code available?
congrats, amazing stuff!
Glad to hear that it works fine on your setup.
Yes, I plan to release the source code, I’d just like to figure out one more thing – how to avoid reading back to cpu and output the compute result as a jit.gl.texture.
Thanks for sharing! Here’s some info on how to grab a texture id from a jit_gl_texture as used in jit.gl.imageunit for rendering to that texture as a destination and sending onwards. It may be helpful to you. Otherwise if you come across any problems or need additional information, just let us know.
I cofirm, it doesn’t work under 10.5;
@Ad. I’m sorry that it doesn’t work for you. I still don’t know if OpenCL is supported on non-snow leopard at all, but after we get this one working I’ll try to do a research on compatibility.
Yep. AFAIK, Apple has no plans to support OpenCL pre-snowleopard, though there might be some third party working on OpenCL compilers that wouldn’t use the standard drivers to do the compilation (compiling down to assembly or translating to glsl, CUDA, or whatever). I don’t know any offhand, however.
super nice post!
I was taking a look into the openCL documentation, it seems that a ‘direct’ usage of openCL is not supported as Joshua says, to the pre-snowy thing. However, i ran into this ‘NVIDIA OpenCL JumpStart Guide’ which literally says:
Leveraging the massively parallel processing power of NVIDIA GPUs, OpenCL running on the CUDA architecture extends NVIDIA’s world-renowned graphics processor technology into the realm of parallel computing. Applications that run on the CUDA architecture can take advantage of an installed base of over one hundred million CUDA-enabled GPUs in desktop and notebook computers, professional workstations, and supercomputer clusters. NVIDIA GPUs enable this unprecedented performance via standard APIs such as OpenCL and DirectX Compute, and high level programming languages such as C/C++, Fortran, Java, Python, and .NET.
So it might be possible to use openCL within CUDA architecture. Correct me if i am wrong, but this might help to port openCL externals into old osx version or windows< ---again, some one correct me!
Can I ask on this topic – From what I’ve read, openCL allows access to processing centres (CPU/GPU/DSP) for specifically directed processing tasks (eg. nonMedia app processing on the GPU).
OK nesa, so you created an external which generates presumably white noise (audio) but you’re getting your GPU to generate it? I’m interested in openCL’s potential uses for me, but currently, because my machine has dedicated processors for audio and video, whom I want to work on what they’re dedicated to, I cannot see a use for openCL in this context.
My only thought was using openCL to direct processing of certain graphical tasks to one GPU and others to a second.
FWIW, I get "error -10 on recompute" while attempting to run it in Mountain Lion…
@diatom: the white noise here refers to a texture/matrix, not audio. But the point is it’s just data. It doesn’t care how it’s interpreted later on (so it could be turned into audio). My basic understanding is that OpenCL and CUDA are good for large numbers of parallel processes, like particle systems.
making some noise …
A. at open the patch:
– Error: Failed to built program executable
– Failed to setup compute kernel! Error -11
B. running the help patch
– Error -10 from Recompute
flying on MBP & ATI RAdeon HD 6750M
@dtr: I see yes, just data. i think i’ll start with openGL first though, until I find a system I wanna model which would benefit from gpu-processing which would otherwise be cpu-based.
Forums > Jitter