[SciPy-User] [cython-users] scipy cblas return value

Sturla Molden sturla at molden.no
Tue Sep 24 12:24:02 EDT 2013


I believe the problem might be the cblas you are using. Apparently, cblas scot returns float according to cblas.h. But the f2c reference version of cblas scot returns double.

http://www.netlib.org/clapack/CLAPACK-3.1.1/BLAS/WRAP/cblas.h
http://www.netlib.org/clapack/cblas/sdot.c

Sturla



On Sep 24, 2013, at 1:21 PM, Radim Řehůřek <me at radimrehurek.com> wrote:

> It's actually more serious than I though. This "double instead of float" apparently fails on some systems while manifesting itself as a weird slow down: https://groups.google.com/d/msg/gensim/6B99kdtHOZo/FSss6GgzE5IJ
> 
> We've confirmed with the person who reported it that the problem is only in sdot. Changing the sdot return value to `float` fixes it.
> 
> SciPy version doesn't seem to affect this (tried both 0.12 and 0.13b on the failing machine).
> 
> CC to Scipy people: the code is using a protected pointer from scipy.linalg.blas.cblas, like so: https://gist.github.com/anonymous/6659007 
> 
> Why is the required return value sometimes float and sometimes double? Is there a better/safer way to achieve calling numpy/scipy BLAS from cython?
> 
> Cheers,
> Radim
> 
> 
> On Tuesday, September 24, 2013 6:58:20 AM UTC+2, Robert Bradshaw wrote:
> _cpointer seems to be woefully undocumented, but it looks like it is a 
> C function actually returning a double not a float. 
> 
> On Sun, Sep 22, 2013 at 4:54 AM, Radim Řehůřek <m... at radimrehurek.com> wrote: 
> > Hello all, 
> > 
> > I'm trying to call sdot from scipy.linalg.blas.cblas from Cython, but it 
> > only works if I declare the return type as double (not float): 
> > 
> > https://gist.github.com/anonymous/6659007 
> > 
> > I don't know if this is a Cython issue or a SciPy issue or a BLAS (vecLib) 
> > issue or a chair-keyboard issue. Could someone more knowledgeable elucidate 
> > please? 
> > 
> > Cheers, 
> > Radim, Cython 0.19.1, SciPy 0.12.0, Python 2.7.1, NumPy & SciPy BLAS from OS 
> > X Accelerate 
> > 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google Groups 
> > "cython-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to cython-users... at googlegroups.com. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google Groups "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130924/826261ee/attachment.html>


More information about the SciPy-User mailing list