[Numpy-discussion] scipy.scons branch: building numpy and scipy with scons

Robert Kern robert.kern@gmail....
Tue Dec 4 14:24:24 CST 2007

Fernando Perez wrote:
> On Dec 4, 2007 12:27 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> user-friendly. Another option is to have our Fortran compiler "knowledge-base"
>> separable from the rest of the package. scons could try to import them from,
>> say, numpy_fcompilers first and then look inside numpy.distutils if
>> numpy_fcompilers is not found. That way, a user could download a fresh
>> "knowledge-base" into their source tree (and possibly tweak it) without the
>> burden of installing a new numpy.
> Is this something that really needs to be a code package?  Why can't
> this knowledge (or at least the easily overridable part of it) be
> packaged in one or more .conf/.ini plaintext files?  In that way,
> users could easily grab new data files or tweak the builtin ones, and
> at build time say
> setup.py install  --compiler_conf=~/my_tweaked.conf
> Is that impossible/unreasonable for some reason?

It's not impossible, but there are at least a couple of places where it might be
unreasonable. For example, look at the get_flags_arch() for Intel compilers:

    def get_flags_arch(self):
        v = self.get_version()
        opt = []
        if cpu.has_fdiv_bug():
        if cpu.has_f00f_bug():
        if cpu.is_PentiumPro() or cpu.is_PentiumII() or cpu.is_PentiumIII():
        elif cpu.is_PentiumM():
        elif cpu.is_Pentium():
        elif cpu.is_PentiumIV() or cpu.is_Xeon():
        if v and v <= '7.1':
            if cpu.has_mmx() and (cpu.is_PentiumII() or cpu.is_PentiumIII()):
        elif v and v >= '8.0':
            if cpu.is_PentiumIII():
                if cpu.has_sse3():
            elif cpu.is_PentiumIV():
                if cpu.has_sse2():
            elif cpu.is_PentiumM():
            if (cpu.is_Xeon() or cpu.is_Core2() or cpu.is_Core2Extreme()) and
            if cpu.has_sse3() and (cpu.is_PentiumIV() or cpu.is_CoreDuo() or

        if cpu.has_sse2():
            opt.append('-arch SSE2')
        elif cpu.has_sse():
            opt.append('-arch SSE')
        return opt

Expressing that without code could be hairy.

That said, using configuration files as override mechanisms for each of the
get_flags_*() methods would be feasible especially if there were a script to
dump the current flag set to the configuration file.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list