diff --git a/NEWS.md b/NEWS.md index 7793ba31b7f24..f1347a030060c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,7 +18,7 @@ Command-line option changes Multi-threading changes ----------------------- - +* If the `JULIA_NUM_THREADS` environment variable is set to `auto`, then the number of threads will be set to the number of CPU threads ([#38952]) Build system changes -------------------- diff --git a/doc/src/manual/environment-variables.md b/doc/src/manual/environment-variables.md index 597e65510421a..c89a9c6b18321 100644 --- a/doc/src/manual/environment-variables.md +++ b/doc/src/manual/environment-variables.md @@ -190,20 +190,24 @@ a master process to establish a connection before dying. ### [`JULIA_NUM_THREADS`](@id JULIA_NUM_THREADS) An unsigned 64-bit integer (`uint64_t`) that sets the maximum number of threads -available to Julia. If `$JULIA_NUM_THREADS` exceeds the number of available -CPU threads (logical cores), then the number of threads is set to the number of CPU threads. If -`$JULIA_NUM_THREADS` is not positive or is not set, or if the number of CPU -threads cannot be determined through system calls, then the number of threads is -set to `1`. +available to Julia. If `$JULIA_NUM_THREADS` is not positive or is not set, or +if the number of CPU threads cannot be determined through system calls, then the +number of threads is set to `1`. -!!! note +If `$JULIA_NUM_THREADS` is set to `auto`, then the number of threads will be set +to the number of CPU threads. - `JULIA_NUM_THREADS` must be defined before starting julia; defining it in `startup.jl` is too late in the startup process. +!!! note + `JULIA_NUM_THREADS` must be defined before starting julia; defining it in + `startup.jl` is too late in the startup process. !!! compat "Julia 1.5" In Julia 1.5 and above the number of threads can also be specified on startup using the `-t`/`--threads` command line argument. +!!! compat "Julia 1.7" + The `auto` value for `$JULIA_NUM_THREADS` requires Julia 1.7 or above. + ### `JULIA_THREAD_SLEEP_THRESHOLD` If set to a string that starts with the case-insensitive substring `"infinite"`,