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

Non-deterministic coloring? #21

Open
gdalle opened this issue Jun 11, 2024 · 5 comments
Open

Non-deterministic coloring? #21

gdalle opened this issue Jun 11, 2024 · 5 comments

Comments

@gdalle
Copy link
Collaborator

gdalle commented Jun 11, 2024

Is there an explanation for coloring to be non-deterministic with the natural order?

julia> using ColPack, SparseArrays, StableRNGs

julia> J = sprand(StableRNG(63), 100, 200, 0.04)
100×200 SparseMatrixCSC{Float64, Int64} with 828 stored entries:
...

julia> for i in 1:10
           println(maximum(get_colors(ColPackPartialColoring(J, "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL"))))
       end
19
23
22
21
22
22
23
21
22
22
@gdalle
Copy link
Collaborator Author

gdalle commented Jun 11, 2024

Even more surprising, it's the same with matrix from files:

julia> using MatrixMarket

julia> MatrixMarket.mmwrite("J.mtx", J)

julia> for i in 1:10
           println(maximum(get_colors(ColPackPartialColoring("J.mtx", "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL"))))
       end
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
22
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
23
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
22
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
20
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
22
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
24
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
23
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
23
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
22
Found file J.mtx
Graph of Market Market type: [matrix coordinate real general]
22

@gdalle
Copy link
Collaborator Author

gdalle commented Jun 11, 2024

I just checked that the command line interface of ColPack consistently returns a coloring with 19 colors for that setup, so the problem lies with our Julia - C++ bindings

@amontoison
Copy link
Member

amontoison commented Jun 12, 2024

I checked with the PR #22 and I confirm:

using ColPack, SparseArrays, StableRNGs
using MatrixMarket

J = sprand(StableRNG(63), 100, 200, 0.04)
MatrixMarket.mmwrite("./myfile.mtx", J)

for i in 1:10
    colpack("./myfile.mtx", "ROW_PARTIAL_DISTANCE_TWO", "NATURAL")
end

for i in 1:10
    colpack("./myfile.mtx", "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL")
end


for i in 1:10
  obj = ColPackPartialColoring(J, "ROW_PARTIAL_DISTANCE_TWO", "NATURAL")
  ncolors(obj) |> println
end

for i in 1:10
  obj = ColPackPartialColoring(J, "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL")
  ncolors(obj) |> println
end

@gdalle
Copy link
Collaborator Author

gdalle commented Jun 12, 2024

What do you confirm? That the binary is deterministic and we screwed up somewhere else in the interface?

@amontoison
Copy link
Member

What do you confirm? That the binary is deterministic and we screwed up somewhere else in the interface?

Yes, I did something wrong in the C interface.

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

2 participants