add workers keyword
This commit is contained in:
parent
515d8e0e14
commit
14cfc06b7e
@ -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")
|
||||
|
10
CPUselect.jl
10
CPUselect.jl
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user