Shot in the dark: Anyone ever use CLAPACK routines?

Bruce Labitt bruce.labitt at myfairpoint.net
Fri May 21 20:02:06 EDT 2010


bruce.labitt at autoliv.com wrote:
> gnhlug-discuss-bounces at mail.gnhlug.org wrote on 05/19/2010 02:34:19 PM:
> <snip a ton o' stuff>
>   
>> Comment on my own post.  Probably nothing is wrong with MY CODE. 
>>
>> http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=745
>>
>> The claim is that zgesvd_ function hangs.  The fix is allegedly to 
>>     
> modify
>   
>> the make.inc file for CLAPACK. 
>>
>> The change is adding -ffloat-store to the end of NOOPT.
>> "NOOPT = -O0 -I$(TOPDIR)/INCLUDE -fPIC -ffloat-store"
>>
>> Hope that fixes it.  I'll find out in 4+ hours!
>>
>> -Bruce
>>
>>     
>
> Of course it didn't work :(   Sounded too good to be true, and it was!
> I did find out that Scipy.linalg.svd used LAPACK not CLAPACK. 
>
> In [4]: source( svd )
> In file: /usr/lib/python2.6/dist-packages/scipy/linalg/decomp.py
>
> def svd(a,full_matrices=1,compute_uv=1,overwrite_a=0):
>
> snip
>     """
>     # A hack until full_matrices == 0 support is fixed here.
>     if full_matrices == 0:
>         import numpy.linalg
>         return numpy.linalg.svd(a, full_matrices=0, compute_uv=compute_uv)
>     a1 = asarray_chkfinite(a)
>     if len(a1.shape) != 2:
>         raise ValueError, 'expected matrix'
>     m,n = a1.shape
>     overwrite_a = overwrite_a or (_datanotshared(a1,a))
>     gesdd, = get_lapack_funcs(('gesdd',),(a1,))
>     if gesdd.module_name[:7] == 'flapack':
>         lwork = calc_lwork.gesdd(gesdd.prefix,m,n,compute_uv)[1]
>         u,s,v,info = gesdd(a1,compute_uv = compute_uv, lwork = lwork,
>                       overwrite_a = overwrite_a)
>     else: # 'clapack'
>         raise NotImplementedError,'calling gesdd from %s' % 
> (gesdd.module_name)
>     if info>0: raise LinAlgError, "SVD did not converge"
>     if info<0: raise ValueError,\
>        'illegal value in %-th argument of internal gesdd'%(-info)
>     if compute_uv:
>         return u,s,v
>     else:
>         return s
>
> Hmm... I wonder if CLAPACK have been rigorously tested, like (f)LAPACK 
> has...  I guess that scipy/numpy did not think so... 
> arggggggghhhhhhhhhhhhhhhhhh...
>
> Aaaaaccckk, time to get more familiar with valgrind...  Nuts, I thought 
> this was all going to be straight forward...  Give me python any day!
>
> -Bruce
>
>   
Not too much to report.  I even re-compiled ATLAS & LAPACK allowing gcc 
& gfortran and got my example code to build.  Same problem with the 9x9 
matrix.  The 2x2 double complex matrix svd worked! 

I do have to say the interface to LAPACK is much better than CLAPACK.  
(C or C++ calling FORTRAN)  I can go back to my old (bad) habits of 
using bits of C++ to help make the code easier to follow.

In numpy/scipy the code computed the svd with no problem.

Not too much activity at the lapack-forum.  :(  Since the academic term 
ended recently at UT Knoxville, maybe everyone is on vacation...

-Bruce


More information about the gnhlug-discuss mailing list