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") include("CPUselect.jl")
set_parallel_mthread(parsed_args) set_parallel_mthread(parsed_args, workers=true)
include("SAutFNs.jl") include("SAutFNs.jl")
include("Orbit.jl") include("Orbit.jl")

View File

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

View File

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