From 8e62f8f11d7f6675c88318f349271b2ec135e68f Mon Sep 17 00:00:00 2001 From: Stephan Hilb <stephan@ecshi.net> Date: Sat, 10 Sep 2022 23:19:35 +0200 Subject: [PATCH] fix parallel scaling experiment --- scripts/run.jl | 2 ++ scripts/run_experiments.jl | 8 +++++--- src/problems.jl | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/run.jl b/scripts/run.jl index 7b6c767..c45cd5c 100644 --- a/scripts/run.jl +++ b/scripts/run.jl @@ -14,4 +14,6 @@ ctx(experiment_surrogate_outerinner_ref, "surrogate/outerinner_ref") ctx(experiment_global_basic, "global/basic") +# note: run these with multiple worker processes +# don't forget `@everywhere Pkg.activate(".")` ctx(experiment_scaling_opticalflow, "scaling/opticalflow") diff --git a/scripts/run_experiments.jl b/scripts/run_experiments.jl index 27f72d5..73f6362 100644 --- a/scripts/run_experiments.jl +++ b/scripts/run_experiments.jl @@ -270,7 +270,7 @@ function experiment_scaling_opticalflow(ctx) β = 0.001 ninner = 300 - Mdir = 2 * floor(Int, sqrt(nworkers())) + Mdir = 2 * floor(Int, sqrt(nworkers())) # to have enough workers available M = (Mdir, Mdir) overlap = (5, 5) @@ -301,10 +301,12 @@ function experiment_scaling_opticalflow(ctx) tg = timeit(galg) + nparallel = prod(M) ÷ 2^2 ws = workers() + @assert nparallel <= length(ws) df = DataFrame() - for np in 0:Mdir÷2 - nw = 2^np + for nw in 1:nparallel + nparallel % nw == 0 || continue push!(df, ( nworkers = nw, time = timeit(dalg(ws[1:nw])))) diff --git a/src/problems.jl b/src/problems.jl index 716c76e..c766c95 100644 --- a/src/problems.jl +++ b/src/problems.jl @@ -20,11 +20,12 @@ DualTVL1ROFOpProblem(g, B, λ::Real) = DualTVL1ROFOpProblem(g, B, fill!(similar( function energy(p, prob::DualTVL1ROFOpProblem) d = ndims(p) - @inline kfΛ(w) = @inbounds divergence(w) + prob.g[w.position] + @inline kfΛ(w) = @inbounds divergence(w) kΛ = Kernel{ntuple(_->-1:1, d)}(kfΛ) # v = div(p) + g v = map(kΛ, extend(p, ExtensionNothing())) + v .+= prob.g # |v|_B^2 u = prob.B * vec(v) -- GitLab