naibaf7 / libdnn

Greentea LibDNN - a universal convolution implementation supporting CUDA and OpenCL
Other
135 stars 35 forks source link

Fix Timer can't work for OpenCL implementation. #23

Closed bikekiller closed 7 years ago

bikekiller commented 7 years ago

Timer for OpenCL implementation didn't enable profiling. Fixed it.

naibaf7 commented 7 years ago

Can you explain this in a bit more detail please?

bikekiller commented 7 years ago

@naibaf7 The Timer for OpenCL path uses clGetEventProfilingInfo() to get the value of time counter for kernel start and end, then calculates the kernel execution time according to this 2 counter value.

We should define VIENNACL_PROFILING_ENABLED to make viennacl create an cl_queue with profiling enabled, otherwise, clGetEventProfilingInfo() always get wrong counter value and Timer will not work correctly.

Caffe define the macro in greentea.hpp, I guess LibDNN missed it when porting code:)