Kernel with argumrnt of type structures

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Kernel with argumrnt of type structures

suleman
Hi,

I am converting a OpenCL application to a Java-based version (using JOCL).
The kernel of this application has a structure type argument too,
My question is that how can we pass structure to the kernel from Java/JOCL application, or do we need to change the kernel ?

Many thanks

Reply | Threaded
Open this post in threaded view
|

Re: Kernel with argumrnt of type structures

Michael Bien

On 09/14/2011 03:51 PM, suleman [via jogamp] wrote:
> Hi,
>
> I am converting a OpenCL application to a Java-based version (using JOCL).
> The kernel of this application has a structure type argument too,
> My question is that how can we pass structure to the kernel from Java/JOCL
> application, or do we need to change the kernel ?
>
> Many thanks
>
you can pass them as ByteBuffers or generate a struct accessor with
gluegen (which is just a facade for the ByteBuffer).

julia3d uses structs in its kernels
https://github.com/mbien/jocl-demos/blob/master/src/com/jogamp/opencl/demos/julia3d/Julia3d.java#L203

https://github.com/mbien/jocl-demos/blob/master/src/com/jogamp/opencl/demos/julia3d/config.h

regards,
michael

--
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: Kernel with argumrnt of type structures

toxi
Hi Michael,

I know this is an old thread, but would it be possible for you to post the related .cfg file to generate Java classes for the structs in the julia3d config.h (or even better add it to the jocl-demos git repo? I've been studying the gluegen docs and been trying all sorts of options, but always only get empty classes & interfaces. Thanks a lot for all your efforts! Am creating a Clojure wrapper around JOCL and would love to support structs in an idiomatic way, but first need to study the gluegen translation/alignment logic more...
Reply | Threaded
Open this post in threaded view
|

Re: Kernel with argumrnt of type structures

gouessej
Administrator
I'm not sure Michael will come back here soon. Maybe send him an email.

We appreciate your initiative, Xerxes reminded us during the Siggraph that JogAmp is a set of JVM bindings, not only for Java.

As far as I know, Sven is fixing some things in JOCL. If it is really a bug, please report it.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Kernel with argumrnt of type structures

Sven Gothel
Administrator
In reply to this post by toxi
On 08/25/2012 01:26 AM, toxi [via jogamp] wrote:
> I know this is an old thread, but would it be possible for you to post the
> related .cfg file to generate Java classes for the structs in the julia3d
> config.h (or even better add it to the jocl-demos git repo? I've been studying
> the gluegen docs and been trying all sorts of options, but always only get
> empty classes & interfaces. Thanks a lot for all your efforts! Am creating a
> Clojure wrapper around JOCL and would love to support structs in an idiomatic
> way, but first need to study the gluegen translation/alignment logic more...

I I understand you properly here, 'idiomatic' is used for a
more natural integration of GlueGen into the JVM ?

AFAIK there is already a project to hook up
GlueGen w/ Java annotations, so it compiles c-header files to Java classes.
  <https://github.com/mbien/superglue/>
  <https://github.com/mbien/superglue/blob/master/testproject/src/foobar/StructGlueTest.java>

If your attempts of using GlueGen fail, pls have a look at GlueGen's unit tests.
They do include using GlueGen, i.e. creating function bindings and structs.

~Sven



signature.asc (910 bytes) Download Attachment