OpenCL on Lion

jrs's picture

Not knowing any OpenCL I was wondering if anyone could write a quick guide for getting some of the older OpenCL compositions with main functions running under lion?

When I open the OpenCL for an older composition such as "tl_opencl_particle_supershape_0.1.qtz"

It says "main should return an int" - easy

Then - "9 is too many arguments for 'main': must be 0,2, or 3" how can I fix this whilst still keeping the arguments published? I've tried changing the name of the main function as from some reading on the forums that seems to be what has to happen but still no go.

Cheers James

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Favorite Stock example compositions

This is really general info.

-1. Main was never OpenCL spec. Anything that uses a kernel named "main" needs to be replaced now, because the compiler in QC is more strict/correct.

-2. Tons of these "problems" of stuff not working right (in the case of the compiler not giving error message), is because Apple has some very bad inconsistencies in support for OpenCL among their various graphics card drivers.

-3. On the "9 is too many arguments", try changing "main" first. With error message stuff, you can gut spurious messages if one thing is wrong. Since main is incorrect to begin with, the error handling may be off base.

-4. The kernel may legitimately be written incorrectly. In that case, go find the OpenCL reference card, and search for what has been done that's wrong.

I feel like when OpenCL came out with SL, that not many people really took the time to learn it, and hence, there's a lot of compositions that are basically like Apple samples or other open sourced samples, that people got jiggered to work in QC, but since QC's compiler was overly permissive, it has resulted in a lot of bad code. In addition, many of those virtual patches that Apple littered SL with have "main" written in the kernel to this day, so the whole system can seem a little wonky, if someone is making use of something like "generate grid normals" (or whatever it's called).

I'd also look for any illegally re-assigned variables, because that used to be allowed, and isn't kosher. That's how I fixed the mesh filters that I posted up here a long time back (and if Apple's still not working for you, search around here, and dl the tweaked ones I made that will compile).