You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BLAS/LAPACK routine 'DLASCL' gave error code -4 #2
Thanks for putting this package together -- it's nice to have easy control over BLAS in Fedora!
I've run into an issue with it however. While I was able to replicate the R-bloggers example, I ran into an issue running the sample code from this StackOverflow post.
Specifically, running this code produces an error (m is set to 1000 here instead of 10000 as in the StackOverflow original since it errors quickly):
# Singular Value Decompositionm<-1000n<-2000A<-matrix (runif (m*n),m,n)
system.time (S<- svd (A,nu=0,nv=0))
Within RStudio, I received:
BLAS/LAPACK routine 'DLASCL' gave error code -4
Similarly, I ran into issues running this from the terminal. I tried this with intel-mkl-2020.0-088, the 2019.5 version, as well as the most recent oneAPI (although admittedly for the latter I didn't test it fully).
The expected result should be a relatively quick calculation -- at least it is on macOS and Windows.
Could you paste the output from sessionInfo(), please? Also, does it fail with a specific backend? Did you use the CRAN package or did you install flexiblas from the system repositories? I have R-flexiblas installed from the system repositories in Fedora 33 and I cannot reproduce the error (with 10000).
To clarify, I used the system repositories and tried OpenBLAS and MKL (intel-mkl-2020.0-088) following your R-bloggers guides, which worked perfectly for the benchmark example in the post. The code in the issue works with the default Fedora 33 OpenBLAS backend but fails when switching the backend to MKL. All of this was done with a fresh, fully-updated Fedora install.
I will post my sessionInfo() next time I’m at the computer along with some screenshots. Hopefully I can help replicate this.
Never use the MKL_RT interface. That is more (or less) dangerous. The problem is that the mkl_rt.so contains an interface with a flexible ABI controlled by some environment variables and in this way its interface is not reblas compatible. This causes most of the errors I think. For example one can change the width of an integer and the threading model via environment variables and API calls.
The solution would be to create custumized MKL interfaces using the mklbuilder Makefile. Can you try this?
Details are there: mpimd-csc/flexiblas#13
The .so file created with this tool is refblas compatible and thus can be loaded as you did it.
The only lingering (and separate) issue here is that flexiblas_get_num_threads does not seem to work when using this customized MKL interface, but this can be solved via export commands.
In the next release (whenever I developed enough new stuff), we include a more extended verision of the text in mpimd-csc/flexiblas#13 including the way to add the MKL.
Activity
Enchufa2 commentedon Mar 18, 2021
Could you paste the output from
sessionInfo(), please? Also, does it fail with a specific backend? Did you use the CRAN package or did you install flexiblas from the system repositories? I haveR-flexiblasinstalled from the system repositories in Fedora 33 and I cannot reproduce the error (with10000).davedgd commentedon Mar 18, 2021
@Enchufa2: thanks for the quick reply!
To clarify, I used the system repositories and tried OpenBLAS and MKL (intel-mkl-2020.0-088) following your R-bloggers guides, which worked perfectly for the benchmark example in the post. The code in the issue works with the default Fedora 33 OpenBLAS backend but fails when switching the backend to MKL. All of this was done with a fresh, fully-updated Fedora install.
I will post my sessionInfo() next time I’m at the computer along with some screenshots. Hopefully I can help replicate this.
davedgd commentedon Mar 18, 2021
Here is the sessionInfo:
I've also attached screenshots showing 1) everything working fine with OpenBLAS; 2) the MKL error; and 3) sessionInfo:
Fine with OpenBLAS

Error with MKL

sessionInfo

davedgd commentedon Mar 18, 2021
Sorry, one more screenshot showing how everything is oddly fine with the R-bloggers code:
Enchufa2 commentedon Mar 18, 2021
Thanks for all the details. Strange, indeed. Let's summon @grisuthedragon here, maybe this rings a bell to him.
grisuthedragon commentedon Mar 18, 2021
Never use the MKL_RT interface. That is more (or less) dangerous. The problem is that the
mkl_rt.socontains an interface with a flexible ABI controlled by some environment variables and in this way its interface is not reblas compatible. This causes most of the errors I think. For example one can change the width of an integer and the threading model via environment variables and API calls.The solution would be to create custumized MKL interfaces using the mklbuilder Makefile. Can you try this?
Details are there: mpimd-csc/flexiblas#13
The .so file created with this tool is refblas compatible and thus can be loaded as you did it.
@Enchufa2 yes it ringed a bell ;-)
davedgd commentedon Mar 18, 2021
@grisuthedragon: Yes, perfect! This solution works. I used the following code from your example, but modified for a parallel version:
I am now seeing performance approaching what I should get for MKL (using the
MKL_DEBUG_CPU_TYPE=5workaround for Ryzen):Which compares favorably with OpenBLAS when set equal to the number of physical cores (e.g., 16 for my 3950X):
The only lingering (and separate) issue here is that flexiblas_get_num_threads does not seem to work when using this customized MKL interface, but this can be solved via export commands.
Thank you!
Enchufa2 commentedon Mar 18, 2021
Nice! I should update the post then with these instructions... My bad. :)
davedgd commentedon Mar 18, 2021
No worries! =) I never would have found this easy MKL solution if not for your post (first result in Google atm). Thanks again to both of you!
Enchufa2 commentedon Mar 18, 2021
Let me keep this open to remind me to update the post. ;-)
grisuthedragon commentedon Mar 18, 2021
In the next release (whenever I developed enough new stuff), we include a more extended verision of the text in mpimd-csc/flexiblas#13 including the way to add the MKL.