[gdal-dev] Antw: Re: Issues with GDAL compilation

Even Rouault even.rouault at spatialys.com
Fri Nov 6 12:22:11 PST 2015


Le vendredi 06 novembre 2015 20:58:54, Andrew C Aitchison a écrit :
> On Wed, 4 Nov 2015, Even Rouault wrote:
> > Le mercredi 04 novembre 2015 11:21:31, Matthias Benedikt a écrit :
> >> Perfect!
> >> Replacing
> >> 
> >> 
> >> #if defined(__GNUC__) && defined(__x86_64__)
> >> 
> >> with
> >> 
> >> #if 0
> >> did the trick, thanks a million!
> > 
> > I don't know if you're a C/C+ developer, but if so, perhaps you could
> > provide a patch to detect this compiler ?
> > 
> > I guess this must be something around
> > #ifdef __INTEL_COMPILER
> > 
> > but that's maybe too extreme as I hope that it is just that you use an
> > outdated version of it and that newer versions work better.
> > 
> > So perhaps something like
> > 
> > #if (defined(__INTEL_COMPILER) && __INTEL_COMPILER <=
> > buggy_version_number )
> > 
> > assuming blindlessly that the value of __INTEL_COMPILER reflects a
> > version number.
> 
> Is there a ticket for this ?

I don't think anybody created one yet.

> 
> I have (some) access to a Red Hat 6.5 machine with lots of versions
> (and subversions) of the Intel compilers, so I've had a play.
> 
> Short answer:
> This patch works on gcc, all the intel compilers I tried,
> from version 9 to v15, using the optimized code on the current
> version.
> 
> --- alg/thinplatespline.cpp.orig        2015-11-04 17:29:43.115362678
> +0000
> +++ alg/thinplatespline.cpp.new 2015-11-06 19:48:30.596759849 +0000
> @@ -162,7 +162,7 @@
>       return dist ? dist * log( dist ) : 0.0;
>   }
> 
> -#if defined(__GNUC__) && defined(__x86_64__)
> +#if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1500
> 
>   /* Derived and adapted from code originating from: */
> 

I'm a bit confused by the above. Basically the patch enables the optimization 
only for v15 or above, but in the text, you said that v9 to v15 were fine... 
But perhaps your intent was to not to worry about older versions and just put 
a minimum version, which is fine to me.
Your proposed patch isn't correct however. We must keep the initial condition 
defined(__GNUC__) && defined(__x86_64__) since it would break compilation with 
MSVC for example, and we don't want this optim to be anbled on 32 bit since 
vector instructions require SSE/SSE2 to be efficient (and base i386 compilation 
doesn't enable SSE/SSE2 instructions)

> 
> 
> Longer answer:
> 
> The optimized code also compiles (I haven't tried running it)
> on several earlier versions (1200, 1210 and later 1400
> - we need __INTEL_COMPILER_BUILD_DATE to distinguish which 1400
> versions work and which don't).

Ah ok so it was a v14.x that didn't work for Matthias ?

> 
> If there is a ticket I can put the details in it.

You can create one at https://trac.osgeo.org/gdal/newticket

> 
> Andrew C Aitchison

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list