[SciPy-dev] building lib.lapack without optimization

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Nov 30 06:56:13 CST 2004


Pearu Peterson wrote:

>
>
> On Tue, 30 Nov 2004, Nils Wagner wrote:
>
>> Here are my findings...
>>
>> python2.3 setup_lapack.py build config_fc --noarch --opt="-O2" yields
>>
>> ======================================================================
>> FAIL: check_heev_complex (__main__.test_clapack_complex)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> File "tests/test_lapack.py", line 51, in check_heev_complex
>>   assert_array_almost_equal(dot(a,v[:,i]),w[i]*v[:,i])
>> File "/usr/lib/python2.3/site-packages/scipy_test/testing.py", line 
>> 748, in assert_array_almost_equal
>>   assert cond,\
>> AssertionError:
>> Arrays are not almost equal (mismatch 33.3333333333%):
>>       Array 1: [-1.2905481 -4.3758251e+00j -2.0410486 +1.3645462e+00j
>>      3.5935487 +2.8312206e-07j]
>>       Array 2: [-1.2905486-4.3758267j -2.041049 +1.3645459j  
>> 3.5935484-0.j ]
>>
>>
>> ======================================================================
>> FAIL: check_heev_complex (__main__.test_flapack_complex)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> File "tests/test_lapack.py", line 51, in check_heev_complex
>>   assert_array_almost_equal(dot(a,v[:,i]),w[i]*v[:,i])
>> File "/usr/lib/python2.3/site-packages/scipy_test/testing.py", line 
>> 748, in assert_array_almost_equal
>>   assert cond,\
>> AssertionError:
>> Arrays are not almost equal (mismatch 33.3333333333%):
>>       Array 1: [-1.2905481 -4.3758251e+00j -2.0410486 +1.3645462e+00j
>>      3.5935487 +2.8312206e-07j]
>>       Array 2: [-1.2905486-4.3758267j -2.041049 +1.3645459j  
>> 3.5935484-0.j ]
>
>
> So, -O2 fixes the problem. I'll make it default for gcc-3.3.3 compiler.
>
> Also, if your lapack libraries are built with -O3 then rebuilding them 
> with -O2 should fix the segmentation faults.
>
This is my make.inc. So, I will  replace

OPTS = -funroll-all-loops -fno-f2c -O3

with

OPTS = -funroll-all-loops -fno-f2c -O2

Is that o.k. ?

Nils

 ####################################################################
#  LAPACK make include file.                                       #
#  LAPACK, Version 3.0                                             #
#  June 30, 1999                                                  #
####################################################################
#
SHELL = /bin/sh
#
#  The machine (platform) identifier to append to the library names
#
PLAT = _LINUX
#
#  Modify the FORTRAN and OPTS definitions to refer to the
#  compiler and desired compiler options for your machine.  NOOPT
#  refers to the compiler options desired when NO OPTIMIZATION is
#  selected.  Define LOADER and LOADOPTS to refer to the loader and
#  desired load options for your machine.
#
FORTRAN  = g77
OPTS     = -funroll-all-loops -fno-f2c -O3
DRVOPTS  = $(OPTS)
NOOPT    =
LOADER   = g77
LOADOPTS =
#
#  The archiver and the flag(s) to use when building archive (library)
#  If you system has no ranlib, set RANLIB = echo.
#
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
#
#  The location of the libraries to which you will link.  (The
#  machine-specific, optimized BLAS library should be used whenever
#  possible.)
#
BLASLIB      = ../../blas$(PLAT).a
LAPACKLIB    = lapack$(PLAT).a
TMGLIB       = tmglib$(PLAT).a
EIGSRCLIB    = eigsrc$(PLAT).a
LINSRCLIB    = linsrc$(PLAT).a

>> So any optimization fails.
>
>
> Note that in the failures the results are actually correct. Just the 
> corresponding tests need some tuning.. So, I am not considering them 
> as failures.
>
>>>>> What gcc version are you using?
>>>>
>>>> gcc version 3.3.3 (SuSE Linux)
>>>
>>> Btw, I am using gcc 3.3.5 (Debian Sid) with no problems.
>>>
>> SuSE 9.2 comes with gcc 3.3.4.
>> Do you have any experience with that version ?
>
>
> I don't remember.
>
> Pearu
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-dev



 





More information about the Scipy-dev mailing list