[Debian-med-packaging] Bug#793344: How to inject options only for intel architectures with cmake (Was: Bug#793344: hyphy: FTBFS on non-x86: unrecognized command line option '-msse3')

Andreas Tille andreas at an3as.eu
Thu Jul 23 13:47:54 UTC 2015


Hi Gert,

On Thu, Jul 23, 2015 at 03:25:00PM +0200, Gert Wollny wrote:
> On Thu, 2015-07-23 at 14:36 +0200, Andreas Tille wrote:
> > Hi,
> > 
> > considering the fact that SSE3 optimisation is really wanted on intel
> > architectures how could the option be added only for those architectures
> > that understand -msse3 option?
> 
> You can do this: 
> 
> ###
> include(CheckCXXCompilerFlag)
> CHECK_CXX_COMPILER_FLAG("-msee3" HAS_GNU_MSSE3_FLAG)
> IF(HAS_GNU_MSSE3_FLAG)
>   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -msse3")
> ENDIF(HAS_GNU_MSSE3_FLAG)
> ###
> 
> You could also add to the d/rules that certain flags are only set on
> certain architectures: 
> 
> I think it would be done like this: 
> ifeq ($(DEB_BUIL_ARCH), amd64)
>    CXXFLAGS += -msse3
> endif 

Thanks for these hints.
 
> Note however, that even on Intel arch -msse3 is not supported across all
> processor types that are supported by Debian. 
> 
> * amd64 is only guaranteed to support SSE2 (and this is enabled by
> default), but some early processors, like the single core Opteron don't
> support sse3.

Chances are *very* good that users of this package will not use some
early processors.  On the contrary users want to get the best
performance from their recent processors and I'm more afraid about some
"Hmmm, hyphy is faster on my Win/OSX machine than on Debian so I will
not run Debian" than "Ups, why does this program not run on my old
hardware."  So while you are theoretically right in practice I will
not expect any constraint.
 
> * on i386 the situation is even worse.

I doubt that there is any use on i386 at all.

> The clean solution would be to make a run-time decision about different
> code path using different instruction sets based on the processor. The
> non-free Intel compiler can provide this automatically with certain
> compiler flags, but AFAIK with gcc one has to do this manually. 

I'll tell upstream anyway.  I guess this link[1] might provide the
needed information or is there any better place to help upstream
implementing it?

Kind regards

       Andreas.

[1] https://stackoverflow.com/questions/6121792/how-to-check-if-a-cpu-supports-the-sse3-instruction-set

-- 
http://fam-tille.de



More information about the Debian-med-packaging mailing list