kahypar / mt-kahypar

Mt-KaHyPar (Multi-Threaded Karlsruhe Hypergraph Partitioner) is a shared-memory multilevel graph and hypergraph partitioner equipped with parallel implementations of techniques used in the best sequential partitioning algorithms. Mt-KaHyPar can partition extremely large hypergraphs very fast and with high quality.
MIT License
126 stars 26 forks source link

Provide CMake option for static library #161

Closed uulm-janbaudisch closed 11 months ago

uulm-janbaudisch commented 1 year ago

This provides the BUILD_SHARED_LIBS option (by default ON) so that libmtkahypar can be built statically by setting it to OFF.

uulm-janbaudisch commented 1 year ago

As mentioned in #159, a static build compiles, but does not actually work right now. It behaves differently from a dynamic build at run time. As my knowledge of this framework is very limited, I am not sure why. The error message when using the static version is:

Could not load mt_kahypar::CoarseningAlgorithm :  multilevel_coarsener

This seems to originate from the CoarsenerFactory / abstract Factory not finding something. While debugging, I found that running the dynamic version showed elements being inserted into Factory._callbacks while the static version did not, probably leading to this error as nothing gets loaded. But I can not figure out why this is happening. Maybe someone has an idea on this issue?

larsgottesbueren commented 1 year ago

As mentioned in #159, a static build compiles, but does not actually work right now. It behaves differently from a dynamic build at run time. As my knowledge of this framework is very limited, I am not sure why. The error message when using the static version is:

Could not load mt_kahypar::CoarseningAlgorithm :  multilevel_coarsener

This seems to originate from the CoarsenerFactory / abstract Factory not finding something. While debugging, I found that running the dynamic version showed elements being inserted into Factory._callbacks while the static version did not, probably leading to this error as nothing gets loaded. But I can not figure out why this is happening. Maybe someone has an idea on this issue?

Tagging @SebastianSchlag who wrote the factories. Is there a way to get the factories / registries to work with a static build? In the current version with hash-maps it is probably difficult to get static initialization / registration.

SebastianSchlag commented 1 year ago

That's interesting. I guess something along the lines of [1] or, to be more precise, in the blogpost [2] that's referenced there should work. I haven't found the time to look into this in detail though yet.

[1] https://stackoverflow.com/questions/59779679/c-library-self-registering-classes-factory-map-empty-in-client-application [2] http://www.nirfriedman.com/2018/04/29/unforgettable-factory/