I've written a OpenCL program, when I measure this program with time in bash, it gives me the following output:
real | 0m1.141s |
user | 0m0.167s |
sys | 0m0.097s |
user+sys | 0m0.264s |
and then I measure the same program in CodeXL, it shows that the total elapsed time is 0.077s. which one is more accurate? what is the best way to measure the total elapsed time of OpenCL programs? thx.
Hello yy1990cn
What do you use in codeXL to measure your execution time?
CodeXL can profile in 2 different mode :
1) HW counter, which will give you the time spent in the GPU and only the GPU
2) API trace which will also give you the time spent in the driver/OS. In API trace you can see when you issue a specific command on host and when it was actually flushed to the GPU but also when it finished.
Here I bet you measured only the GPU execution time using codeXL, while in bash you measurethe CPU time so actually you see the overhead of the driver/OS
Ben
thanks for your reply. I use Application Timeline Trace to measure the program. the total elapsed time is 77ms, and the kernel's duration is 0.097ms