Unusual error: no method matching lufact!(::SparseMatrixCSC{Float32,Int64}, ::Type{Val{true}})

Greetings,

I am new to Julia and have been looking at using it to solve sparse systems. When I run the following simple code snippet:

A = sprand(Float32, 10, 10, .5);
b = rand(Float32, 10);
A\b

I get the following error:

MethodError: no method matching lufact!(::SparseMatrixCSC{Float32,Int64}, ::Type{Val{true}})
Closest candidates are:
  lufact!(::Union{Base.ReshapedArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T}, DenseArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2}, SubArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2,A,I,L} where L} where I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex, Int64, Range{Int64}},N} where N} where A<:Union{Base.ReshapedArray{T,N,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T} where N where T, DenseArray}, ::Union{Type{Val{false}}, Type{Val{true}}}) where T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64} at linalg\lu.jl:16
  lufact!(::Union{Base.ReshapedArray{T,2,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T}, DenseArray{T,2}, SubArray{T,2,A,I,L} where L} where I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex, Int64, Range{Int64}},N} where N} where A<:Union{Base.ReshapedArray{T,N,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T} where N where T, DenseArray} where T, ::Union{Type{Val{false}}, Type{Val{true}}}) at linalg\lu.jl:31
  lufact!(::Tridiagonal{T}, ::Union{Type{Val{false}}, Type{Val{true}}}) where T at linalg\lu.jl:321

Stacktrace:
 [1] \(::SparseMatrixCSC{Float32,Int64}, ::Array{Float32,1}) at .\sparse\linalg.jl:871
 [2] include_string(::String, ::String) at .\loading.jl:522

Am I doing something incorrectly? Or is there an issue with my Julia install missing a key component? I am running the latest JuliaPro 0.6.2 release on Windows 10 with MKL.

This is the output of my versioninfo()

Julia Version 0.6.2
Commit d386e40c17* (2017-12-13 18:08 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: mkl_rt
  LAPACK: mkl_rt
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

Thanks!

See https://github.com/JuliaLang/julia/issues/25986

Thanks for the reference. Just to make sure I understand the linked issue, " \ " should not be expected to work when the elements are of type Float32? But it should work when I use Float64?

If I run the first part of the sample code in that issue:

a = sprand(Float64, 10, 10, 0.2);
a = a'*a + I;
Symmetric(a) \ rand(10);

I get the error:

MethodError: no method matching lufact!(::Symmetric{Float64,SparseMatrixCSC{Float64,Int64}}, ::Type{Val{true}})
Closest candidates are:
  lufact!(::Union{Base.ReshapedArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T}, DenseArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2}, SubArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2,A,I,L} where L} where I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex, Int64, Range{Int64}},N} where N} where A<:Union{Base.ReshapedArray{T,N,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T} where N where T, DenseArray}, ::Union{Type{Val{false}}, Type{Val{true}}}) where T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64} at linalg\lu.jl:16
  lufact!(::Union{Base.ReshapedArray{T,2,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T}, DenseArray{T,2}, SubArray{T,2,A,I,L} where L} where I<:Tuple{Vararg{Union{Base.AbstractCartesianIndex, Int64, Range{Int64}},N} where N} where A<:Union{Base.ReshapedArray{T,N,A,MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},N} where N} where A<:Union{DenseArray, SubArray{T,N,P,I,true} where I<:Tuple{Union{Base.Slice, UnitRange},Vararg{Any,N} where N} where P where N where T} where N where T, DenseArray} where T, ::Union{Type{Val{false}}, Type{Val{true}}}) at linalg\lu.jl:31
  lufact!(::Tridiagonal{T}, ::Union{Type{Val{false}}, Type{Val{true}}}) where T at linalg\lu.jl:321

Stacktrace:
 [1] \(::Symmetric{Float64,SparseMatrixCSC{Float64,Int64}}, ::Array{Float64,1}) at .\linalg\generic.jl:832
 [2] include_string(::String, ::String) at .\loading.jl:522

Which seems to indicate that it is also not working when the elements are of type Float64. The above code does work in the JuliaBox.com notebook.

So this is just a Windows issue with no possible work around for solving sparse symmetric systems?

Thanks!

This example should definitely work. Could somebody else with a Windows machine please try it? Unfortunately, I currently don’t have access to a Windows machine.

1 Like

Could you report the output of versioninfo()?

Julia Version 0.6.2
Commit d386e40c17* (2017-12-13 18:08 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: mkl_rt
  LAPACK: mkl_rt
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)

FWIW, Works for me on 0.6.2 and 0.7 on Windows. Not sure if the MKL could have anything to do with it.

Thanks, that’s good to know. I suppose I can switch to the “vanilla” version that doesn’t use MKL.

Is there some fundamental reason that this doesn’t work with MKL though? Ultimately it would be nice to be able to leverage the general performance improvements that it gives you.

It works fine with 0.7 on Windows 10.

julia> versioninfo()
Julia Version 0.7.0-DEV.4389
Commit d6edb86bc0* (2018-02-25 21:29 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6650U CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:

Not at all. It should work. We’ll look more into it tomorrow but it would be great if you could confirm that it doesn’t happen for the vanilla version on the same machine.

I can confirm that switching to the vanilla non-MKL version does fix the problem on my system. In case it helps, I have been using the JuliaPro builds. AFAIK these are the only ones that provide MKL support on Windows.

Thanks!

We have identified the problem. Because SuiteSparse has a restrictive license, we have to disable it when shipping JuliaPro+MKL. Hence, sparse solvers are currently not directly available in JuliaPro+MKL. This is indeed unfortunate and we are working on fixing this. Meanwhile, using https://github.com/JuliaSparse/Pardiso.jl is an option.

1 Like

Thanks very much for the update! Definitely looking forward to having MKL+SuiteSparse someday.