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