I'm trying to profile a Java program using the JOCL OpenCL wrapper using CodeXL or the sprofile command line tool to get GPU performance counters.
OS: Mint 16 / Linux 3.11.0-12-generic
CodeXL: have tried both 1.5.5364 and 1.2.2484
Whatever I try to do, I'm getting "[application_name] is not a valid application". I've tried giving the executable as /usr/bin/java and supplying a runnable JAR through the command line arguments, and have tried giving the executable as a shell script. I can profile using CPU: time-based sampling, but no luck using any GPU profiling.
Any ideas? Cheers
The profiler will give that error if it doesn't think the executable specified is a valid executable. Can you let me know the full command line you are passing to sprofile so I can see if there is perhaps something wrong with the command line? I will also ask CodeXL QA to test this scenario to see if they also encounter some issues.
Thanks for your help. For instance:
./sprofile -O run.sh
/home/..../AMD_CodeXL_Linux_x86_64_1.5.5364/x86_64/run.sh is not a valid application
Where run.sh is:
java -jar myjar.jar myargs
which runs my kernels & tests correctly. My guess would be that it's something to do with how the JVM interacts with the OpenCL runtime?
sprofile doesn't support executing shell scripts. The correct command to use would be:
./sprofile -O java -jar myjar.jar myargs
However, CodeXL QA just informed me that this is not working in current CodeXL builds -- according to their findings, the initial "java" executable spawns a second "java" executable which then performs the OpenCL work. Currently sprofile does not currently track spawned processes like this.
We have an enhancement request in our system to add the necessary support.
For now you can try the following workaround (using an undocumented feature in the profiler):
1) If you have a file called .spdata in you home directory, delete it
2) set the CL_AGENT environment variable to the full path of the libCLProfileAgent.so in the CodeXL directory (i.e. export CL_AGENT=~/CodeXL/x86_64/libCLProfileAgent.so)
3) Execute the java command that runs the OpenCL workload
4) When it is done executing, you should have a .csv file in your home directory containing the performance counter data for each OpenCL kernel that was dispatched
Since your sample command line uses -O, if you are interested in generating the the kernel occupancy info instead of performance counter info, use libCLOccupancyAgent.so instead of libCLProfileAgent.so in step 2 above.
Since this is undocumented, it may not work as expected, but please give it a try to see if it is able to get profiler information for your application.