-
Notifications
You must be signed in to change notification settings - Fork 129
Introduce (experimental, unstable) parallel runner for proof harnesses #1726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,6 +148,10 @@ pub struct KaniArgs { | |
| // consumes everything | ||
| pub cbmc_args: Vec<OsString>, | ||
|
|
||
| #[structopt(short, long, requires("enable-unstable"))] | ||
| // consumes everything | ||
| pub jobs: Option<Option<usize>>, | ||
|
|
||
| // Hide option till https://github.com/model-checking/kani/issues/697 is | ||
| // fixed. | ||
| /// Use abstractions for the standard library. | ||
|
|
@@ -226,6 +230,15 @@ impl KaniArgs { | |
| Some(DEFAULT_OBJECT_BITS) | ||
| } | ||
| } | ||
|
|
||
| /// Computes how many threads should be used to verify harnesses. | ||
| pub fn jobs(&self) -> Option<usize> { | ||
| match self.jobs { | ||
| None => Some(1), // no argument, default 1 | ||
| Some(None) => None, // -j | ||
| Some(Some(x)) => Some(x), // -j=x | ||
|
Comment on lines
+236
to
+239
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it worth to create an enum for all these options? Something like:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The double option in the args is a bit confusing imo, but is idiomatic there. The option it returns exactly corresponds to calling |
||
| } | ||
| } | ||
| } | ||
|
|
||
| arg_enum! { | ||
|
|
@@ -365,7 +378,6 @@ impl KaniArgs { | |
| String::new() | ||
| }; | ||
|
|
||
| // `tracing` is not a dependency of `kani-driver`, so we println! here instead. | ||
| println!( | ||
| "Using concrete playback with --randomize-layout.\n\ | ||
| The produced tests will have to be played with the same rustc arguments:\n\ | ||
|
|
@@ -377,29 +389,47 @@ impl KaniArgs { | |
| // TODO: these conflicting flags reflect what's necessary to pass current tests unmodified. | ||
| // We should consider improving the error messages slightly in a later pull request. | ||
| if natives_unwind && extra_unwind { | ||
| Err(Error::with_description( | ||
| return Err(Error::with_description( | ||
| "Conflicting flags: unwind flags provided to kani and in --cbmc-args.", | ||
| ErrorKind::ArgumentConflict, | ||
| )) | ||
| } else if self.cbmc_args.contains(&OsString::from("--function")) { | ||
| Err(Error::with_description( | ||
| )); | ||
| } | ||
| if self.cbmc_args.contains(&OsString::from("--function")) { | ||
| return Err(Error::with_description( | ||
| "Invalid flag: --function should be provided to Kani directly, not via --cbmc-args.", | ||
| ErrorKind::ArgumentConflict, | ||
| )) | ||
| } else if self.quiet && self.concrete_playback == Some(ConcretePlaybackMode::Print) { | ||
| Err(Error::with_description( | ||
| )); | ||
| } | ||
| if self.quiet && self.concrete_playback == Some(ConcretePlaybackMode::Print) { | ||
| return Err(Error::with_description( | ||
| "Conflicting options: --concrete-playback=print and --quiet.", | ||
| ErrorKind::ArgumentConflict, | ||
| )) | ||
| } else if self.concrete_playback.is_some() && self.output_format == OutputFormat::Old { | ||
| Err(Error::with_description( | ||
| )); | ||
| } | ||
| if self.concrete_playback.is_some() && self.output_format == OutputFormat::Old { | ||
| return Err(Error::with_description( | ||
| "Conflicting options: --concrete-playback isn't compatible with \ | ||
| --output-format=old.", | ||
| ErrorKind::ArgumentConflict, | ||
| )) | ||
| } else { | ||
| Ok(()) | ||
| )); | ||
| } | ||
| if self.concrete_playback.is_some() && self.jobs() != Some(1) { | ||
| // Concrete playback currently embeds a lot of assumptions about the order in which harnesses get called. | ||
| return Err(Error::with_description( | ||
| "Conflicting options: --concrete-playback isn't compatible with --jobs.", | ||
| ErrorKind::ArgumentConflict, | ||
| )); | ||
|
Comment on lines
+416
to
+421
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't these conflicts be specified as an annotation in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only partially. This allows (Basically this is a semantic check: note the |
||
| } | ||
| if self.jobs.is_some() && self.output_format != OutputFormat::Terse { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more convenient to automatically switch to terse mode (which we want to switch to anyway) when jobs is specified.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it, but:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
| // More verbose output formats make it hard to interpret output right now when run in parallel. | ||
| // This can be removed when we change up how results are printed. | ||
| return Err(Error::with_description( | ||
| "Conflicting options: --jobs requires `--output-format=terse`", | ||
| ErrorKind::ArgumentConflict, | ||
| )); | ||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.