How to tell numpy to use gfortran as a compiler ?
Hi, I try to compile numpy using gfortran, using: python setup.py config --fcompiler=gnu But this does not work. Whatever option I try, numpy build system uses g77, and as a result, I have problems with my ATLAS library compiled with gfortran. What should I do to compiler numpy with blas/lapack compiler with gfortran ? cheers, David
David Cournapeau wrote:
Hi,
I try to compile numpy using gfortran, using:
python setup.py config --fcompiler=gnu
But this does not work. Whatever option I try, numpy build system uses g77, and as a result, I have problems with my ATLAS library compiled with gfortran. What should I do to compiler numpy with blas/lapack compiler with gfortran ?
--fcompiler=gnu95 -- 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
Robert Kern wrote:
David Cournapeau wrote:
Hi,
I try to compile numpy using gfortran, using:
python setup.py config --fcompiler=gnu
But this does not work. Whatever option I try, numpy build system uses g77, and as a result, I have problems with my ATLAS library compiled with gfortran. What should I do to compiler numpy with blas/lapack compiler with gfortran ?
--fcompiler=gnu95 I also tried this option, without any luck. numpy still uses g77 (which is gcc 3.4 for fortran on my ubuntu system) instead of gfortran.
But now, I think I misunderstand some things : I thought that g77 was the 3.* version of the fortran compiler, and gfortran the 4.* one. But it looks like they are also different in the fortran dialect they are supporting (I know nothing about fortran). So should I use gfortran at all to compile the fortran wrapper for BLAS/LAPACK by ATLAS ? Or should I use g77 ? How can I be sure then that I won't have problems using gcc 3* serie for Fortran and gcc 4* serie for everything else (C, C++ and most if not all libraries compiled on my system) ? cheers, David
Robert Kern wrote:
But now, I think I misunderstand some things : I thought that g77 was the 3.* version of the fortran compiler, and gfortran the 4.* one. But it looks like they are also different in the fortran dialect they are supporting (I know nothing about fortran). So should I use gfortran at all to compile the fortran wrapper for BLAS/LAPACK by ATLAS ? Or should I use g77 ? How can I be sure then that I won't have problems using gcc 3* serie for Fortran and gcc 4* serie for everything else (C, C++ and most if not all libraries compiled on my system) ?
g77 is a Fortran 77 compiler. The development of g77 is halted. gfortran is a Fortran 77, 90, and 95 compiler. It is the current Fortran compiler in the GNU Compiler Collection (GCC). You can compile the reference implementation of BLAS and LAPACK with both g77 and gfortran, as these libraries are written in Fortran 77. ATLAS is written in C and some Fortran 77. gfortran are able to do some optimizations that g77 cannot, e.g. autovectorization using SSE and MMX extensions and profile-guided optimizations. Also be aware that if you use gfortran and GCC 4, the C compiler is better as well. There is a third Fortran compiler based on the GCC backend called "g95". It is not a part of GCC and uses copyrighted source code illegally (numerous GPL violations). The head developer is rumored to have serious bad karma. Apart from that, g95 is an ok Fortran 95 compiler. Always ensure that ambiguous switches like "gnu95" means gfortran and not g95. I don't know what NumPy does.
Sturla Molden wrote:
g77 is a Fortran 77 compiler. The development of g77 is halted.
gfortran is a Fortran 77, 90, and 95 compiler. It is the current Fortran compiler in the GNU Compiler Collection (GCC).
You can compile the reference implementation of BLAS and LAPACK with both g77 and gfortran, as these libraries are written in Fortran 77. ATLAS is written in C and some Fortran 77.
gfortran are able to do some optimizations that g77 cannot, e.g. autovectorization using SSE and MMX extensions and profile-guided optimizations. Also be aware that if you use gfortran and GCC 4, the C compiler is better as well.
Ok, that clears things you, thank you. Now, I have to understand why --fcompiler=gnu95 still calls gfortran.... cheers, David
David Cournapeau wrote:
Sturla Molden wrote:
g77 is a Fortran 77 compiler. The development of g77 is halted.
gfortran is a Fortran 77, 90, and 95 compiler. It is the current Fortran compiler in the GNU Compiler Collection (GCC).
You can compile the reference implementation of BLAS and LAPACK with both g77 and gfortran, as these libraries are written in Fortran 77. ATLAS is written in C and some Fortran 77.
gfortran are able to do some optimizations that g77 cannot, e.g. autovectorization using SSE and MMX extensions and profile-guided optimizations. Also be aware that if you use gfortran and GCC 4, the C compiler is better as well.
Ok, that clears things you, thank you. Now, I have to understand why --fcompiler=gnu95 still calls gfortran....
You mean g77? Anyways, I think I know why you are having problems. Passing --fcompiler to the config command only affects the Fortran compiler that is used during configuration phase (where we compile small C programs to determine what your platform supports, like isnan() and the like). It does not propagate to the rest of the build_ext phase where you want it. Use config_fc to set up your Fortran compiler for all of the phases: $ python setup.py config_fc --fcompiler=gnu95 build -- 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
Robert Kern wrote:
David Cournapeau wrote:
Sturla Molden wrote:
g77 is a Fortran 77 compiler. The development of g77 is halted.
gfortran is a Fortran 77, 90, and 95 compiler. It is the current Fortran compiler in the GNU Compiler Collection (GCC).
You can compile the reference implementation of BLAS and LAPACK with both g77 and gfortran, as these libraries are written in Fortran 77. ATLAS is written in C and some Fortran 77.
gfortran are able to do some optimizations that g77 cannot, e.g. autovectorization using SSE and MMX extensions and profile-guided optimizations. Also be aware that if you use gfortran and GCC 4, the C compiler is better as well.
Ok, that clears things you, thank you. Now, I have to understand why --fcompiler=gnu95 still calls gfortran....
You mean g77? Anyways, I think I know why you are having problems. Passing --fcompiler to the config command only affects the Fortran compiler that is used during configuration phase (where we compile small C programs to determine what your platform supports, like isnan() and the like). It does not propagate to the rest of the build_ext phase where you want it. Use config_fc to set up your Fortran compiler for all of the phases:
$ python setup.py config_fc --fcompiler=gnu95 build
Thanks, that indeed was the cause of my problem. cheers, David
participants (3)
-
David Cournapeau -
Robert Kern -
Sturla Molden