Open magneticflux- opened 1 month ago
Played around a bit locally and came up with this:
diff --git a/packages/gcg.nix b/packages/gcg.nix
index 38911e2..1ba3b8c 100644
--- a/packages/gcg.nix
+++ b/packages/gcg.nix
@@ -25,6 +25,8 @@ in
in
builtins.concatStringsSep "." matches;
+ cmakeFlags = [ "-DHMETIS=ON" ];
+
nativeBuildInputs = with pkgs; [
cmake
git # to obtain git commit hash
@@ -54,6 +56,21 @@ in
for file in ${builtins.concatStringsSep " " debugFiles}; do
sed -i '1s/^/#define SCIP_DEBUG\n/' $file
done
+
+ # Fix `zsh` path
+ substituteInPlace \
+ src/gcg/dec_hcgpartition.cpp src/gcg/dec_hrgpartition.cpp src/gcg/dec_hrcgpartition.cpp \
+ --replace-fail "zsh -c" "${pkgs.zsh}/bin/zsh -c"
+
+ # Fix `hmetis` path (it will be installed there later)
+ substituteInPlace \
+ src/hmetis.h.in \
+ --replace-fail "@HMETIS_EXECUTABLE@" "$out/bin/hmetis"
+ '';
+
+ postInstall = ''
+ # Install `hmetis` binary where it was expected
+ install -Dm755 $src/hmetis -t $out/bin
'';
enableParallelBuilding = true;
It would be better to have hMetis's code on GitHub and build it from source, but this works for now. I found some old email communication with Dr. George Karypis on Ubuntu's packaging/licensing of parMetis in 2003, but hMetis is MIA for now: https://launchpad.net/ubuntu/focal/+source/parmetis/+copyright
However, GCG's GitLab CI runs tests with hMetis and it downloads a binary from or.rwth-aachen.de/hmetis/hmetis-2.0pre1.tar.gz.
Given the strict licensing I do not know if this should be public. On the other hand, the x86_64 binary is also in the GitHub and the official site is down...
Due to hMetis being unfree I am somewhat unsure if hMetis should be used by default. I've created #2 for now.
hMetis
is optionally used by GCG for detecting arrowhead structures, but it is unfortunately difficult to track down because the links from SCIP and GCG's sites are currently (and were in the past) dead. However, GCG's GitLab CI runs tests withhMetis
and it downloads a binary from https://or.rwth-aachen.de/hmetis/hmetis-2.0pre1.tar.gz.The included license is as follows:
GCG also says it requires
zsh
to enforce memory and runtime limitations (which is hilariously jank, but what can we do?)