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

Support passing auto as the value to the JULIA_NUM_THREADS environment variable #38952

Closed
wants to merge 1 commit into from

Conversation

DilumAluthge
Copy link
Member

With this pull request, if the JULIA_NUM_THREADS environment variable is set to auto, then the number of threads is set automatically to the number of CPU threads. This is similar to the behavior of the --threads=auto command-line flag.

Example usage:

$ export JULIA_NUM_THREADS="auto"
$ ./julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.0-DEV.131 (2020-12-20)
 _/ |\__'_|_|_|\__'_|  |  dpa/julia-num-threads-env-auto/96bc22f8c2 (fork: 1 commits, 0 days)
|__/                   |

julia> Threads.nthreads()
4

julia> ENV["JULIA_NUM_THREADS"]
"auto"

@DilumAluthge DilumAluthge added the multithreading Base.Threads and related functionality label Dec 20, 2020
@vtjnash
Copy link
Member

vtjnash commented Dec 21, 2020

Landed in 684d5fc (with style nits fixed)

@vtjnash vtjnash closed this Dec 21, 2020
@DilumAluthge DilumAluthge deleted the dpa/julia-num-threads-env-auto branch December 21, 2020 19:57
DilumAluthge added a commit that referenced this pull request Dec 29, 2020
DilumAluthge added a commit that referenced this pull request Jan 6, 2021
vtjnash pushed a commit that referenced this pull request Jan 11, 2021
* Update the docs for the `JULIA_NUM_THREADS` environment variable
* Add NEWS for #38952
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Update the docs for the `JULIA_NUM_THREADS` environment variable
* Add NEWS for JuliaLang#38952
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants