[NumPy-Tickets] [NumPy] #1170: Possible Bug in F2PY Fortran Compiler Detection

NumPy Trac numpy-tickets@scipy....
Sun Dec 12 04:03:02 CST 2010


#1170: Possible Bug in F2PY Fortran Compiler Detection
------------------------------+---------------------------------------------
 Reporter:  selevercin        |       Owner:  cookedm    
     Type:  defect            |      Status:  needs_info 
 Priority:  normal            |   Milestone:  Unscheduled
Component:  numpy.distutils   |     Version:  1.3.0      
 Keywords:  fortran compiler  |  
------------------------------+---------------------------------------------
Changes (by rgommers):

  * status:  new => needs_info


Old description:

> I believe there is a bug in the way f2py detects fortran compilers, where
> the executable name never gets entered. (I've tried posting this to the
> mailing list, but my post wont show up.)
>
> Everything discussed here was performed on: Linux cluster1
> 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:59:20 EDT 2006 x86_64 x86_64
> x86_64 GNU/Linux
>
> Trying to get f2py to recognize ifort, I started to output comments in
> some of the code to help trace down the mistake.
>
> I started in "numpy/distutils/fcompiler/__init__.py", which appears to
> check for the existence of a compiler based on whether or not it can find
> a version number in "numpy/distutils/fcompiler/__init__.py".
>
> I've included my output, but I'll also add short summary:
>
> 1. f2py successfully locates all compatible compilers with the platform
> (__init__.py)
> 2. f2py begins trying to get versions for each possible compiler
> (__init__.py)
> 3. f2py _INCORRECTLY_ creates a version command, to test if the compiler
> exists (ccompiler.py)
>
> Where the version command sticks with the wrong executables
> ('/opt/pgi/linux86-64/6.2/bin/pgf77' and
> '/opt/pgi/linux86-64/6.2/bin/pgf90').
>
> For example, to detect if ifort is installed, the following command is
> (wrongly) run:
> /opt/pgi/linux86-64/6.2/bin/pgf77 -FI -V -c /tmp/tmplG4_3d/ESXFqO.f -o
> /tmp/tmplG4_3d/ESXFqO.o
>
> This command is garbage, because it is trying pgf77 rather than ifort.
> Running this command is silly but I'll go ahead and include it:
>
> ---------------------------------------
> pgf77-Warning-Unknown switch: -FI
>
> pgf77 6.2-5 64-bit target on x86-64 Linux
> Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
> Copyright 2000-2006, STMicroelectronics, Inc.  All Rights Reserved.
> PGFTN/x86-64 Linux/x86-64 6.2-5
> Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
> Copyright 2000-2006, STMicroelectronics, Inc.  All Rights Reserved.
> ----------------------------------------
>
> Since ifort is in the path:
>
> $ which ifort
> /home/user10/intel/fce/9.1.041/bin/ifort
>
> The following works well:
> ----------------------------------------
> $ /home/user10/intel/fce/9.1.041/bin/ifort -FI -V -c
> /tmp/tmplG4_3d/ESXFqO.f -o /tmp/tmplG4_3d/ESXFqO.o
>
> Intel(R) Fortran Compiler for Intel(R) EM64T-based applications, Version
> 9.1    Build 20070109 Package ID: l_fc_c_9.1.041
> Copyright (C) 1985-2007 Intel Corporation.  All rights reserved.
> FOR NON-COMMERCIAL USE ONLY
>
>  Intel Fortran 9.1-6565
> ----------------------------------------
>
> I tried a quick hack to get the ifort executable in the version command,
> but this didn't cause ifort to be successfully detected.
>
> My Test Output:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> $ python setup.py install --prefix=${HOME}/numpy_dir | grep "NDR"
>
> Running from numpy source directory.
> /home/nreveles/numpy-1.3.0/numpy/distutils/command/config.py:361:
> DeprecationWarning:
> +++++++++++++++++++++++++++++++++++++++++++++++++
> Usage of get_output is deprecated: please do not
> use it anymore, and avoid configuration checks
> involving running executable on the target machine.
> +++++++++++++++++++++++++++++++++++++++++++++++++
>
>   DeprecationWarning)
>
> NDR: self= <numpy.distutils.fcompiler.gnu.GnuFCompiler instance at
> 0x2aaaaee5d950>
> NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '--version']
> NDR: compiler =  <numpy.distutils.fcompiler.gnu.GnuFCompiler instance at
> 0x2aaaaee5d950>
> NDR: comp. version =  None
>
> NDR: self= <numpy.distutils.fcompiler.intel.IntelFCompiler instance at
> 0x2aaaaee62200>
> NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '-FI', '-V',
> '-c', '/tmp/tmplG4_3d/ESXFqO.f', '-o', '/tmp/tmplG4_3d/ESXFqO.o']
> NDR: compiler =  <numpy.distutils.fcompiler.intel.IntelFCompiler instance
> at 0x2aaaaee62200>
> NDR: comp. version =  None
>
> NDR: compiler =  <numpy.distutils.fcompiler.lahey.LaheyFCompiler instance
> at 0x2aaaaee62680>
> NDR: self= <numpy.distutils.fcompiler.lahey.LaheyFCompiler instance at
> 0x2aaaaee62680>
> NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf90', '--version']
> NDR: comp. version =  None
>
> NDR: compiler =  <numpy.distutils.fcompiler.pg.PGroupFCompiler instance
> at 0x2aaaaee633b0>
> NDR: self= <numpy.distutils.fcompiler.pg.PGroupFCompiler instance at
> 0x2aaaaee633b0>
> NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '-V
> 2>/dev/null']
> NDR: comp. version =  6.2-5
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

New description:

 I believe there is a bug in the way f2py detects fortran compilers, where
 the executable name never gets entered. (I've tried posting this to the
 mailing list, but my post wont show up.)

 Everything discussed here was performed on: Linux cluster1
 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:59:20 EDT 2006 x86_64 x86_64
 x86_64 GNU/Linux

 Trying to get f2py to recognize ifort, I started to output comments in
 some of the code to help trace down the mistake.

 I started in "numpy/distutils/fcompiler/__init__.py", which appears to
 check for the existence of a compiler based on whether or not it can find
 a version number in "numpy/distutils/fcompiler/__init__.py".

 I've included my output, but I'll also add short summary:

   1. f2py successfully locates all compatible compilers with the platform
 (__init__.py)

   2. f2py begins trying to get versions for each possible compiler
 (__init__.py)

   3. f2py _INCORRECTLY_ creates a version command, to test if the compiler
 exists (ccompiler.py)

 Where the version command sticks with the wrong executables
 ('/opt/pgi/linux86-64/6.2/bin/pgf77' and
 '/opt/pgi/linux86-64/6.2/bin/pgf90').

 For example, to detect if ifort is installed, the following command is
 (wrongly) run:
 {{{
 /opt/pgi/linux86-64/6.2/bin/pgf77 -FI -V -c /tmp/tmplG4_3d/ESXFqO.f -o
 /tmp/tmplG4_3d/ESXFqO.o
 }}}

 This command is garbage, because it is trying pgf77 rather than ifort.
 Running this command is silly but I'll go ahead and include it:
 {{{
 ---------------------------------------
 pgf77-Warning-Unknown switch: -FI

 pgf77 6.2-5 64-bit target on x86-64 Linux
 Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
 Copyright 2000-2006, STMicroelectronics, Inc.  All Rights Reserved.
 PGFTN/x86-64 Linux/x86-64 6.2-5
 Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
 Copyright 2000-2006, STMicroelectronics, Inc.  All Rights Reserved.
 ----------------------------------------
 }}}
 Since ifort is in the path:
 {{{
 $ which ifort
 /home/user10/intel/fce/9.1.041/bin/ifort
 }}}
 The following works well:
 {{{
 $ /home/user10/intel/fce/9.1.041/bin/ifort -FI -V -c
 /tmp/tmplG4_3d/ESXFqO.f -o /tmp/tmplG4_3d/ESXFqO.o

 Intel(R) Fortran Compiler for Intel(R) EM64T-based applications, Version
 9.1    Build 20070109 Package ID: l_fc_c_9.1.041
 Copyright (C) 1985-2007 Intel Corporation.  All rights reserved.
 FOR NON-COMMERCIAL USE ONLY

  Intel Fortran 9.1-6565
 }}}

 I tried a quick hack to get the ifort executable in the version command,
 but this didn't cause ifort to be successfully detected.

 My Test Output:

 {{{
 $ python setup.py install --prefix=${HOME}/numpy_dir | grep "NDR"

 Running from numpy source directory.
 /home/nreveles/numpy-1.3.0/numpy/distutils/command/config.py:361:
 DeprecationWarning:
 +++++++++++++++++++++++++++++++++++++++++++++++++
 Usage of get_output is deprecated: please do not
 use it anymore, and avoid configuration checks
 involving running executable on the target machine.
 +++++++++++++++++++++++++++++++++++++++++++++++++

   DeprecationWarning)

 NDR: self= <numpy.distutils.fcompiler.gnu.GnuFCompiler instance at
 0x2aaaaee5d950>
 NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '--version']
 NDR: compiler =  <numpy.distutils.fcompiler.gnu.GnuFCompiler instance at
 0x2aaaaee5d950>
 NDR: comp. version =  None

 NDR: self= <numpy.distutils.fcompiler.intel.IntelFCompiler instance at
 0x2aaaaee62200>
 NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '-FI', '-V',
 '-c', '/tmp/tmplG4_3d/ESXFqO.f', '-o', '/tmp/tmplG4_3d/ESXFqO.o']
 NDR: compiler =  <numpy.distutils.fcompiler.intel.IntelFCompiler instance
 at 0x2aaaaee62200>
 NDR: comp. version =  None

 NDR: compiler =  <numpy.distutils.fcompiler.lahey.LaheyFCompiler instance
 at 0x2aaaaee62680>
 NDR: self= <numpy.distutils.fcompiler.lahey.LaheyFCompiler instance at
 0x2aaaaee62680>
 NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf90', '--version']
 NDR: comp. version =  None

 NDR: compiler =  <numpy.distutils.fcompiler.pg.PGroupFCompiler instance at
 0x2aaaaee633b0>
 NDR: self= <numpy.distutils.fcompiler.pg.PGroupFCompiler instance at
 0x2aaaaee633b0>
 NDR: version_cmd = ['/opt/pgi/linux86-64/6.2/bin/pgf77', '-V 2>/dev/null']
 NDR: comp. version =  6.2-5
 }}}

--

Comment:

 What command did you run to start the build? It seems you do have the
 pgf77 compiler installed, so distutils correctly finds a working compiler.
 I suspect you did not specify which compiler you want, like so:
 {{{
 $ python setup.py build --fcompiler=intelem
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1170#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list