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
1 changed files with 13 additions and 10 deletions

View File

@ -9,15 +9,9 @@ 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"]
if N > cpuinfo_physicalcores()
warn("Number of specified cores exceeds the physical core count. Performance may suffer.")
end
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
if workers
@ -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