By default, julia only runs single threaded. You need to set the number of julia threads you want to run by setting the JULIA_NUM_THREADS
environment variable before launching julia. For example, on Linux you can do the following:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.1 (2020-04-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> Base.Threads.nthreads()
1
julia> exit()
$ JULIA_NUM_THREADS=4 julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.1 (2020-04-14)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> Base.Threads.nthreads()
4
See the multithreading section of the julia manual for more info.
Personally I think it would be nice to be able to change the number of julia threads on the fly, programmatically, but right now that’s not the case.