[FFmpeg-devel] [PATCH]opencl: automatically select the fastest opencl device

Lenny Wang lenny at multicorewareinc.com
Thu Nov 28 19:51:00 CET 2013


On Tue, Nov 26, 2013 at 6:54 AM, Lenny Wang <lenny at multicorewareinc.com> wrote:
> On Sat, Nov 23, 2013 at 1:13 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Sat, Nov 23, 2013 at 07:58:40PM +0100, Stefano Sabatini wrote:
>>> On date Friday 2013-11-22 12:53:38 -0600, Lenny Wang encoded:
>>> > On Fri, Nov 22, 2013 at 4:42 AM, Lenny Wang <lenny at multicorewareinc.com> wrote:
>>> [...]
>> [...]
>>> >      { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},      "set OpenCL environment options" },
>>> >  #endif
>>> > diff --git a/libavutil/opencl.c b/libavutil/opencl.c
>>> > index ae4c476..8654c25 100644
>>> > --- a/libavutil/opencl.c
>>> > +++ b/libavutil/opencl.c
>>> > @@ -98,7 +98,7 @@ static const AVClass openclutils_class = {
>>> >
>>> >  static OpenclContext opencl_ctx = {&openclutils_class};
>>> >
>>> > -static const cl_device_type device_type[] = {CL_DEVICE_TYPE_GPU, CL_DEVICE_TYPE_CPU, CL_DEVICE_TYPE_DEFAULT};
>>> > +static const cl_device_type device_type[] = {CL_DEVICE_TYPE_GPU, CL_DEVICE_TYPE_CPU};
>>>
>>> Unrelated?
>>>
>>> [...]
>>>
>>> I'm fine with the overall design if Michael (cmdutils.c maintainer) is
>>> OK with it. As alternative solution, a dedicated tool may do.
>>
>> it should at least be in a seperate file, cmdutils.c is not the correct
>> place for opencl benchmarking code
>>
>> [...]
>>
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> No great genius has ever existed without some touch of madness. -- Aristotle
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> Attached patch modified based on your comments, thanks for review in advance.
>
> 1. added a new generic ffmpeg-util as '-show_opencl', it performs
> tests and benchmark all available opencl devices with output showing
> device/platform indices sorted based on scores, the output can also be
> directly used for setting '-opencl_options'
> 2. added a new av_opencl_test_performance() API for ocl-util, which
> performs tests with user defined benchmark on any opencl device types
> 3. removed CL_DEVICE_TYPE_DEFAULT cause it generates duplicated device
> entries from av_opencl_get_device_list()
> 4. opencl benchmark kernel source separated as /libavutil/opencl_bench_kernel.h
> 5. cosmetics


Stefano, Michael,

Could you please take a look at last patch when you get a chance?  Thanks.


More information about the ffmpeg-devel mailing list