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

Support Int64 indices #42

Open
urchgene opened this issue Mar 7, 2019 · 6 comments
Open

Support Int64 indices #42

urchgene opened this issue Mar 7, 2019 · 6 comments

Comments

@urchgene
Copy link

urchgene commented Mar 7, 2019

@dpo I am using MUMPS to solve a linear systems and I get this error:

ERROR: LoadError: InexactError: trunc(Int32, 2147580541)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Any, ::Int64) at ./boot.jl:567
 [2] checked_trunc_sint at ./boot.jl:589 [inlined]
 [3] toInt32 at ./boot.jl:626 [inlined]
 [4] Type at ./boot.jl:716 [inlined]
 [5] convert at ./number.jl:7 [inlined]
 [6] setindex! at ./array.jl:769 [inlined]
 [7] copyto!(::IndexLinear, ::Array{Int32,1}, ::IndexLinear, ::Array{Int64,1}) at ./abstractarray.jl:731
 [8] Type at ./abstractarray.jl:723 [inlined]
 [9] convert at ./array.jl:489 [inlined]
 [10] Type at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SparseArrays/src/sparsematrix.jl:365 [inlined]
 [11] convert at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SparseArrays/src/sparsematrix.jl:430 [inlined]
 [12] associate_matrix!(::Mumps{Float64}, ::Array{Float64,2}) at /home/ubuntu/MUMPS.jl/src/MUMPS_lib.jl:58
 [13] getBLUPs(::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}, ::Int64, ::Int64, ::Array{Float64,2}, ::Array{Float64,2}) at /home/scripts/getBLUPs.jl:33
 [14] top-level scope at none:0
 [15] include at ./boot.jl:317 [inlined]
 [16] include_relative(::Module, ::String) at ./loading.jl:1041
 [17] include(::Module, ::String) at ./sysimg.jl:29
 [18] exec_options(::Base.JLOptions) at ./client.jl:229
 [19] _start() at ./client.jl:421
in expression starting at /home/scripts/getGEBVs.jl:35

The core of the script was:

### using MUMPS solver out-of-core (OOC)
        MPI.Init();
        mumps = Mumps{Float64}(mumps_unsymmetric, get_icntl(;det=true, verbose=true, ooc=true, itref=0), default_cntl64)
        associate_matrix!(mumps, C)
        factorize!(mumps)
        associate_rhs!(mumps, RHS)
        solve!(mumps)
        theta = get_solution(mumps)
        finalize(mumps)
        MPI.Finalize()

Btw Julia's solver \ works for the same problem.
The exact place the script failed was here associate_matrix!(mumps, C).

Thanks.

Uche.

@dpo
Copy link
Member

dpo commented Mar 7, 2019

ERROR: LoadError: InexactError: trunc(Int32, 2147580541)

@urchgene Is 2147580541 an actual row/column index in your matrix? MUMPS only accepts 32 bit integers, and the error message indicates that this integer is too large.

@dpo
Copy link
Member

dpo commented Mar 7, 2019

Just to add to this, the manual says it's possible to compile MUMPS in 64bit, but all dependent libraries will also have to be compiled with 64 bit integers (BLAS, LAPACK, ScaLAPACK, METIS, SCOTCH, ...). The MUMPS.jl interface will subsequently have to be modified.

@urchgene
Copy link
Author

urchgene commented Mar 7, 2019

@dpo I still don't understand. I doubt my matrix is that large although it is a large problem. Also I am using Julia's Float64 bcos the last time I tried to solve with Float32 matrices passed to MUMPS from Julia, the results were inaccurate.

My question is this:

  1. Should I convert all matrices to Float32 or is this just about the size of the problem?
  2. Why does Julia's solver succeed?

@dpo
Copy link
Member

dpo commented Mar 7, 2019

@urchgene The issue isn't with the values in your matrix but with the integers used to index the nonzeros. It seems at least one of them is too large for a 32bit integer.

Julia's solver might succeed because it calls SuiteSparse, which accepts 64 bit integer indices.

@urchgene
Copy link
Author

urchgene commented Mar 7, 2019

@dpo I see. In that case that might be true. Hmm. That means no fix unless 64 bit integer MUMPS compiled. That is another hurdle.

@dpo
Copy link
Member

dpo commented Mar 7, 2019

It's not difficult but probably a bit tedious because it requires changes in several places. If you managed to compile your own MUMPS/ScaLAPACK/BLAS/METIS with 64bit Int support, changing MUMPS.jl isn't difficult. I'd also need to change libmumps_simple.

@dpo dpo added the enhancement label Mar 8, 2019
@dpo dpo changed the title Inexact error using MUMPS.jl Support Int64 indices Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants