New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLAS/LAPACK routine 'DLASCL' gave error code -4 #2
Comments
Could you paste the output from |
@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. |
Here is the sessionInfo: > sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 33 (Cinnamon)
Matrix products: default
BLAS/LAPACK: /usr/lib64/libflexiblas.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] flexiblas_3.0.0
loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4 I've also attached screenshots showing 1) everything working fine with OpenBLAS; 2) the MKL error; and 3) sessionInfo: |
Thanks for all the details. Strange, indeed. Let's summon @grisuthedragon here, maybe this rings a bell to him. |
Never use the MKL_RT interface. That is more (or less) dangerous. The problem is that the The solution would be to create custumized MKL interfaces using the mklbuilder Makefile. Can you try this? 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 ;-) |
@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 > flexiblas_list_loaded()
[1] "OPENBLAS-OPENMP"
[2] "/home/daved/Downloads/flexiblas_mkl_parallel.so"
>
> flexiblas_switch(2)
> flexiblas_current_backend()
[1] "/home/daved/Downloads/flexiblas_mkl_parallel.so"
>
> flexiblas_set_num_threads(16)
>
> m <- 10000
> n <- 2000
> A <- matrix (runif (m*n),m,n)
> system.time (S <- svd (A,nu=0,nv=0))
user system elapsed
15.487 0.181 2.294
>
> flexiblas_get_num_threads()
[1] 1 Which compares favorably with OpenBLAS when set equal to the number of physical cores (e.g., 16 for my 3950X): > flexiblas_list_loaded()
[1] "OPENBLAS-OPENMP"
[2] "/home/daved/Downloads/flexiblas_mkl_parallel.so"
>
> flexiblas_switch(1)
> flexiblas_current_backend()
[1] "OPENBLAS-OPENMP"
>
> flexiblas_set_num_threads(16)
>
> m <- 10000
> n <- 2000
> A <- matrix (runif (m*n),m,n)
> system.time (S <- svd (A,nu=0,nv=0))
user system elapsed
28.464 3.108 2.869
>
> flexiblas_get_num_threads()
[1] 16 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! |
Nice! I should update the post then with these instructions... My bad. :) |
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! |
Let me keep this open to remind me to update the post. ;-) |
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. |
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 to1000
here instead of10000
as in the StackOverflow original since it errors quickly):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.
The text was updated successfully, but these errors were encountered: