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

Lenny Wang lenny at multicorewareinc.com
Fri Dec 6 21:35:19 CET 2013


On Fri, Dec 6, 2013 at 4:57 AM, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Friday 2013-12-06 03:00:09 -0600, Lenny Wang encoded:
>> >
>> > please move the opencl code from cmdutils.c into a seperate file
>> > its up to you and wei if you want the benchmarking and or listing
>> > code available from the ffmpeg tool or in a seperate tool. but
>> > opencl code should not be put in random files under ifdef, put it
>> > in seperate opencl specific files. build and link them only when
>> > opencl is available
>> >
>>
>> Sorry about the late reply.  Please review attached patch modified
>> based on Michael's suggestion, thanks.
>
>> From: Lenny Wang <lwanghpc at gmail.com>
>> Date: Fri, 6 Dec 2013 02:40:00 -0600
>> Subject: [PATCH] cmdutils & opencl: add -opencl_bench option to test and show available OpenCL devices
>>
>> ---
>>  Makefile                     |   1 +
>>  cmdutils.c                   |  54 +++++++++++-
>>  cmdutils.h                   |   6 ++
>>  cmdutils_common_opts.h       |   1 +
>>  doc/APIchanges               |   2 +
>>  doc/fftools-common-opts.texi |   4 +
>>  doc/utils.texi               |   4 +-
>>  libavutil/opencl.c           |  42 ++++++++++
>>  libavutil/opencl.h           |  16 ++++
>>  libavutil/version.h          |   2 +-
>>  tools/opencl_bench.c         | 194 +++++++++++++++++++++++++++++++++++++++++++
>>  tools/opencl_bench.h         |  37 +++++++++
>>  12 files changed, 359 insertions(+), 4 deletions(-)
>
> Uh, not yet.
>
> So, Michael suggested to move all cmdutils OpenCL code to a separate
> file. The tools directory is meant for self-contained tools, you
> should not depend on ff*/cmdutils code or even worse make ff*/cmdutils
> code depend on it.
>
> So I suggest this: you move all cmdutils OpenCL code to
> cmdutils_opencl.c/h. cmdutils_opencl.o will be linked only if OpenCL
> is detected. The opencl_options code should go in the same file as
> well (in the same or maybe in a separate follow-up patch).
>
> Function prototypes can go to a dedicated cmdutils_opencl.h file or
> stay in cmdutils.h, under #ifdef, as Michael prefers.

Fixed based on Stefano's suggestion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmdutils_opencl.patch
Type: application/octet-stream
Size: 18781 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131206/fdca4e0e/attachment.obj>


More information about the ffmpeg-devel mailing list