[Insight-developers] Problem with 3.14 release
Tom Vercauteren
tom.vercauteren at m4x.org
Tue Jun 2 12:35:30 EDT 2009
Hi,
>>On an intel mac, running
>> cmake -DCMAKE_OSX_ARCHITECTURES="i386;ppc64" <path_to_itk_sources>
>>works like a charm. As expected, the TRY_RUN fails to compile the sse2
>>test program which leads to setting
>> VNL_CONFIG_ENABLE_SSE2 to OFF (for all target platforms).
>>
>>However, running
>> ccmake <path_to_itk_sources>
>>and then setting
>> CMAKE_OSX_ARCHITECTURES to "i386;ppc64"
>>fails. This is because the sse2 TRY_RUN is done before setting the
>>target architecture. This leads to setting
>> VNL_CONFIG_ENABLE_SSE2 to ON (for all target platforms).
>
> Oh. Weird. That's ever worse.
>
> Would it not be even better to get rid of the TRY_RUN entirely? They
> are fundamentally at odds with cross compilation. Ideally, I'd like SSE
> on for the intel half of my libraries and off for the PowerPC half.
> Wouldn't a try-compile suffice for deciding if SSE is available?
Indeed, I also think we should get rid of the TRY_RUN entirely. That
being said, right now I don't have enough time to correctly refactor
vxl's cmake code.
> Is
> there no standard __SSE__ or something that could be #if'ed against?
Thanks for the tip! I didn't know about this preprocessor define. I
don't know how portable it is but here is the information I gathered:
gcc 4.1 and 4.3 on linux with intel processor (-msse2 required to get
sse2 support)
echo "" | g++-4.1 -msse2 -E -dM -x c++ - | sort | grep -i sse
#define __SSE__ 1
#define __SSE2__ 1
icc 11.0 on linux with intel processor (note that there is no need for -msse2)
echo "" | icc -E -dM -x c++ - | sort | grep -i sse
#define __SSE__ 1
#define __SSE2__ 1
gcc 4.1 and 4.3 on linux with amd 64 processor (note that there is no
need for -msse2)
echo "" | g++ -E -dM -x c++ - | sort | grep -i sse
#define __SSE__ 1
#define __SSE2__ 1
#define __SSE2_MATH__ 1
#define __SSE_MATH__ 1
gcc 4.0 on an intel mac (note that there is no need for -msse2)
echo "" | g++ -E -dM -x c++ - | sort | grep -i sse
#define __SSE2_MATH__ 1
#define __SSE2__ 1
#define __SSE_MATH__ 1
#define __SSE__ 1
Visual studio 2008 express on windows 32 bits with intel processor
Manually checked that __SSE2__ is also defined
I haven't found any authorative documentation on this preprocessor
define but it looks rather well supported. So the easiest fix right
now would be to change in vnl_math.h:
#if VNL_CONFIG_ENABLE_SSE2_ROUNDING && (!defined(__GCCXML__))
[...snip...]
#else
# define USE_SSE2_IMPL 0
#endif
by
#if VNL_CONFIG_ENABLE_SSE2_ROUNDING && (!defined(__GCCXML__)) &&
defined(__SSE2__)
[...snip...]
#else
# define USE_SSE2_IMPL 0
#endif
With this change, the scenario that was initially not compiling
("ccmake <path_to_itk_sources>" followed by setting
CMAKE_OSX_ARCHITECTURES to "i386;ppc64") compiles.
Does this seems sufficiently reasonnable to you for me to commit the fix?
Tom
More information about the Insight-developers
mailing list