Bug#877883: [openblas] cblas_* takes double* instead of void* for complex arrays

Claudius Hubig claudiushubig_opblzdscal at chubig.net
Fri Oct 6 16:16:52 UTC 2017


Package: openblas
Version: 0.2.19-3
Severity: wishlist

Dear Maintainer,

OpenBLAS in version 0.2.19-3 currently installed on Debian Stretch as
well as the version 0.2.20+ds-4 in Testing declares the cblas_*() as
taking double* instead of void* for complex values. As an example, it
declares cblas_zdscal as

void cblas_zdscal(OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, double *X, OPENBLAS_CONST blasint incX);

This function takes an array of complex numbers X and scales them by
the real value alpha.

In contrast to this, all other packages in Debian as well as the
Intel MKL define cblas_zdscal as taking a void* for X, i.e.:

void cblas_zdscal(const int N, const double alpha, void *X, const int incX);

See e.g. https://codesearch.debian.net/search?q=cblas_zdscal&perpkg=1
or https://software.intel.com/en-us/mkl-developer-reference-c-cblas-scal
or http://www.netlib.org/blas/cblas.h

The same difference applies to the cblas_zscal() function and all others:

$ dpkg -S /usr/include/cblas.h; dpkg -S /usr/include/openblas/cblas.h; grep zscal /usr/include/openblas/cblas.h /usr/include/cblas.h
libblas-dev: /usr/include/cblas.h
libopenblas-dev: /usr/include/openblas/cblas.h
/usr/include/openblas/cblas.h:void cblas_zscal(OPENBLAS_CONST blasint N, OPENBLAS_CONST double *alpha, double *X, OPENBLAS_CONST blasint incX);
/usr/include/cblas.h:void cblas_zscal(const int N, const void *alpha, void *X, const int incX);

I have only noticed the issue now as cblas.h has become part of the
alternatives system and is currently directing to the OpenBLAS
version in testing. In Stretch, if also libblas-dev is installed, its
cblas.h is used and the difference hence hidden away.

I suspect that this problem is not more widespread because people
tend to cast their arguments to (void*) explicitly, but the
conversion std::complex<double>* => void* => double* is probably
actually undefined…

There was also some discussion in 2013, but it seemed to go nowhere:
http://comments.gmane.org/gmane.comp.lib.openblas.general/192

I would be very thankful if there was some way to avoid the explicit
casts to (void*) in calls specifically for OpenBLAS.

Best wishes,

Claudius

--- System information. ---
Architecture: 
Kernel:       Linux 4.9.0-3-amd64

Debian Release: 9.1
  990 stable          security.debian.org 
  990 stable          ftp.de.debian.org 
  500 unstable        ftp.de.debian.org 
  500 stable          repo.skype.com 

--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 866 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20171006/6249b818/attachment.sig>


More information about the debian-science-maintainers mailing list