Problems with HelloJOCL in ubuntu 11.10

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

Problems with HelloJOCL in ubuntu 11.10

jj93
I could get this and other variations working on an Intel i7/ NVIDIA  Win machine but when I try it on a AMD/NVIDIA Ubuntu machine running 11.10 I cant get it to work. I am using netbeans and an openCL pack plugin same as in my windows machine.

but I get an error in
 [CODE]
         InputStream vec = HelloJOCL.class.getResourceAsStream("VectorAdd.cl");
           
            CLProgram program;
            // load sources, create and build program
            program = context.createProgram(vec);
[/CODE]

or alternatively

 [CODE]
                        // load sources, create and build program
            CLProgram program
                    = context
                    .createProgram(HelloJOCL.class.getResourceAsStream("VectorAdd.cl")).build();

[/CODE]

and I get the following error

Exception in thread "main" java.lang.NullPointerException at java.io.Reader.<init>(Reader.java:78) at java.io.InputStreamReader.<init>(InputStreamReader.java:72) at com.jogamp.opencl.CLContext.createProgram(CLContext.java:286) at HelloJOCL.main(HelloJOCL.java:72)

but when I run openCL properties I get both of my platforms and
if I list all the devices it runs fine.
Reply | Threaded
Open this post in threaded view
|

Re: Problems with HelloJOCL in ubuntu 11.10

notzed
looks like it can't open the resource, which doesn't make sense.   although if you're using netbeans, since it uses ant, you need to use 'clean and build' before it includes any resources (yay for ant).

Most problems on gnu/linux are related to the LD_LIBRARY_PATH and either not finding libopencl.so, or not finding libjocl.so - but i would have thought these would show up differently.
Reply | Threaded
Open this post in threaded view
|

Re: Problems with HelloJOCL in ubuntu 11.10

jj93
Yes it cant seem to get the input stream due to ant and if I run the jar in the same directory as then I get a invalidprogramexecutable error.
Reply | Threaded
Open this post in threaded view
|

Re: Problems with HelloJOCL in ubuntu 11.10

Sven Gothel
Administrator
In reply to this post by jj93
On 01/11/2012 08:35 PM, jj93 [via jogamp] wrote:
> I could get this and other variations working on an Intel i7/ NVIDIA  Win
> machine but when I try it on a AMD/NVIDIA Ubuntu machine running 11.10 I cant
> get it to work. I am using netbeans and an openCL pack plugin same as in my
> windows machine.
>
> but I get an error in
>  [CODE]
>          InputStream vec = HelloJOCL.class.getResourceAsStream("VectorAdd.cl");

You may try gluegen's IOUtil getResource(..) method.

For example:
  URLConnection conn =
     IOUtil.getResource(UbuntuFontLoader.class, relPath+fname);

the path can be relative to the class itself in it's location,
which may be within the JAR and/or classpath,
or it can be an absolute path.

This should help.

~Sven



signature.asc (910 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with HelloJOCL in ubuntu 11.10

jj93
This post was updated on .
I couldnt get IOUtil to work with it but I used the build from string just to get it going

resulting code
http://pastebin.com/ZzJxTnMN

this runs on my optimus GPU laptop as an example of float addition.
Remember to change kernel into a float buffer one