[gdal-dev] Re: OpenCL, GDAL, and You

Konstantin Baumann Konstantin.Baumann at autodesk.com
Mon Dec 6 07:10:12 EST 2010


Hi,

what benefit/improvement would the OpenCL integration bring to GDAL? Additional functionality or a speedup of existing functions? Probably only operations on images and/or rasters are supported; reprojection/warping and filtering would be good candidates, right? What concrete operations would be supported?

Kosta

-----Original Message-----
From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Frank Warmerdam (External)
Sent: Monday, December 06, 2010 1:43 AM
To: Seth Price
Cc: Philippe Vachon; gdal-dev; Wolf Bergenheim
Subject: [gdal-dev] Re: OpenCL, GRASS, GDAL, and You

On 10-09-23 10:09 AM, Seth Price wrote:
> Hey all, I was just wondering if there was any progress in integrating
> the OpenCL code into trunk in each project? I haven't heard anything,
> but it would be a shame to just leave the code sit, or wait until the
> code branches have significantly diverged.
> ~Seth
>

Seth,

Last week I went out and bought a new AMD/ATI machine in the hopes (amoung
other goals) that OpenCL would work on it with the ATI OpenCL SDK.
Unfortunately I have discovered that the ATI Radion 4200 HD is not supported
for OpenCL stuff.  :-(

Nevertheless, with some persistance I was able to build the ATI SDK, and
configure GDAL to build against it.  So I have integrated OpenCL support
in trunk.  It is not enabled by default, but you can enable it with the
--with-opencl directive.  If the include files and libraries are in a
non-standard location you can also use the --with-opencl-include and
--with-opencl-lib directives to configure like this:

     --with-opencl \
     --with-opencl-include=/home/warmerda/pkg/ati-stream-sdk-v2.2-lnx64/include \
 
--with-opencl-lib="-L/home/warmerda/pkg/ati-stream-sdk-v2.2-lnx64/lib/x86_64 
-lOpenCL" \

I ran into a few issues:

1) It seems the include file from ATI is <cl/opencl.h> not <OpenCL/OpenCL.h>
as it is on the Mac.  I've put a platform dependent ifdef but I don't now
what the situation will be on other machines.

2) In your get_device() function you were passing NULL in for the platform.
The online docs indicate this as an option but warn that behavior then is
platform dependent.  The ATI SDK just fails with an invalid platform error.
So I updated the code to fetch a platform id and use that.

3) On my system it falls back to using the CPU but it turns out the CPU
does not offer "image" support in my case.  I added some extra logic to
look for this capability so a better error could be reported.

4) I restructured things a bit so that the OpenCL warper case can return
CE_Warning to indicate to the high level warper that OpenCL should be
skipped and other mechanisms used.  That is what it does not if it fails
to find a suitable device, or some of the other specific checks.

5) I made a few changes to use CPLDebug instead of printf for debug output.

I haven't tried this yet on your Mac.  I avoided using the account you
kindly offered because I find the Mac is often a perverse build environment
and I didn't want to establish the "norm" based on it.  I might try it out
tonight though.

I have also not yet tried it on windows, and likely won't in the near future.
Perhaps someone else will pick up the ball there.  The code itself just
depends on having HAVE_OPENCL defined at least in the alg directory and
of course appropriate include and link options.

(cc:ed to the list so everyone is aware of the availability).

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list