separate set_parallel_mthread(N::Int, workers::Bool)
This commit is contained in:
parent
6f0f1d5cc6
commit
788da99d82
19
CPUselect.jl
19
CPUselect.jl
@ -9,16 +9,10 @@ function cpuinfo_physicalcores()
|
||||
return maxcore + 1
|
||||
end
|
||||
|
||||
function set_parallel_mthread(parsed_args; workers=false)
|
||||
|
||||
if parsed_args["cpus"] == nothing
|
||||
N = cpuinfo_physicalcores()
|
||||
else
|
||||
N = parsed_args["cpus"]
|
||||
function set_parallel_mthread(N::Int, workers::Bool)
|
||||
if N > cpuinfo_physicalcores()
|
||||
warn("Number of specified cores exceeds the physical core count. Performance may suffer.")
|
||||
end
|
||||
end
|
||||
|
||||
if workers
|
||||
addprocs(N)
|
||||
@ -28,5 +22,14 @@ function set_parallel_mthread(parsed_args; workers=false)
|
||||
BLAS.set_num_threads(N)
|
||||
info("Using $N threads in BLAS.")
|
||||
|
||||
return N
|
||||
end
|
||||
|
||||
function set_parallel_mthread(parsed_args::Dict; workers=false)
|
||||
if parsed_args["cpus"] == nothing
|
||||
N = cpuinfo_physicalcores()
|
||||
else
|
||||
N = parsed_args["cpus"]
|
||||
end
|
||||
|
||||
set_parallel_mthread(N, workers)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user