Skip to content

Add CMake build system, CLI, and project infrastructure - #1

Merged
henrixapp merged 18 commits into
mainfrom
cmake-switch
Mar 9, 2026
Merged

Add CMake build system, CLI, and project infrastructure#1
henrixapp merged 18 commits into
mainfrom
cmake-switch

Conversation

@schulzchristian

Copy link
Copy Markdown
Contributor

Summary

  • CMake build system alongside existing Bazel, with all dependencies fetched via FetchContent (Abseil, Protobuf, GoogleTest, Easylogging++, wide-integer)
  • bmatching_cli -- user-friendly CLI with flag-based interface replacing verbose textproto input
  • compile.sh -- one-command build script using all CPU cores
  • GitHub Actions CI -- build (Release/Debug) + smoke tests on every push
  • Release workflow -- automatically builds and uploads Linux binaries on tag push
  • Homebrew tap -- brew install --HEAD HeiHGM/bmatching/bmatching
  • Example graphs bundled in examples/ for instant tryout
  • README rewrite -- badges, citation, CLI examples for every algorithm, no proto/Bazel references
  • Regression tests -- 45/45 tests verify CMake CLI matches Bazel output exactly

Test plan

  • All 45 regression tests pass (Bazel vs CMake output identical)
  • CI passes on GitHub Actions
  • Verify brew install --HEAD HeiHGM/bmatching/bmatching works
  • Tag v1.0.0 and verify release workflow produces binary

FetchContent-based CMake build that mirrors all Bazel targets including
optional features (Gurobi, SCIP, bSuitor, Karp-Sipser, hashing, tcmalloc).
Generates build-info.h and hashing-config.h, compiles app_io.proto, and
builds all core binaries: app, runner, fork_runner, generate_experiment_config,
binary_to_textproto.
Replaces verbose textproto input with clean CLI flags:
  --graph, --algorithms, --capacity, --ordering_method, --timeout, etc.
Supports all algorithm pipelines (greedy, reductions, ils, ilp_exact,
presolved_ilp, scip, local_improvement, unfold) and output formats
(text, json, binary). Uses OBJECT library for algorithm_impl_lib to
ensure all REGISTER_IMPL statics are linked.
Includes compare.sh script, 3 test hypergraph instances, and report
showing 45/45 tests pass across greedy (5 orderings), reductions+unfold,
and reductions+greedy+unfold pipelines at capacities 1/3/5.
- Bundle small.hgr and weighted.hgr example graphs for instant tryout
- Add GitHub Actions CI: build (Release/Debug) + smoke test + unit tests
- Add release workflow: builds and uploads Linux binary on tag push
- Update README Quick Start to use bundled examples, add CI badge
Tap repo: HeiHGM/homebrew-bmatching
Comment thread app/cli.cc Outdated
Comment on lines +90 to +103
std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> tokens;
std::istringstream stream(s);
std::string token;
while (std::getline(stream, token, delim)) {
// Trim whitespace
size_t start = token.find_first_not_of(" \t");
size_t end = token.find_last_not_of(" \t");
if (start != std::string::npos) {
tokens.push_back(token.substr(start, end - start + 1));
}
}
return tokens;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use absl::StrSplit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we can use this.

Comment thread app/cli.cc Outdated
Comment on lines +110 to +111
(*config.mutable_string_params())["ordering_method"] =
absl::GetFlag(FLAGS_ordering_method);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of (*config.mutable_string_params())["ordering_method"] = ...
use config.mutable_string_params()->insert({"key","value"});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what you mean with nit

Comment thread build_regression/compare.sh Outdated
Comment on lines +101 to +105
for cap in 1 3; do
run_test "$graph" "reductions+unfold" "$cap" \
"command:\"run\" hypergraph { file_path:\"$graph\" format:\"hgr\" } config { algorithm_configs { algorithm_name:\"reductions\" string_params{key:\"assume_sorted\" value:\"true\"} } algorithm_configs { algorithm_name:\"unfold\" string_params{key:\"assume_sorted\" value:\"true\"} } capacity:$cap short_name:\"test\" }" \
"--graph $graph --algorithms reductions,unfold --capacity $cap"
done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test does not make sense. Why should you run reductions and directly unfold? unfold requires decisions made from other algorithms in between.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to remove; AI slop

Comment thread build_regression/report.txt Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the report file as artifact in the repository.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, lets remove it; had in the repo mainly for you.

Comment thread README.md Outdated
[![DOI](https://img.shields.io/badge/DOI-10.7155%2Fjgaa.v30i1.3166-green.svg)](https://doi.org/10.7155/jgaa.v30i1.3166)

**Engineering Hypergraph $b$-Matching Algorithms**
**Tame your hypergraphs -- fast, modular b-matching at any scale.**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modular in this context could be mistaken for submodular.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread app/cli.cc Outdated
Comment thread CMakeLists.txt Outdated
option(BMATCHING_USE_KARP_SIPSER "Enable Karp-Sipser algorithm" OFF)
option(BMATCHING_USE_HASHING "Enable hashing support (wide-integer)" OFF)
option(BMATCHING_USE_TCMALLOC "Use tcmalloc from gperftools" OFF)
option(BMATCHING_ENABLE_LOGGING "Enable easylogging++ logging output" ON)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not enable this by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread README.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I acknowledge that the readme before was a bit unorganized.

However, I believe that the new state is not helpful, as it erases all information on how to reproduce experiments and use the runner framework. Maybe this can be moved into a different doc file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a folder with reproducability/reproducability.md; in any case, there is the zenodo link right? we can mention that in the readme too.

- Use absl::StrSplit instead of custom split() function
- Use proto map insert() instead of operator[] for params
- Fix --inplace flag description (uses newer ILS interface)
- Remove nonsensical reductions+unfold test case
- Delete report.txt build artifact
- Change BMATCHING_ENABLE_LOGGING default to OFF
- Fix tagline: "flexible" instead of "modular"
- Add Zenodo data link and reproducibility docs
@schulzchristian

Copy link
Copy Markdown
Contributor Author

Review feedback addressed

  • Use absl::StrSplit instead of custom split() function
  • Use proto map insert() instead of operator[] for params
  • Fix --inplace flag description (uses newer ILS interface)
  • Remove nonsensical reductions+unfold test case
  • Delete build_regression/ directory (compare.sh, report.txt, testdata)
  • Change BMATCHING_ENABLE_LOGGING default to OFF
  • Fix tagline: "flexible" instead of "modular"
  • Add Zenodo data link and reproducibility/reproducibility.md

Comment thread reproducibility/reproducibility.md Outdated
## 5. Plot Results

```sh
python3 tools/plot/plot.py <path_to_experiment> <path_to_experiment>/visualisation.textproto

@henrixapp henrixapp Mar 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The python plotting tool is out of date (only the C++ version works correctly).
So this should be:
bazel run -c opt tools/plot:plot_cc <path_to_experiment> <path_to_experiment>/visualisation.textproto

or add pybind/matplotlibcpp17 bindings and use CMake

@henrixapp
henrixapp merged commit 7f0ef58 into main Mar 9, 2026
6 checks passed
@schulzchristian
schulzchristian deleted the cmake-switch branch March 9, 2026 13:54
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

Successfully merging this pull request may close these issues.

2 participants