separate set_parallel_mthread(N::Int, workers::Bool)

This commit is contained in:
kalmarek 2018-08-08 00:16:05 +02:00
parent 6f0f1d5cc6
commit 788da99d82

View File

@ -9,15 +9,9 @@ function cpuinfo_physicalcores()
return maxcore + 1 return maxcore + 1
end end
function set_parallel_mthread(parsed_args; workers=false) function set_parallel_mthread(N::Int, workers::Bool)
if N > cpuinfo_physicalcores()
if parsed_args["cpus"] == nothing warn("Number of specified cores exceeds the physical core count. Performance may suffer.")
N = cpuinfo_physicalcores()
else
N = parsed_args["cpus"]
if N > cpuinfo_physicalcores()
warn("Number of specified cores exceeds the physical core count. Performance may suffer.")
end
end end
if workers if workers
@ -28,5 +22,14 @@ function set_parallel_mthread(parsed_args; workers=false)
BLAS.set_num_threads(N) BLAS.set_num_threads(N)
info("Using $N threads in BLAS.") 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 end