[Numpy-discussion] numpy build: automatic fortran detection

Ralf Gommers ralf.gommers@googlemail....
Fri Jun 17 16:00:09 CDT 2011


On Mon, Jun 13, 2011 at 8:53 PM, Russell E. Owen <rowen@uw.edu> wrote:

> In article <BANLkTikODians0UJrdKPUdfFO8agPnXk7g@mail.gmail.com>,
>  Ralf Gommers <ralf.gommers@googlemail.com> wrote:
>
> > On Thu, Jun 9, 2011 at 11:46 PM, Russell E. Owen <rowen@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.
>

I assume you're installing scipy as well? There's no Fortran code in numpy.

>
> 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?
>

This makes sense. Only if you're building on Windows and build with MinGW
you have to give it some more thought - we're still building the distributed
binaries with g77.


>
> 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.
>
> There's not a single test like that in the test suite, unless I missed
something. But you can easily implement it for gfortran/g77.

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110617/64d586ca/attachment.html 


More information about the NumPy-Discussion mailing list