diff --git a/README.md b/README.md index a9382bd2db7766466b43b33a0677d79121945dee..f7752ede11c9f4ed793797abf1b5005dc21718f6 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,18 @@ Read and use at your own risk. [1] Stephan Hilb and Andreas Langer. 'A General Decomposition Method for a Convex Problem Related to Total Variation Minimization'. In preparation. 2022 + +## Getting started + +1. `julia --project=scripts/` +2. `]instantiate` +3. execute statements in `include("scripts/run.jl")`. There is a memory leak + currently, so the Julia session should better be restarted after every + experiment. + +### Running parallel scaling tests + +1. start Julia with e.g. `julia -p 9 --project=scripts/` +2. `@everywhere using Pkg` +3. `@everywhere Pkg.activate("scripts/")` +4. as above diff --git a/scripts/run_experiments.jl b/scripts/run_experiments.jl index df8f51d33921e42a0405533314205e8260b8b30e..6c4e7c7c901fde0ea0888ec8edafea29c5b7d689 100644 --- a/scripts/run_experiments.jl +++ b/scripts/run_experiments.jl @@ -8,6 +8,7 @@ using CSV using Colors: HSV using DataFrames using Distributed +@everywhere using DualTVDD @everywhere using DualTVDD: DualTVL1ROFOpProblem, DualTVDDAlgorithm, ChambolleAlgorithm, NStepAlgorithm, ProjGradAlgorithm,# TVNewtonAlgorithm, @@ -60,7 +61,7 @@ function halve(img) return res end -# Problems +# Problem Definitions function DenoiseProblem(img::AbstractArray{T,d}; λ, β = 0.) where {T,d} B = (1 + β) * I @@ -73,9 +74,6 @@ function InpaintProblem(img::AbstractArray{T,d}, imgmask::AbstractArray{Bool,d}; pwop = imgmask .+ β .* Ref(I) B = Diagonal(vec(inv.(pwop))) - ## we grey-out the inpainting area. - ## since β > 0 this actually matters and should be a sane default - #g = imgmask .* img .+ .!imgmask .* 0.5 g = imgmask .* img return DualTVL1ROFOpProblem(g, B, λ) end @@ -280,21 +278,17 @@ function experiment_scaling_opticalflow(ctx) ntimings = 3 prob = OptFlowProblem(f0, f1; λ, β) - #return prob galg = ChambolleAlgorithm(prob) - dalg(workers) = - DualTVDDAlgorithm(prob; - workers, M, overlap, ninner, parallel=false, σ=1., - subalg = x -> ChambolleAlgorithm(x)) + alg_ddseq(workers) = DualTVDDAlgorithm(prob; workers, M, overlap, ninner, parallel = false, σ = 1., subalg = x -> ChambolleAlgorithm(x)) + alg_ddpar(workers) = DualTVDDAlgorithm(prob; workers, M, overlap, ninner, parallel = true, σ = 0.25, subalg = x -> ChambolleAlgorithm(x)) function timeit(alg) - # precompile + # warmup for precompilation run_while((_, _) -> false, alg) times = map(1:ntimings) do _ return @elapsed run_while(alg) do st, k - # min ~107 return energy(fetch(st), prob) > stopenergy end end @@ -311,13 +305,14 @@ function experiment_scaling_opticalflow(ctx) nparallel % nw == 0 || continue push!(df, ( nworkers = nw, - time = timeit(dalg(ws[1:nw])))) + time_ddseq = timeit(alg_ddseq(ws[1:nw])), + time_ddpar = timeit(alg_ddpar(ws[1:nw])) + )) end display(df) CSV.write(joinpath(ctx.outdir, "timings.csv"), df) - #saveimg(joinpath(ctx.outdir, "output_glob.png"), fetch_u(states.glob)) savedata(joinpath(ctx.outdir, "data.tex"); lambda=λ, beta=β, Mdir, M=prod(M), ntimings, stopenergy, ninner, @@ -372,7 +367,7 @@ function _experiment_surrogate_outerinner(ctx, ref) #residual = residual(fetch(state), prob), ) end - display(df) + #display(df) CSV.write(joinpath(ctx.outdir, "energies.csv"), df) #saveimg(joinpath(ctx.outdir, "output_glob.png"), fetch_u(states.glob))