Skip to content
Snippets Groups Projects
Commit 74143c2d authored by Stephan Hilb's avatar Stephan Hilb
Browse files

update scaling example

parent 245a5ba8
No related branches found
No related tags found
No related merge requests found
# experiments # experiments
using Distributed
using Random: MersenneTwister using Random: MersenneTwister
using LinearAlgebra: Diagonal, I, dot, norm, mul!, diagm using LinearAlgebra: Diagonal, I, dot, norm, mul!, diagm
using Statistics: median using Statistics: median
using CSV
using Colors: HSV
using DataFrames
using Distributed
@everywhere using DualTVDD @everywhere using DualTVDD
@everywhere using DualTVDD: @everywhere using DualTVDD:
DualTVL1ROFOpProblem, DualTVL1ROFOpProblem,
...@@ -15,6 +12,10 @@ using Distributed ...@@ -15,6 +12,10 @@ using Distributed
SurrogateAlgorithm, SurrogateAlgorithm,
DualTVDDSurrogateAlgorithm, DualTVDDSurrogateAlgorithm,
init, step!, fetch, fetch_u, gradient, divergence, normB, energy, residual init, step!, fetch, fetch_u, gradient, divergence, normB, energy, residual
using CSV
using Colors: HSV
using DataFrames
using DualTVDD: fetch_u using DualTVDD: fetch_u
using FFTW using FFTW
using FileIO using FileIO
...@@ -270,10 +271,11 @@ function experiment_scaling_opticalflow(ctx) ...@@ -270,10 +271,11 @@ function experiment_scaling_opticalflow(ctx)
λ = 0.01 λ = 0.01
β = 0.001 β = 0.001
ninner = 300 ninner = 500
Mdir = 2 * floor(Int, sqrt(nworkers())) # to have enough workers available #Mdir = 2 * floor(Int, sqrt(nworkers())) # to have enough workers available
M = (Mdir, Mdir) Mdir = nworkers()
overlap = (5, 5) M = (4, Mdir)
overlap = (10, 10)
stopenergy = 130. stopenergy = 130.
ntimings = 3 ntimings = 3
...@@ -298,6 +300,7 @@ function experiment_scaling_opticalflow(ctx) ...@@ -298,6 +300,7 @@ function experiment_scaling_opticalflow(ctx)
tg = timeit(galg) tg = timeit(galg)
# divide by 2^2 due to coloring
nparallel = prod(M) ÷ 2^2 nparallel = prod(M) ÷ 2^2
ws = workers() ws = workers()
@assert nparallel <= length(ws) @assert nparallel <= length(ws)
...@@ -315,7 +318,7 @@ function experiment_scaling_opticalflow(ctx) ...@@ -315,7 +318,7 @@ function experiment_scaling_opticalflow(ctx)
CSV.write(joinpath(ctx.outdir, "timings.csv"), df) CSV.write(joinpath(ctx.outdir, "timings.csv"), df)
savedata(joinpath(ctx.outdir, "data.tex"); savedata(joinpath(ctx.outdir, "data.tex");
lambda=λ, beta=β, Mdir, M=prod(M), lambda=λ, beta=β, M1=M[1], M2=M[2], M=prod(M),
ntimings, stopenergy, ninner, ntimings, stopenergy, ninner,
width=size(fo, 2), height=size(fo, 1)) width=size(fo, 2), height=size(fo, 1))
end end
......
# do not use a startup file: `julia --startup-file=no`
# otherwise precompilation will be done over and over again
using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
using Distributed
addprocs(8)
@everywhere using Pkg
@everywhere Pkg.activate(@__DIR__)
@everywhere Pkg.instantiate()
@everywhere using Revise
includet(joinpath(@__DIR__, "run_experiments.jl"))
const datapath = joinpath(@__DIR__, "..", "..", "data")
ctx = Util.Context(datapath)
ctx(experiment_scaling_opticalflow, "fd/scaling/opticalflow")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment