mtchamengo / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

ProfileInfo, OpenCL<T> interface #122

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I need to get kernel execution time after execution of kernel using OpenCL<T> 
interface. Unfortunately method like getProfileInfoList() from OpenCL interface 
does not exist. 

Please, let me know how can I achieve this information or consider my request 
as an enhancement.

Thanks for quick feedback.

Greg Dziarmaga

Original issue reported on code.google.com by gdziarm...@gmail.com on 8 Jul 2013 at 5:14

GoogleCodeExporter commented 9 years ago
Greg

I added basic support for getProfileInfo() with r#1327

This code snippet is from the SquaresExample in the 'extensions' sample project.

 final List<ProfileInfo> profileInfo = yourBoundInterfaceToOpenCL.getProfileInfo();
 if ((profileInfo != null) && (profileInfo.size() > 0)) {
    for (final ProfileInfo p : profileInfo) { 
       System.out.println(" " + p.getType() + " " + ((p.getEnd() - p.getStart()) / 1000) + "us");
    }          
 } 

https://code.google.com/p/aparapi/source/browse/trunk/samples/extension/src/com/
amd/aparapi/sample/extension/SquareExample.java

Let me know if this works for you.

Gary

Original comment by frost.g...@gmail.com on 10 Jul 2013 at 1:52

GoogleCodeExporter commented 9 years ago
Hi,

yes your solution works very well! Thx for this;)

I have however one question. Considering your example we can imagine that I 
want to execute few methods from interface, one by one:
yourBoundInterfaceToOpenCL.meth1();
yourBoundInterfaceToOpenCL.meth2();
yourBoundInterfaceToOpenCL.meth3();

What will be result of yourBoundInterfaceToOpenCL.getProfileInfo() in that case?
ProfileInfo will be only from the last invocation, agree? To see infos from all 
three methods I should write something like this:
yourBoundInterfaceToOpenCL.meth1();
yourBoundInterfaceToOpenCL.getProfileInfo()
yourBoundInterfaceToOpenCL.meth2();
yourBoundInterfaceToOpenCL.getProfileInfo()
yourBoundInterfaceToOpenCL.meth3();
yourBoundInterfaceToOpenCL.getProfileInfo()

Am I right? 

Thank You Gary for all you did with my tickets/problems. Aparapi has really 
good support as open library:)

Greg 

Original comment by gdziarm...@gmail.com on 10 Jul 2013 at 5:23

GoogleCodeExporter commented 9 years ago
Yes. Each call to a method destroys the internal profile info for the previous. 
 So make sure you capture the Java profile info between each call. 

yourBoundInterfaceToOpenCL.meth1();
yourBoundInterfaceToOpenCL.getProfileInfo()
yourBoundInterfaceToOpenCL.meth2();
yourBoundInterfaceToOpenCL.getProfileInfo()
yourBoundInterfaceToOpenCL.meth3();
yourBoundInterfaceToOpenCL.getProfileInfo()

Thanks for testing. 

I still want to try to get access to an appropriate label (arg 1..n) for the 
profile info. So will leave this open for a while. 

Gary

Original comment by frost.g...@gmail.com on 10 Jul 2013 at 5:32

GoogleCodeExporter commented 9 years ago
Ok, thanks again.

I think I should be enough for my masters thesis:)

Br,
Greg 

Original comment by gdziarm...@gmail.com on 10 Jul 2013 at 5:34

GoogleCodeExporter commented 9 years ago
Great.  Good luck with your thesis. 

Original comment by frost.g...@gmail.com on 10 Jul 2013 at 5:40