Hi, i’m trying to set up the basic examples of JOCL, i have installed (or atleast that is what i think) all that is necesary, plus i have set up netbeans to use JOCL, but i’m getting this when i try to run the examples:
run:
Obtaining platform…
Exception in thread “main” java.lang.NullPointerException
at org.jocl.cl_context_properties.addProperty(cl_context_properties.java:67)
at Tests.JOCLSample.main(JOCLSample.java:60)
Java Result: 1
I actually think that the problem is in here:
System.out.println("Obtaining platform...");
cl_platform_id platforms[] = new cl_platform_id[1];
clGetPlatformIDs(platforms.length, platforms, null);
cl_context_properties contextProperties = new cl_context_properties();
contextProperties.addProperty(CL_CONTEXT_PLATFORM, platforms[0]);
If cl_plataforms_id[1] is null, platforms will most likely be null, however, i don’t quite get why i get that, since i think that the examples are basic programs, made mostly to see if everything is setup properly, which makes me think that i have something wrong in my setup :S any suggestions?
Indeed, this indicates that platforms[0] is ‘null’ - which means that it does not find any platform. This is strange: I think when there is no (proper) installation of OpenCL, it should report some problems much earlier.
Can you describe your current setup? (Operating System, Architecture, Driver version or OpenCL implementation…)
Indeed, this indicates that platforms[0] is ‘null’ - which means that it does not find any platform. This is strange: I think when there is no (proper) installation of OpenCL, it should report some problems much earlier.
Can you describe your current setup? (Operating System, Architecture, Driver version or OpenCL implementation…)
bye
Marco[/QUOTE]
This is even stranger, now i have one example working, and another (this one:http://www.codeproject.com/KB/recipes/opencl-part1.aspx ) that says “test : FAILED”, but everything compiles, i’m using windows 7 64 bits, my graphics card is an Radeon HD5XXX series, currently using JOCL1.3 beta.
The nullpointerexception was magically fixed after a second reboot.
Ummm… that’s just a small mistake in that sample: In the kernel code, it says
c[gid] = a[gid] + b[gid];
but the verification is done with
y = srcArrayA** * srcArrayB**;
So just change the first ‘+’ into a ‘’, or the second '’ into a ‘+’ (but not both ;)). Apart from that, it seems to work properly: OpenCL is computing the correct results.
I can not give specific remmendations, except, of course, the Programming Guides from NVIDIA and AMD. Depending on what you goal is, you might first want to play around with the samples to get a little bit more familiar with it.