0

I'm using Armadillo (10.4.1) in Visual Studio 2019 to do some matrix stuff. I used OpenBlas from NuGet manager, but everything was slow. I now want to switch to an up-to-date version of OpenBlas. I took the last one (0.3.15) and compiled it with minGW following this tuto : https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio.

The compilation works fine, but when I try matrix multiplication, an error is thrown in the console : On entry to DSPR2 parameter number 1 had an illegal value

I do have defined ARMA_USE_BLAS, ARMA_DONT_USE_WRAPPER. I tried to played with ARMA_BLAS_LONG, ARMA_BLAS_UNDERSCORE, ARMA_USE_FORTRAN_HIDDEN_ARGS but nothing change.

Everything was working great using NuGet manager (OpenBlas 0.2.14.1). Here is a sample that doesn't works:

#include <armadillo>

int main(){

    arma::mat *mat1 = new arma::mat(5, 5, arma::fill::ones);
    arma::mat *mat2 = new arma::mat(5, 5, arma::fill::ones);
    arma::mat *result = new arma::mat();


    *result = *mat1 * *mat2;

    result->print();

    delete mat1, mat2, result;

    return 0;
}

Do you have any clue on what am I doing wrong ?

Thank you for your time !

Bato

Bato
  • 11
  • 2
  • Why do you allocate your matrices on the heap? – janekb04 May 18 '21 at 19:47
  • Don't use the NuGet manager or compile your own. Instead use the pre-built OpenBLAS that comes with Armadillo 10.4, directly from the Armadillo [download](http://arma.sourceforge.net/download.html) page. It's in the "examples/lib_win64" folder. – hbrerkere May 19 '21 at 02:54
  • janekb04 : because I often use 3000x3000 matrices! @hbrerkere I started my whole project as a 32bits one, so turning back to 64 will be ..... very hard :( – Bato May 19 '21 at 06:48

1 Answers1

1

I finally manage to fix the issue: First, I downloaded the pre compiled binary (x86) here: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.10/OpenBLAS-0.3.10-x86.zip

I put the dll in my project folder, renamed the "libopenblas.dll.a" into "libopenblas.lib". It worked well, but was still slower than Matlab ... So I benchmarked matrix multiplication and custom functions on a fresh new x64 project (using the precompiled binaries given by Armadillo). And ... Everything is much faster !

So I'm leaving x86 to switch to x64 ! Subject is closed!

Bato
  • 11
  • 2