4

I've got a custom kernel executing through ViennaCL with an OpenCL backend. While I know how to benchmark ViennaCL in general (provided in the docs) and how to execute an OpenCL kernel execution time when it is directly executed with events (both covered in OpenCL documentation and in abundant examples on the internet), I am at a loss as to how combine the two.

Consider this example:

const char * kernel = ...; // some kernel text
viennacl::ocl::program &testProg = viennacl::ocl::current_context().add_program(kernel, "kernel");
testProg.add_kernel("TestKernel");

viennacl::ocl::kernel &TestKernel = testProg.get_kernel("TestKernel");

// provide kernel arguments, set local and global worker sizes

// START TIMING
viennacl::ocl::enqueue(TestKernel);
viennacl::ocl::get_queue().finish();
// END TIMING

What I'm coming up with so far, is using Boost timers to measure the complete time that ViennaCL takes to send data to the device through PCI-Express, enqueue and finish kernel execution. While this is acceptable (since what I'm benchmarking is very dependent on data send speed, the data is rather large), I'd also like to measure what fraction of time the actual execution of the kernel takes in this.

This is an academia project, so accurate measurements can help me to make or break my case.

Pawel J. Wal
  • 1,166
  • 1
  • 11
  • 24
  • Use the OpenCL events to measure the execution time. Data copying is not the bottleneck (shouldn't be) otherwise using OpenCL has no meaning. Do you have access to profiling mode and GetEventInfo() in ViennaCL? – DarkZeros Oct 02 '13 at 15:20
  • That's my whole problem - I know how to use events to measure time when enqueueing a kernel by hand in OpenCL, I however have no idea how to do it with the use of ViennaCL, short of ripping out and rewriting the relevant parts of it's OpenCL backend. – Pawel J. Wal Oct 02 '13 at 19:55
  • Just to let anyone who might have found this question, I haven't found an answer to this day. For this project I resorted to creating a helper class for OpenCL replicating some of the nicer functions of ViennaCL with added timing, and just using that from then on. – Pawel J. Wal Apr 24 '15 at 09:49

0 Answers0