forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parallelize & Partition Verification (rust-lang#229)
Shard Kani verification workflow across multiple runners by: 1. Running `kani list --format json`, which outputs a JSON file like this: ```json { "kani-version": "0.56.0", "file-version": "0.1", "standard-harnesses": { "src/lib.rs": [ "proof3", "verify::proof2" ], "src/test.rs": [ "test::proof4", "test::proof5" ] }, "contract-harnesses": { "src/lib.rs": [ "proof" ] }, "contracts": [ { "function": "bar", "file": "src/lib.rs", "harnesses": [ "proof" ] } ], "totals": { "standard-harnesses": 4, "contract-harnesses": 1, "functions-under-contract": 1 } } ``` 2. Extracting the harnesses inside `"standard-harnesses"` and `"contract-harnesses"` into an array called `ALL_HARNESSES` and the length of that array into `HARNESS_COUNT`. (So in this example, `ALL_HARNESSES = [proof3, verify::proof2, test::proof4, test::proof5, proof]` and `HARNESS_COUNT=5`). 3. Dividing the harnesses evenly between four workers. For example, if worker 1's harnesses are `proof3` and `verify::proof2`, then we call `kani verify-std --harness proof3 --harness verify::proof2 --exact`. The `--exact` makes Kani look for the exact harness name. This is important so that we don't match on partial patterns, e.g., if there is a harness called "foo" and a harness called "foo_bar", passing `--harness foo` without `--exact` would match against both harnesses, and then `foo_bar` would run twice. 4. Also parallelize verification within a single runner by passing `-j` to Kani. I chose four workers somewhat arbitrarily--it makes each worker take about 45 minutes to an hour to finish. I thought it was good to have a balance between too few workers (which still makes us wait a while) and too many workers (which makes you look through more logs to find where a given harness is being verified). But happy to play with this number if people have opinions. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
- Loading branch information
1 parent
866a195
commit 67e2f1c
Showing
2 changed files
with
106 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters