[Numpy-discussion] numpy build: automatic fortran detection

Russell E. Owen rowen at uw.edu
Mon Jun 13 14:53:37 EDT 2011


In article <BANLkTikODians0UJrdKPUdfFO8agPnXk7g at mail.gmail.com>,
 Ralf Gommers <ralf.gommers at googlemail.com> wrote:

> On Thu, Jun 9, 2011 at 11:46 PM, Russell E. Owen <rowen at uw.edu> wrote:
> 
> > What would it take to automatically detect which flavor of fortran to
> > use to build numpy on linux?
> >
> 
> You want to figure out which compiler was used to build BLAS/LAPACK/ATLAS
> and check that the numpy build uses the same, right? Assuming you only care
> about g77/gfortran, you can try this (from
> http://docs.scipy.org/doc/numpy/user/install.html):
> """
> How to check the ABI of blas/lapack/atlas
> -----------------------------------------
> One relatively simple and reliable way to check for the compiler used to
> build a library is to use ldd on the library. If libg2c.so is a dependency,
> this means that g77 has been used. If libgfortran.so is a a dependency,
> gfortran has been used. If both are dependencies, this means both have been
> used, which is almost always a very bad idea.
> """
> 
> You could do something similar for other compilers if needed. It would help
> to know exactly what problem you are trying to solve.

I'm trying to automate the process of figuring out which fortran to use 
because we have a build system that should install numpy for users, 
without user interaction.

We found this out the hard way by not specifying a compiler and ending 
up with a numpy that was mis-built (according to its helpful unit tests).

However, it appears that g77 is very old so I'm now wondering if it 
would make sense to switch to gfortran for the default?

I think our own procedure will be to assume gfortran and complain to 
users if it's not right. (We can afford the time to run the test).

> > The unit tests are clever enough to detect a mis-build (though
> > surprisingly that is not done as part of the build process), so surely
> > it can be done.
> >
> 
> The test suite takes some time to run. It would be very annoying if it ran
> by default on every rebuild. It's easy to write a build script that builds
> numpy, then runs the tests, if that's what you need.

In this case the only relevant test is the test for the correct fortran 
compiler. That is the only test I was proposing be performed.

-= RUssell




More information about the NumPy-Discussion mailing list