Skip to content

Commit 3e8bae7

Browse files
Force optimization for builtin Metis (#31)
A new force-optimize-vendor feature, on by default, force metis to always be compiled as optimized. The goal is to not slow down users that use dev or debug profiles. Fix #19.
1 parent 8f19d39 commit 3e8bae7

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
[metis-sys-0.2.0...0.2.1](https://github.com/LIHPC-Computational-Geometry/metis-rs/compare/metis-0.2.0...metis-0.2.1)
66

7+
### Added
8+
9+
- `force-optimize-vendor` feature for `metis-sys` to force builtin metis to be compiled as optimized, even for debug or
10+
dev profiles [#31](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/31)
11+
712
### Fixed
813

914
- move `vendor` library in `metis-sys` [#29](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/29)
@@ -14,14 +19,17 @@
1419

1520
### Added
1621

17-
- Builtin metis with the new `vendored` feature, enabled by default [#16](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/16)
22+
- Builtin metis with the new `vendored` feature, enabled by
23+
default [#16](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/16)
1824
- Convert from sprs matrices [#10](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/10)
1925
- Add unchecked constructors [#13](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/13)
2026

2127
### Changed
2228

23-
- Remove mutability requirement on input from public facing API [#18](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/18)
24-
- Remove numbering feature, now only Rust (or C) 0-based arrays are supported [#13](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/13)
29+
- Remove mutability requirement on input from public facing
30+
API [#18](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/18)
31+
- Remove numbering feature, now only Rust (or C) 0-based arrays are
32+
supported [#13](https://github.com/LIHPC-Computational-Geometry/metis-rs/pull/13)
2533

2634
### Documentation
2735

metis-sys/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = ["graph", "mesh", "matrix", "partitioning", "ordering"]
1212

1313

1414
[features]
15-
default = ["vendored"]
15+
default = ["vendored", "force-optimize-vendor"]
1616

1717
# Build and statically link to METIS and GKLib.
1818
vendored = ["dep:cc"]
@@ -24,6 +24,10 @@ use-system = ["bindgen"]
2424
# directory. Also enables "vendored".
2525
generate-bindings = ["vendored", "bindgen"]
2626

27+
# Force Metis to be optimized and to not follow the current profile for Rust
28+
# Therefore, debug or dev build lead to correct performance.
29+
force-optimize-vendor = ["vendored"]
30+
2731
[build-dependencies]
2832
bindgen = { version = "0.69", default-features = false, features = ["runtime"], optional = true }
2933
cc = { version = "1", features = ["parallel"], optional = true }

metis-sys/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,11 @@ fn build_lib() {
126126
build.define("MACOS", None);
127127
}
128128

129-
#[cfg(not(debug_assertions))]
130-
build.flag("-DNDEBUG").flag("-DNDEBUG2");
129+
#[cfg(any(not(debug_assertions), feature = "force-optimize-vendor"))]
130+
build.define("NDEBUG", None).define("NDEBUG2", None);
131+
132+
#[cfg(feature = "force-optimize-vendor")]
133+
build.no_default_flags(true).opt_level(3).debug(false);
131134

132135
// METIS triggers an infinite amount of warnings and showing them to users
133136
// downstream does not really help.

0 commit comments

Comments
 (0)