How to load compiled programs?

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

How to load compiled programs?

Wibowit
Hi,

I'm trying to use that feature as compilation is a lenghty process. Unfortunately I fail. Instead of loading binary I'm getting an error:
run:
Using cached kernel.
Exception in thread "main" com.jogamp.opencl.CLException$CLInvalidKernelNameException:
 unable to create Kernel with name: sort16PairsPlusLocal [error: CL_INVALID_KERNEL_NAME]
        at com.jogamp.opencl.CLException.newException(CLException.java:78)
        at com.jogamp.opencl.CLProgram.createCLKernel(CLProgram.java:406)
        at streampacker.Main.main(Main.java:96)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

Note that this exception is related to kernel creation, so it's raised a bit later than actual OpenCL program loading.

My program is here: http://www60.zippyshare.com/v/68110096/file.html

Interesting classes are: KernelsManager, and class Main, lines 74 to 100.
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Michael Bien
  take a look at:
CLProgramTest.binariesTest() and builderTest(). Those tests cover
building, rebuilding, building from binaries and serialization.

-michael


On 04/18/2011 07:53 PM, Wibowit [via jogamp] wrote:

>
> Hi,
>
> I'm trying to use that feature as compilation is a lenghty process.
> Unfortunately I fail. Instead of loading binary I'm getting an error:
> run:
> Using cached kernel.
> Exception in thread "main"
> com.jogamp.opencl.CLException$CLInvalidKernelNameException:
>   unable to create Kernel with name: sort16PairsPlusLocal [error:
> CL_INVALID_KERNEL_NAME]
>          at com.jogamp.opencl.CLException.newException(CLException.java:78)
>          at com.jogamp.opencl.CLProgram.createCLKernel(CLProgram.java:406)
>          at streampacker.Main.main(Main.java:96)
> Java Result: 1
> BUILD SUCCESSFUL (total time: 1 second)
>
>
> Note that this exception is related to kernel creation, so it's raised a bit
> later than actual OpenCL program loading.
>
> My program is here: http://www60.zippyshare.com/v/68110096/file.html
>
> Interesting classes are: KernelsManager, and class Main, lines 74 to 100.
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.jogamp.org/How-to-load-compiled-programs-tp2835385p2835385.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, visit
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Wibowit
I have implemented something very similiar to those techniques but now my program crashes JVM.

New version of project is here (along with crash logs):
http://www62.zippyshare.com/v/13793986/file.html

It crashes at CLProgramBuilder.loadConfiguration(ObjectInputStream, CLContext);

By the way, weird class hierarchy. CLProgramBuilder has public non-static methods, but there's no way to create object of type CLProgramBuilder.
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Michael Bien
should be fixed in the upcoming builds. The junit test failed to simulate a device id change (releasing the context was not sufficient, restarting the VM would have been needed).
https://github.com/mbien/jocl/commit/03ce3ff819e342b95552c1438ea1269fd30e7176

The public methods of CLProgramBuilder are exposed via its interfaces CLProgramConfiguration and CLBuildConfiguration. Its a mix of builder pattern and fluent interface. You are probably already using them in your code.

-michael

Wibowit wrote
I have implemented something very similiar to those techniques but now my program crashes JVM.

New version of project is here (along with crash logs):
http://www62.zippyshare.com/v/13793986/file.html

It crashes at CLProgramBuilder.loadConfiguration(ObjectInputStream, CLContext);

By the way, weird class hierarchy. CLProgramBuilder has public non-static methods, but there's no way to create object of type CLProgramBuilder.
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Wibowit
Yes. I have used those patterns - ie. they were used by libraries authors - but there were never such situation. You should make separate non-public class that implements such interfaces and separate class with static methods that return such interfaces implementation.

It's little work but will help in API consistency & clarity.

Also, could you add a switch or something so there's no forcing of automatic rebuilds from source? I'd like to know when sources are compiled and show that to the user.
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Michael Bien
  no need for a separate factory in a public api if there is only one
implementation. Such changes are currently low priority for me since
they don't help to simplify or fix things.

But as always feel free to fork the repository and experiment with the API.

Can you confirm the longbuffer and program binary persistence fix? We
have dedicated threads about API feedback, feel free to use them or
start new threads.

-michael

On 04/19/2011 07:33 AM, Wibowit [via jogamp] wrote:

>
> Yes. I have used those patterns - ie. they were used by libraries authors -
> but there were never such situation. You should make separate non-public
> class that implements such interfaces and separate class with static methods
> that return such interfaces implementation.
>
> It's little work but will help in API consistency&  clarity.
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://forum.jogamp.org/How-to-load-compiled-programs-tp2835385p2837598.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, visit
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Wibowit
A bit more competition in the area of Java bindings to Khronos APIs would be healthy, but I don't have enough time for now. I'm more focused of finishing my program that does BWT on GPGPU efficiently, as my master thesis depends on this.

LongBuffers and binaries persistence is now working. At least it seems to.
Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Michael Bien
  I am glad that you chose my bachelor thesis (jocl) as foundation for
your master thesis ;)

competition... Well we really don't need a fifth Java to OpenCL binding
or a third GL or AL binding (IMO of course). JOCL exposes CL completely.
If you would like to improve or simplify something providing utility
apis on top of the highlevel or lowlevel bindings would be the more
productive approach.

If you decide to contribute it back by implementing it in a forked
repository (thats what i meant as i said forking the project) - even better.

-michael

On 04/19/2011 06:15 PM, Wibowit [via jogamp] wrote:
> A bit more competition in the area of Java bindings to Khronos APIs would be
> healthy, but I don't have enough time for now. I'm more focused of finishing
> my program that does BWT on GPGPU efficiently, as my master thesis depends
> on this.
>
> LongBuffers and binaries persistence is now working. At least it seems to.

Reply | Threaded
Open this post in threaded view
|

Re: How to load compiled programs?

Wibowit
Well, maybe I've been somewhat imprecise. I've meant another binding to Java platform, not specific to Java language. I would want to make something for Scala.

There is some initiative already: http://code.google.com/p/scalacl/
But it's very unreliable. I would make something more low-level. And to make some DSL that would generate code in OpenCL. That way I could add eg generics to OpenCL :)

That's only an idea, I don't know if I ever will make it, but doing it would be fun & satisfaction.