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

Corrupted unsorted chunks on sparse array #101

Closed
MaxenceGollier opened this issue May 1, 2024 · 4 comments
Closed

Corrupted unsorted chunks on sparse array #101

MaxenceGollier opened this issue May 1, 2024 · 4 comments

Comments

@MaxenceGollier
Copy link
Contributor

cols.txt
rows.txt
vals.txt

In a problem, I had the following representation of some matrix $A \in \mathbb{R}^{ 361\times 802}$. I have an issue which I think comes from QRMumps. Here is a minimal working example (the .txt files are attached):

using QRMumps, DelimitedFiles
n = 802
m = 361

rows = dropdims(readdlm("rows.txt",Int64);dims =2)
cols = dropdims(readdlm("cols.txt",Int64);dims =2)
vals = dropdims(readdlm("vals.txt");dims =2)

spmat = qrm_spmat_init(m,n,rows,cols,vals; sym=false)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')

returns the error message

free(): corrupted unsorted chunks

[10334] signal (6.-6): Aborted

I have tried this on both Julia 1.10.3 and 1.10.2. I get similar errors on both Linux and Windows, here is my versioninfo() on Ubuntu:

Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

Have you ever seen similar errors ?
I don't know if this is useful but if I cast my sparse array $A$ back to a dense array and then back again to a sparse one I no longer have the error:

A = SparseMatrixCOO(Matrix(SparseMatrixCOO(m,n,rows,cols,vals)))


spmat = qrm_spmat_init(A; sym=false)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')
@amontoison
Copy link
Member

I can reproduce the error:

using QRMumps, DelimitedFiles
m = 361
n = 802

rows = readdlm("rows.txt",Int32)[:]
cols = readdlm("cols.txt",Int32)[:]
vals = readdlm("vals.txt")[:]

spmat = qrm_spmat_init(m,n,rows,cols,vals; sym=false)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')

I don't have any error with a SparseMatrixCSC:

using QRMumps, DelimitedFiles
m = 361
n = 802

rows = readdlm("rows.txt",Int32)[:]
cols = readdlm("cols.txt",Int32)[:]
vals = readdlm("vals.txt")[:]
A = sparse(rows, cols, vals)

spmat = qrm_spmat_init(A; sym=false)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')

If we drop the zeros it works:

using QRMumps, DelimitedFiles
m = 361
n = 802

rows = readdlm("rows.txt",Int32)[:]
cols = readdlm("cols.txt",Int32)[:]
vals = readdlm("vals.txt")[:]
A = sparse(rows, cols, vals)
rows, cols, vals = findnz(A)

spmat = qrm_spmat_init(m,n,rows,cols,vals; sym=false)
spfct = qrm_spfct_init(spmat)
qrm_analyse!(spmat, spfct; transp='t')

@amontoison
Copy link
Member

amontoison commented May 1, 2024

Ok, I found the culprit.
You have duplicate entries in your sparse matrix in COO format (rows, cols, vals).
qr_mumps can't handle them:

julia> t = Tuple{Int32, Int32, Float64}[]
Tuple{Int32, Int32, Float64}[]

julia> for i = 1 : 11252
  push!(t, (rows[i], cols[i], vals[i]))
end

julia> t
11252-element Vector{Tuple{Int32, Int32, Float64}}:
 ...

julia> unique(t)
6274-element Vector{Tuple{Int32, Int32, Float64}}:
...

@MaxenceGollier
Copy link
Contributor Author

Many thanks !!
This array came from the package PDENLPModels.jl, I am opening an issue there to fix this.

@dpo
Copy link
Member

dpo commented Jun 25, 2024

@abuttari This is the discussion where it appears QRMumps does not support duplicate entries in COO format, which I found quite surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants