Skip to content
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

Add --threads / -j to control number of compute threads #5021

Merged
merged 4 commits into from
Feb 5, 2024

Conversation

emilk
Copy link
Member

@emilk emilk commented Feb 2, 2024

What

You can now control the number of threads in the rayon thread pool using -j or --threads. The default is -2, meaning two less threads than the number of cores. This is to leave some breathing room for other threads the viewer spawns, as well as the rest of the users system.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@emilk emilk added 📉 performance Optimization, memory use, etc CLI Related to the Rerun CLI labels Feb 2, 2024
@emilk emilk marked this pull request as ready for review February 2, 2024 15:45
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

lgtm!
please fix typo and fight me on clippy lint! 😄

Cranky.toml Outdated Show resolved Hide resolved
crates/rerun/src/run.rs Outdated Show resolved Hide resolved
let mut builder = rayon::ThreadPoolBuilder::new().thread_name(|i| format!("rayon-{i}"));

if threads_args < 0 {
match std::thread::available_parallelism() {
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know this method and I absolutely love the concept and its docs. For posterity: https://doc.rust-lang.org/std/thread/fn.available_parallelism.html

crates/rerun/src/run.rs Outdated Show resolved Hide resolved
@emilk emilk merged commit 13f1852 into main Feb 5, 2024
40 checks passed
@emilk emilk deleted the emilk/control-thread-count branch February 5, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Related to the Rerun CLI include in changelog 📉 performance Optimization, memory use, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI argument for setting max number of viewer threads
2 participants