cannot convert ‘const std::complex<float>*’ to ‘const float*’
When I try to compile this with
#define BLAZE_BLAS_MODE 1
and
cblas.h from OpenBLAS
I get multiple errors because this library tries to pass const std::complex<float>*
, but the library accepts a float*.
For example with cblas_cdotu_sub https://bitbucket.org/blaze-lib/blaze/src/dae360c344d84ee169332d1de163cc6c57fc763b/blaze/math/blas/dotu.h?at=master&fileviewer=file-view-default#dotu.h-150
I get
amunmt/src/3rd-party/blaze/math/blas/dot.h:156:47: error: cannot convert ‘const std::complex<float>*’ to ‘const float*’ for argument ‘2’ to ‘void cblas_cdotu_sub(blasint, const float*, blasint, const float*, blasint, openblas_complex_float*)’
cblas_cdotu_sub( n, x, incX, y, incY, &tmp );
This also happens for other calls, like cblas_cgemm, cblas_zgemm, cblas_cgemv, cblas_ztrmm, cblas_ztrsm.
This might also be an issue with OpenBLAS?
Comments (7)
-
-
-
assigned issue to
-
assigned issue to
-
- changed status to open
-
reporter We will try to take care of the issue within the next 48h.
Amazing, thanks!
I can't find an open or closed issue on the OpenBLAS issue tracker concerning this, which is weird considering I'm not the only one that has encountered this issue and OpenBLAS is the fastest CPU implementation I can find.
-
reporter I got my program working with the suggested change of simply casting the values given to the BLAS library. Here is the patch: https://bitbucket.org/karlsruhe-it-solutions/amunmt/commits/886bb53154d37854cf8515a93d74ba2a64f2155e
Note that this patch applies to an older version of blaze from what I can see.
Also note that it uses two instances of
openblas_complex_float/double
(typedeffed float _Complex) which are specific to openblas. Not sure how to make that generic.For my specific program though, blaze seems to run faster without BLAS than with either CBLAS or OpenBLAS. Are these benchmarks using Blaze with BLAS and if so which implementation?
-
Thanks for the link to the patch. Our fix was implemented based on your implementation. Blaze should now be fully compatible to OpenBLAS.
Whether the Blaze kernels or BLAS kernels are faster depends on the size and the row/column ratio of the matrix. For small matrices and matrices with a very small or large row/column ratio the Blaze kernels prove to be more efficient, for large quadratic matrices BLAS kernels are usually better suited. Our benchmark results for the dense matrix multiplication were obtained with the MKL as underlying BLAS library.
Thanks again, your help is highly appreciated!
Best regards,
Klaus!
-
- changed status to resolved
The fix has been implemented and verified via tests. It is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.1.
- Log in to comment
Hi!
It unfortunately looks like OpenBLAS uses a different function signature. By default all BLAS functions should expect a
const void*
(see for instance the LAPACK reference, the Apple API reference, and the GNU GSL CBLAS library). Therefore it seems to be an issue with OpenBLAS.Nevertheless, the problem can be solved within the Blaze library by explicitly converting
const complex<float>*
toconst float*
. We will try to take care of the issue within the next 48h.Best regards,
Klaus!