Closed gdalle closed 3 weeks ago
libcolpack
is the path to the shared library libcolpack.$dlext
where $dlext
is so
on Linux / FreeBSD, dll
on Windows, and dylib
on Mac. libcolpack
contains all the (compiled) routines of ColPack.
When we create a recipe with Yggdrasil, the JLL package is generated such that the products (libraries or binaries) are exported as Julia variables. The build_tarballs.jl
that is used to cross-compile ColPack is: https://github.com/JuliaPackaging/Yggdrasil/blob/master/C/ColPack/build_tarballs.jl
With @ccall
we can directly call a C or Fortran routine but not C++ ones (except if they only have C-like arguments). If we want to call C++ routines, we need to create a C interface. This is what Michel did with his fork: https://github.com/michel2323/ColPack
We need to update two files:
It seems that Michel already implemented what we want but he got some issues with OpenMP. I found this commit: https://github.com/michel2323/ColPack/commit/e2290dff4dc27985b9c1e5f45ae08e67f488798f It should not be too hard to fix it.
@gdalle I did a few modifications on my fork: https://github.com/amontoison/ColPack/
I just updated the C routine build_coloring
.
Do you need additional modifications / additional C routines?
I also the build system such that the binary ColPack
is available in the JLL:
https://github.com/CSCsw/ColPack/tree/master/Examples
Thanks! I can't judge the modifications to the C++ code though.
To sum up, based on https://github.com/CSCsw/ColPack/tree/master/Examples, all we need from ColPack.jl is:
SparseMatrixCSC
to a matrix format that ColPack in C++ can eat-m
):
STAR
on general graphsCOLUMN_PARTIAL_DISTANCE_TWO
and ROW_PARTIAL_DISTANCE_TWO
on bipartite graphs-o
): NATURAL
, RANDOM
, etc.As long as a function like this is available, I don't care what goes on under the hood:
colpack_coloring(matrix::SparseMatrixCSC, method::Symbol, order::Symbol)
Where does this function come from? What is the
libcolpack
object?https://github.com/exanauts/ColPack.jl/blob/01dd2827473e2424b46323f9307b4c931799e82c/src/colpackcoloring.jl#L95-L103
I don't speak C++ so the ColPack documentation is very foreign to me. And I am not familiar with the
jll
mechanism either.For Jacobian coloring, we would need to access the BipartiteGraph PartialColoringInterface instead (see the ColPack class hierarchy). Here are the three examples we want to reproduce in Julia: