[Numpy-tickets] [NumPy] #515: Wrong -march flags selected for modern Xeon processors

NumPy numpy-tickets@scipy....
Thu May 10 09:19:35 CDT 2007


#515: Wrong -march flags selected for modern Xeon processors
-----------------------------+----------------------------------------------
 Reporter:  jitter           |       Owner:  cookedm
     Type:  defect           |      Status:  new    
 Priority:  normal           |   Milestone:         
Component:  numpy.distutils  |     Version:  devel  
 Severity:  normal           |    Keywords:         
-----------------------------+----------------------------------------------
 Executive summary: A wrong -march flag for gfortran causes the scipy build
 to break.


 cat /proc/cpuinfo contains:

 {{{
 processor       : 3
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 15
 model name      : Intel(R) Xeon(R) CPU            5160  @ 3.00GHz
 stepping        : 6
 cpu MHz         : 3000.149
 cache size      : 4096 KB
 physical id     : 3
 siblings        : 2
 core id         : 1
 cpu cores       : 2
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 10
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
 cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm
 constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
 bogomips        : 6000.72
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:
 }}}


 ... and it's correctly detected as Xeon CPU by cpuinfo.py. So far so good.

 numpy/distutils/fcompiler/gnu.py fails to list Xeon processors, though.
 Therefore the default fallback (-march=i686) is chosen. This doesn't work
 because -march=i686 doesn't support 64bit instructions.

 The bug isn't triggered inside numpy, but is triggered when building scipy
 (Lib/fftpack/dfftpack).

 My current solution is to apply the following patch:


 {{{
 Index: numpy/distutils/fcompiler/gnu.py
 ===================================================================
 --- numpy/distutils/fcompiler/gnu.py    (revision 3737)
 +++ numpy/distutils/fcompiler/gnu.py    (working copy)
 @@ -225,6 +225,8 @@
                  march_opt = '-march=nocona'
              elif cpu.is_Core2():
                  march_opt = '-march=nocona'
 +           elif cpu.is_Xeon():
 +               march_opt = '-march=nocona'
              elif cpu.is_Prescott():
                  march_opt = '-march=prescott'
              elif cpu.is_PentiumIV():
 }}}

 You *might* have to add an additional condition that it's a 64bit Xeon. I
 unfortunately don't have access to a 32bit Xeon to test that. No idea
 whether "nocona" cares about 32/64bit instructions.

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/515>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list