cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bennC32
Journeyman III

Aparapi: Problems using my own compiled class files

Can't use my own compiled class files with Aparapi

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
com.amd.aparapi.classtools.ClassParseException: java.lang.NullPointerException
    at com.amd.aparapi.classtools.MethodModel.<init>(MethodModel.java:1123)
    at com.amd.aparapi.classtools.ClassModel.getMethodModel(ClassModel.java:2200)
    at com.amd.aparapi.classtools.ClassModel.getEntrypoint(ClassModel.java:2565)
    at com.amd.aparapi.classtools.ClassModel.getEntrypoint(ClassModel.java:2574)
    at com.amd.aparapi.KernelRunner.execute(KernelRunner.java:397)
    at com.amd.aparapi.Kernel.execute(Kernel.java:1354)
    at com.amd.aparapi.sample.mandel.Main.main(Main.java:274)
Caused by: java.lang.NullPointerException
    at com.amd.aparapi.classtools.MethodModel.<init>(MethodModel.java:1092)
    ... 6 more
Execution mode=JTP
FPS = 10
C32%

----------------------------------

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.

Tags (3)
0 Likes
5 Replies
gfrostamd
Staff
Staff

Aparapi: Problems using my own compiled class files

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. 

0 Likes
gfrostamd
Staff
Staff

Aparapi: Problems using my own compiled class files

@benC32

 

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/

 

 

0 Likes
bennC32
Journeyman III

Aparapi: Problems using my own compiled class files

gfrostamd,

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
javac 1.6.0_24
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
/home/ben/work/tools/jdk/bin:/home/ben/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

To convince myself that it wan't finding another java implementation I tried removing my Oracle JDK from my path

C32% PATH="/home/ben/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
C32% type java
bash: type: java: not found
C32% java
The program 'java' can be found in the following packages:
 * gcj-4.4-jre-headless
 * openjdk-6-jre-headless
 * cacao
 * gij-4.3
 * jamvm
Try: sudo apt-get install <selected package>
C32%

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.

bennC32

0 Likes
eric_caspole
Staff
Staff

Aparapi: Problems using my own compiled class files

Hi bennC32,

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.

Regards,

Eric

 

0 Likes
bennC32
Journeyman III

Aparapi: Problems using my own compiled class files

Eric,

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.

bennC32

0 Likes