Skip to content
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

LAPACK hangs when matrix elements are not finite #425

Closed
atteson opened this issue May 9, 2017 · 13 comments
Closed

LAPACK hangs when matrix elements are not finite #425

atteson opened this issue May 9, 2017 · 13 comments
Labels
upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@atteson
Copy link

atteson commented May 9, 2017

julia hangs on the following:

pinv([0.0 NaN; NaN Inf])

I don't expect it to return something meaningful but an uninterruptible hang doesn't seem right.

@andreasnoack
Copy link
Member

versioninfo() please.

@atteson
Copy link
Author

atteson commented May 9, 2017

I've tried it on the 2 versions below:

Julia Version 0.5.0
Commit 3c9d75391c (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)


Julia Version 0.6.0-pre.beta.0
Commit bd84fa1bad (2017-03-31 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

@andreasnoack
Copy link
Member

andreasnoack commented May 9, 2017

LAPACK doesn't like NaNs. The SVD solvers hang. MKL seems to handle this but not netlib LAPACK so we might need to all(isfinite, A) || error() in most of the LAPACK calls.

@andreasnoack andreasnoack changed the title julia hangs LAPACK hangs when matrix elements are not finite May 9, 2017
@atteson
Copy link
Author

atteson commented May 9, 2017

Thanks. I had a feeling it was in LAPACK.

I did the same check in my code so I'm fine for now. I just wanted to inform you.

I recognize that for some calls, checking could be a bit of a performance hit but it seems better than the alternative to me.

@nalimilan
Copy link
Member

This reminds me of this recent R thread (see in particular the excerpt from NEWS in the middle of the thread).

Also see this blog post.

@ararslan ararslan added linear algebra upstream The issue is with an upstream dependency, e.g. LLVM labels May 9, 2017
@simonbyrne
Copy link
Contributor

Wow, R apparently patch their own BLAS for this reason: http://icl.cs.utk.edu/lapack-forum/archives/lapack/msg01536.html

@simonbyrne
Copy link
Contributor

What is LAPACK policy on NaNs? is this a bug?

@simonbyrne
Copy link
Contributor

@andreasnoack
Copy link
Member

@langou
Copy link

langou commented May 18, 2017

Hello, thanks for the thread. I think I fixed the issue with Reference-LAPACK/lapack@a1e853b. It would be great if you can confirm whether Reference-LAPACK/lapack@a1e853b fixes the infinite loop observed in julia with pinv([0.0 NaN; NaN Inf]) or not. Happy to have feedback on the fix and work on the issue some more if needed, just let us know. Best wishes, Julien.

@andreasnoack
Copy link
Member

@langou Great. Thanks for looking into this. I've just tested with the latest version of LAPACK. It fixes the issue here and the routine returns arrays of NaNs so it looks like we are all set.

@ViralBShah
Copy link
Member

We are now using openblas 0.3 and lapack 3.8, and I don't see the issue.

julia> pinv([0.0 NaN; NaN Inf])
2×2 Array{Float64,2}:
 NaN  NaN
 NaN  NaN

@nalimilan
Copy link
Member

Better add a test before closing though?

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

No branches or pull requests

7 participants