add workers keyword

This commit is contained in:
kalmarek 2017-12-21 13:01:38 +01:00
parent 515d8e0e14
commit 14cfc06b7e
3 changed files with 8 additions and 6 deletions

View File

@ -43,7 +43,7 @@ parsed_args = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(parsed_args)
set_parallel_mthread(parsed_args, workers=true)
include("SAutFNs.jl")
include("Orbit.jl")

View File

@ -9,7 +9,7 @@ function cpuinfo_physicalcores()
return maxcore + 1
end
function set_parallel_mthread(parsed_args)
function set_parallel_mthread(parsed_args; workers=false)
if parsed_args["cpus"] == nothing
N = cpuinfo_physicalcores()
@ -20,11 +20,13 @@ function set_parallel_mthread(parsed_args)
end
end
info("Using $N cpus in @parallel code.")
info("Using $(Threads.nthreads()) threads in @threads code.")
if workers
addprocs(N)
info("Using $N cpus in @parallel code.")
end
info("Using $(Threads.nthreads()) threads in @threads code.")
BLAS.set_num_threads(N)
info("Using $N threads in BLAS.")
return N
end

View File

@ -50,7 +50,7 @@ parsed_args = parse_commandline()
include("CPUselect.jl")
set_parallel_mthread(parsed_args)
set_parallel_mthread(parsed_args, workers=true)
include("SLNs.jl")
include("Orbit.jl")