Skip to content

Commit

Permalink
updated figs
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuri3 committed Jun 27, 2024
1 parent 1213b58 commit 8e54147
Show file tree
Hide file tree
Showing 160 changed files with 204 additions and 106 deletions.
2 changes: 1 addition & 1 deletion experiments_SNFROM/advect_fourier2D/snf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ grid = (128, 128,)

solvestats = (;)

for dt_mult in [1, 2, 5] # time-step
for dt_mult in [1, 2, 5, 10] # time-step
for iskip in [1, 2, 4, 8, 16] # indices
# hyper-indices
ids = zeros(Bool, grid...)
Expand Down
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Empty file.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Empty file.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
143 changes: 73 additions & 70 deletions experiments_SNFROM/burgers_fourier2D/snf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,78 +34,81 @@ grid = (512, 512,)
# # modeldir/results
# postprocess_SNF(prob, datafile, modelfile; rng, device)

ids = zeros(Bool, grid...)
kk = 32
@views ids[1:kk:end, 1:kk:end] .= true
hyper_indices = findall(isone, vec(ids))

# # modeldir/hyper
# outdir = joinpath(modeldir, "hyper")
# hyper_reduction_path = joinpath(modeldir, "hyper.jld2")
# evolve_kw = (; hyper_reduction_path, hyper_indices, verbose = false,)
# postprocess_SNF(prob, datafile, modelfile; rng, evolve_kw, outdir, device)

# # modeldir/hyperDT
# outdir = joinpath(modeldir, "hyperDT")
# hyper_reduction_path = joinpath(modeldir, "hyperDT.jld2")
#
# It = LinRange(1, 500, 500) .|> Base.Fix1(round, Int)
# data_kws = (; Ix = :, It)
# evolve_kw = (; Δt = 10f0, data_kws, hyper_reduction_path, hyper_indices, verbose = false,)
# postprocess_SNF(prob, datafile, modelfile; rng, evolve_kw, outdir, device)

# modeldir/hyperGreedy
outdir = joinpath(modeldir, "hyperGreedy")
hyper_reduction_path = joinpath(modeldir, "hyperGreedy.jld2")

It = LinRange(1, 500, 500) .|> Base.Fix1(round, Int)
data_kws = (; Ix = :, It)
evolve_kw = (; Δt = 10f0, data_kws, hyper_reduction_path, verbose = false,)
postprocess_SNF(prob, datafile, modelfile; rng, evolve_kw, outdir, device)
solvestats = (;)

for dt_mult in [1, 2, 5, 10] # time-step
for iskip in [4, 8, 16, 32, 64] # indices
# hyper-indices
ids = zeros(Bool, grid...)
@views ids[1:iskip:end, 1:iskip:end] .= true
hyper_indices = findall(isone, vec(ids))
hyper_reduction_path = joinpath(modeldir, "hyper.jld2")

# time-step
It = LinRange(1, 500, 500 ÷ dt_mult) .|> Base.Fix1(round, Int)
data_kws = (; Ix = :, It)
evolve_kw = (; Δt = 10f0, data_kws, hyper_reduction_path, hyper_indices, verbose = false,)

# directory
N = length(hyper_indices)
casename = "N$(N)_dt$(dt_mult)"
outdir = joinpath(modeldir, "hyper_$(casename)")

# run
_, stats = evolve_SNF(prob, datafile, modelfile, 1; rng, outdir, evolve_kw..., device)

global solvestats = (; solvestats..., Symbol(casename) => stats)
end
end

statsfile = joinpath(modeldir, "hyperstats.jld2")
jldsave(statsfile; solvestats)
hyper_plots(datafile, modeldir, 1)

#======================================================#

# timing plots

tme_FOM = 15.779027 # s
mem_FOM = 163.760 # GiB

Ngrid = 512 * 512
skips = 4 .^ Array(1:6) # indices: 2, 4, 8, 16, 32, 64

Nps = Ngrid ./ skips
DTs = [1, 2, 5, 10]

# s
tme_02 = [ 44.472603 22.082768 8.903516 4.608044 ]
tme_04 = [ 11.086413 5.557169 2.298053 1.317982 ]
tme_08 = [ 3.148577 1.633576 0.714816 0.565096 ]
tme_16 = [ 1.438282 0.800424 0.375744 0.152445 ]
tme_32 = [ 0.879129 0.505148 0.203869 0.134057 ]
tme_64 = [ 0.886587 0.453801 0.155870 0.090066 ]

# GiB
mem_02 = [ 2.132 * 1024 1.067 * 1024 437.687 219.508 ]
mem_04 = [ 546.079 273.206 109.482 54.907 ]
mem_08 = [ 136.819 68.451 27.431 13.757 ]
mem_16 = [ 34.503 17.263 6.918 3.470 ]
mem_32 = [ 8.925 4.465 1.790 919/1024 ]
mem_64 = [ 2.530 1.266 520.059/1024 261.227/1024 ]

# rel-MSE-error %
err_02 = [ 0.057878006 0.129677 0.35801634 0.74683654 ]
err_04 = [ 0.05751661 0.13067256 0.35610333 0.734099 ]
err_08 = [ 0.03925267 0.105229855 0.3400021 0.69685143 ]
err_16 = [ 0.050767798 0.11261147 0.33057037 0.7003481 ]
err_32 = [ 0.0455603 0.103269145 0.32034075 0.7164427 ]
err_64 = [ 0.09922275 0.05392034 0.23775052 0.5678324 ]

tmes = vcat(tme_02, tme_04, tme_08, tme_16, tme_32, tme_64)
mems = vcat(mem_02, mem_04, mem_08, mem_16, mem_32, mem_64)
errs = vcat(err_02, err_04, err_08, err_16, err_32, err_64)

# speedup
speedups = tme_FOM ./ tmes
memorys = mem_FOM ./ mems
# # timing plots
#
# tme_FOM = 15.779027 # s
# mem_FOM = 163.760 # GiB
#
# Ngrid = 512 * 512
# skips = 4 .^ Array(1:6) # indices: 2, 4, 8, 16, 32, 64
#
# Nps = Ngrid ./ skips
# DTs = [1, 2, 5, 10]
#
# # s
# tme_02 = [ 44.472603 22.082768 8.903516 4.608044 ]
# tme_04 = [ 11.086413 5.557169 2.298053 1.317982 ]
# tme_08 = [ 3.148577 1.633576 0.714816 0.565096 ]
# tme_16 = [ 1.438282 0.800424 0.375744 0.152445 ]
# tme_32 = [ 0.879129 0.505148 0.203869 0.134057 ]
# tme_64 = [ 0.886587 0.453801 0.155870 0.090066 ]
#
# # GiB
# mem_02 = [ 2.132 * 1024 1.067 * 1024 437.687 219.508 ]
# mem_04 = [ 546.079 273.206 109.482 54.907 ]
# mem_08 = [ 136.819 68.451 27.431 13.757 ]
# mem_16 = [ 34.503 17.263 6.918 3.470 ]
# mem_32 = [ 8.925 4.465 1.790 919/1024 ]
# mem_64 = [ 2.530 1.266 520.059/1024 261.227/1024 ]
#
# # rel-MSE-error %
# err_02 = [ 0.057878006 0.129677 0.35801634 0.74683654 ]
# err_04 = [ 0.05751661 0.13067256 0.35610333 0.734099 ]
# err_08 = [ 0.03925267 0.105229855 0.3400021 0.69685143 ]
# err_16 = [ 0.050767798 0.11261147 0.33057037 0.7003481 ]
# err_32 = [ 0.0455603 0.103269145 0.32034075 0.7164427 ]
# err_64 = [ 0.09922275 0.05392034 0.23775052 0.5678324 ]
#
# tmes = vcat(tme_02, tme_04, tme_08, tme_16, tme_32, tme_64)
# mems = vcat(mem_02, mem_04, mem_08, mem_16, mem_32, mem_64)
# errs = vcat(err_02, err_04, err_08, err_16, err_32, err_64)
#
# # speedup
# speedups = tme_FOM ./ tmes
# memorys = mem_FOM ./ mems

#======================================================#
nothing
6 changes: 2 additions & 4 deletions experiments_SNFROM/compare.jl
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,8 @@ function hyper_plots(
mems = (;) # GPU memory
uprs = (;) # at final time-step

data = jldopen(datafile)
xdata = data["x"]
udata = data["u"][:, :, end]
close(data)
xdata, _, _, udata, _ = loaddata(datafile)
udata = udata[:, :, casenum, end]

for case in cases
evolvefile = joinpath(modeldir, "hyper_" * String(case), "evolve$(casenum).jld2")
Expand Down
Loading

0 comments on commit 8e54147

Please sign in to comment.