Skip to content

Update scheduler options#1364

Merged
sporksmith merged 4 commits intoshadow:devfrom
sporksmith:sched-options
May 18, 2021
Merged

Update scheduler options#1364
sporksmith merged 4 commits intoshadow:devfrom
sporksmith:sched-options

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

  • The Experimental option max-concurrency is now the General option parallelism.
  • The default scheduler policy is now Host.
  • The General option workers is now the Experimental option worker-threads, and no longer has the -w shortcut. Users should use parallelism instead. If not set explicitly, the number of worker threads will be set to the number of hosts in the simulation.

@sporksmith sporksmith self-assigned this May 17, 2021
@sporksmith sporksmith linked an issue May 17, 2021 that may be closed by this pull request
@sporksmith sporksmith added Component: Documentation In-repository documentation, under docs/ Component: Main Composing the core Shadow executable Type: Maintenance Refactoring, cleanup, documenation, or process improvements labels May 17, 2021
@sporksmith sporksmith requested a review from robgjansen May 17, 2021 21:29
@codecov
Copy link
Copy Markdown

codecov bot commented May 17, 2021

Codecov Report

Merging #1364 (86c4a7a) into dev (c41f16b) will decrease coverage by 1.08%.
The diff coverage is 66.66%.

❗ Current head 86c4a7a differs from pull request most recent head 0793b98. Consider uploading reports for the commit 0793b98 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1364      +/-   ##
==========================================
- Coverage   56.79%   55.71%   -1.09%     
==========================================
  Files         140      140              
  Lines       20106    20100       -6     
  Branches     4898     4898              
==========================================
- Hits        11420    11199     -221     
- Misses       5832     6047     +215     
  Partials     2854     2854              
Flag Coverage Δ
tests 55.71% <66.66%> (-1.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/core/worker.c 74.01% <50.00%> (-4.19%) ⬇️
src/main/core/scheduler/scheduler.c 71.07% <75.00%> (-3.07%) ⬇️
...in/core/scheduler/scheduler_policy_global_single.c 0.00% <0.00%> (-83.64%) ⬇️
.../main/core/scheduler/scheduler_policy_host_steal.c 0.00% <0.00%> (-83.14%) ⬇️
src/main/core/logger/log_record.c 61.90% <0.00%> (-3.81%) ⬇️
src/main/host/thread_ptrace.c 49.50% <0.00%> (-3.67%) ⬇️
src/main/core/work/event.c 66.66% <0.00%> (-2.78%) ⬇️
src/main/host/affinity.c 73.09% <0.00%> (-2.34%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c41f16b...0793b98. Read the comment docs.

Copy link
Copy Markdown
Member

@robgjansen robgjansen left a comment

Choose a reason for hiding this comment

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

Looks great!

- [`general.data_directory`](#generaldata_directory)
- [`general.heartbeat_interval`](#generalheartbeat_interval)
- [`general.log_level`](#generallog_level)
- [`general.parallelism`](#general_parallelism)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The other options don't have an underscore between the general keyword and the name of the option. I have no idea why not, it's harder to read without the underscore. I assume there was a reason? Do we want to be consistent?

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.

Good catch! Yeah, we don't control how the anchors are generated for the headings, and unfortunately it omits the '.', so this was a broken link.

Comment on lines +114 to +115
How many parallel threads to use to run the simulation. Optimal performance is
usually obtained with `nproc`, or sometimes `nproc/2` with hyperthreading.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to explain what happens if set to null? Or maybe this isn't the place for that?

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.

I don't think there was a way for the user to explicitly set this to NULL. This reminded me though that there was some hidden logic that 0 would be silently treated as 1, and that worker-threads=0 is special.

I cleaned this up by changing parallel to be of type NonZeroU32, and added the documentation about worker-threads=0.

interpose_method: Some(InterposeMethod::Ptrace),
runahead: None,
scheduler_policy: Some(SchedulerPolicy::Steal),
scheduler_policy: Some(SchedulerPolicy::Host),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the [default: "host"] cli help string suffix auto-updated with these changes?

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.

Yup!

Comment on lines +1158 to +1162
// By default use 1 worker per host.
config.hosts.len().try_into().unwrap()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much simpler than I had imagined :)

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.

:)

Parallelism is the right term for how many threads will run
simultaneously, *not* concurrency.

Expose this as a general option, in preparation for making the concrete
number of worker threads to actually create an experimental option.
The exact number of threads to use is now an implementation detail.
What end users generally care about is how many to run in parallel,
which is now controlled through the `--parallelism` flag.

This also changes the default number of workers to be the number of
Hosts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Documentation In-repository documentation, under docs/ Component: Main Composing the core Shadow executable Type: Maintenance Refactoring, cleanup, documenation, or process improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rework scheduler options and defaults

2 participants