I want to obtain the number of cores available in Julia. Currently I am doing the following:
using PyCall
@pyimport psutil
nCores = psutil.cpu_count()
This calls a Python function. I would like, however, to use some Julia procedure. How can it be done?
I'm not 100% certain about this, but CPU_CORES
returns the number of (hyper-threading) cores on my machine (OSX 10.9.5 and Julia 0.3.5), even when I start Julia in serial mode. I've been checking the number of available cores using nworkers()
and nprocs()
. Starting up Julia without the -p
flag this returns 1 for both.
When I start julia as julia -p 4
julia> nprocs()
5
julia> nworkers()
4
In both cases CPU_CORES
returns 8.