[invalid] OpenCL errors on Linux with -border

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
qubodup
Posts: 31
Joined: 2009-10-07T13:11:41-07:00
Authentication code: 8675309

[invalid] OpenCL errors on Linux with -border

Post by qubodup »

Hello, I'm getting what looks like OpenCL errors:

Code: Select all

$ convert -size 99x99  caption:"t" -border 1x1 t.png
convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernels/1097.
convert: clCreateCommandQueue failed. (0) @ warning/opencl.c/InitOpenCLEnvInternal/1424.
I only noticed the error when using -border.

I'm on 64bit Arch Linux. I'm running xf86-video-ati 1:7.7.0-1 as my driver (open source AMD graphics card drivers).

I'm used to these drivers causing lots of problems, so at first I wanted to just find a way to disable OpenCL - which works - but thought the error might be worthy of reporting, simply because it seems that disabling OpenCL in my case for the problematic commands seems to increase performance significantly:

Code: Select all

$ time convert -size 800x600  caption:"test" -border 200x200 t.png
convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernels/1097.
convert: clCreateCommandQueue failed. (0) @ warning/opencl.c/InitOpenCLEnvInternal/1424.

real	0m3.785s
user	0m3.793s
sys	0m0.073s

$ time convert -size 800x600  caption:"test" -border 200x200 t.png
convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernels/1097.
convert: clCreateCommandQueue failed. (0) @ warning/opencl.c/InitOpenCLEnvInternal/1424.

real	0m3.815s
user	0m3.793s
sys	0m0.100s

$ time convert -size 800x600  caption:"test" -border 200x200 t.png
convert: clBuildProgram failed. (-11) @ warning/opencl.c/CompileOpenCLKernels/1097.
convert: clCreateCommandQueue failed. (0) @ warning/opencl.c/InitOpenCLEnvInternal/1424.

real	0m3.782s
user	0m3.787s
sys	0m0.077s

$ time MAGICK_OCL_DEVICE=OFF convert -size 800x600  caption:"test" -border 200x200 t.png

real	0m1.571s
user	0m1.597s
sys	0m0.053s

$ time MAGICK_OCL_DEVICE=OFF convert -size 800x600  caption:"test" -border 200x200 t.png

real	0m1.574s
user	0m1.583s
sys	0m0.073s

$ time MAGICK_OCL_DEVICE=OFF convert -size 800x600  caption:"test" -border 200x200 t.png

real	0m1.570s
user	0m1.573s
sys	0m0.073s
The time difference was also about 2 seconds (~12s vs ~14s) when testing the following command:

Code: Select all

convert -size 1299x9329  caption:"t" -border 2131x1231 t.png
Test system:

Code: Select all

Distro        4.6.3-1-ARCH x86_64
Mainboard     FOXCONN A7GM-S 2.0
CPU           AMD Phenom(tm) 9550 Quad-Core Processor
              4 x 2200 MHz, 64-bit
RAM           7.8G
Video         Radeon HD 7750/8740 / R7 250E
OpenGL        4.1 (Core Profile) Mesa 11.2.2, GLSL 1.30
GCC           gcc (GCC) 6.1.1 20160707
PS: imagemagick 6.9.5.2-1

EDIT: I upgraded to opencl-mesa 12.0.1-1 (was 11.2.2-1 before) and can not reproduce errors or time differences any more. Marking thread as invalid.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: OpenCL errors on Linux with -border

Post by dlemstra »

Thanks for reporting this but we are aware about this. You are seeing a big performance increase because there is a time penalty the first time when you use OpenCL. Compiling the kernel takes a while but the results will be cached for the next time you use OpenCL. The best place to use OpenCL would be in a long running program and not a single command.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply