I'm new to Aparapi and I having some trouble running my own compiled samples.
I can't seem to run the Aparapi samples in GPU execution mode using java class files I generate. The samples (e.g, mandel) work fine in JTP mode using my class files, and the work fine in both JTP and GPU mode if I use the distributed class files. The files compile cleanly, but when I try to run them in GPU mode I get the following:
C32% java -Dcom.amd.aparapi.executionMode=GPU com/amd/aparapi/sample/mandel/Main
Caused by: java.lang.NullPointerException
... 6 more
FPS = 10
Any hints or suggestions would be appreciated.
For backgoround, I have just installed the latest (V2.3) APP SDK and the examples provided with that seem to work fine. I'm using java version "1.6.0_24" on Ubuntu 10.04 64-bit.
So this is the unchanged mandel source sample form the zip install?
Which javac did you use? Was this Oracles (formerly Sun's) javac that was used to compile mandel? Or was this using the jars from the zip?
I have seen eclipse's compiler create code that we failed to disassemble (which is why we only claim support for Oracle/Suns javac).
Apologies for what looks like a bug.
I just reread your post again. Specifically "The samples (e.g, mandel) work fine in JTP mode using my class files, and the work fine in both JTP and GPU mode if I use the distributed class files."
This indicates that the class file struct is different from your javac.
I think your javac (JDK) is not the one from Oracle/Sun. I think the default JDK on Ubuntu might be gnu's gcj? Try installing Oracles javac.
This link might be useful http://www.cyberciti.biz/faq/howto-ubuntu-linux-install-configure-jdk-jre/
Thanks for your reply. I actually installed the latest JDK from Oracle prior to posting the previous note, in hopes that would help. I've gone back over it to make sure that it was using the Oracle version of javac and java and not finding some other version in my path. There doesn't appear to be any other version of java available.
Here are some details (C32% is my prompt):
C32% type javac
javac is hashed (/home/ben/work/tools/jdk/bin/javac)
C32% type java
java is hashed (/home/ben/work/tools/jdk/bin/java)
C32% javac -version
C32% java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
C32% echo $PATH
To convince myself that it wan't finding another java implementation I tried removing my Oracle JDK from my path
C32% type java
bash: type: java: not found
The program 'java' can be found in the following packages:
Try: sudo apt-get install <selected package>
So it doesn't seem like my code is being compiled and run with anything other than the latest JDK/JRE from Oracle.
Is it possible that at some lower level the latest Oracle JDK is not compatible with a previous version (from Oracle)? I could try a previous version of the JDK if I knew which one was used to develop/test Aparapi.
Please make sure you are compiling with "javac -g" when you rebuild the app. Aparapi uses the java debug info to analyze the user kernel class.
Thank you for your suggestion. You are correct in that the error in my ways was the failure to compile with the -g (debug option). I was not using the supplied Ant build file and did not notice it's use of "debug=on". Everything works fine when using -g.
I've reviewed the Aparapi home page, the README.html, and the FAQ and I didn't see any reference to this requirement (to use -g). Perhaps the section on the home page that discusses "If you want to build a sample, ..." could be ammended to point this out.
I look forward to experimenting further with Aparapi on larger examples. The more I experiment with the alternatives for using OpenCL/CUDA from Java (e..g., JCuda, JOGL, JavaCL) the more I am impressed with the simplicity and design of Aparapi.