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

Implement [-t|--threads] command line argument for threads #35108

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

fredrikekre
Copy link
Member

@fredrikekre fredrikekre commented Mar 14, 2020

Implement [-t|--threads] command line argument for specifying the number of Julia threads on startup, fixes #26889.

Regarding #26889 (comment): Currently this does not propagate to workers processes, but this commit enables that: c11d9db

Personally I feel like either case is fine -- for fine grained control you need to use addprocs anyway.

Edit: I updated the PR to propagate number of threads to processes spawned with --procs and/or --machine-file. If you use those arguments in combination (e.g. julia -p2 -t2) is is likely because you want it to propagate. And as before, if you need some other behavior you can customize all you want with addprocs.

@tknopp

This comment has been minimized.

@fredrikekre

This comment has been minimized.

@fredrikekre fredrikekre added multithreading Base.Threads and related functionality parallelism Parallel or distributed computation labels Mar 14, 2020
test/cmdlineargs.jl Outdated Show resolved Hide resolved
test/cmdlineargs.jl Outdated Show resolved Hide resolved
@JeffBezanson JeffBezanson added the triage This should be discussed on a triage call label Apr 9, 2020
@fredrikekre
Copy link
Member Author

Specific questions for triage:

  • How should $ julia --procs 2 --threads 3 behave? Currently 1+ 2 processes with 3 threads each.
  • How should $ JULIA_NUM_THREADS=4 julia --procs 2 --threads 3 behave? Currently 1+ 2 processes with 3 threads each. I think it makes sense that the command line flag takes precedence since it is more "local".
  • What should happen when JULIA_NUM_THREADS are set on the remote machine?

@StefanKarpinski
Copy link
Member

How about --threads always takes precedence; if someone wants to start a different number of threads on each machine, they can set JULIA_NUM_THREADS on each machine without passing --threads to each process. We should also add a feature to the machine file format so that you can indicate how many processes and threads per process on each machine.

@JeffBezanson
Copy link
Member

Triage is ok with what's implemented here. We also might want to eventually phase out the environment variable.

@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Apr 9, 2020
@JeffBezanson JeffBezanson added this to the 1.5 milestone Apr 9, 2020
the number of Julia threads on startup, fixes #26889.
@fredrikekre fredrikekre merged commit a6a2d26 into master Apr 10, 2020
@fredrikekre fredrikekre deleted the fe/--threads branch April 10, 2020 10:04
ztultrebor pushed a commit to ztultrebor/julia that referenced this pull request Apr 17, 2020
staticfloat pushed a commit that referenced this pull request Apr 21, 2020
@oschulz
Copy link
Contributor

oschulz commented May 29, 2020

Closes #18074

Keno pushed a commit that referenced this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality parallelism Parallel or distributed computation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Command Line Option for Number of Threads
7 participants