Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------
Expand Down
18 changes: 11 additions & 7 deletions doc/src/manual/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

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

The change to this paragraph should be backported to 1.6.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I'll make a PR to release-1.6 to fix just the part of the paragraph that applies to 1.6.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the PR for 1.6: #39118

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"`,
Expand Down