Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log | Files | Refs | README | LICENSE

commit c973b53ac617ee3dddc257894ebd2298c9df8f89
parent 272496b31ba1ba7d932c60ad77974c0f94bca3fe
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Wed, 21 Jun 2017 21:20:33 -0400

add ocean+atmosphere profiling tests

Diffstat:
Mtest/profiling.jl | 33+++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/test/profiling.jl b/test/profiling.jl @@ -12,7 +12,8 @@ info("Testing performance with many interacting ice floes") function timeSingleStepInDenseSimulation(nx::Int; verbose::Bool=true, profile::Bool=false, - grid_sorting::Bool=true) + grid_sorting::Bool=true, + include_atmosphere::Bool=false) sim = SeaIce.createSimulation() #nx, ny = 25, 25 @@ -24,6 +25,10 @@ function timeSingleStepInDenseSimulation(nx::Int; verbose::Bool=true, sim.ocean.input_file = false # fallback to all-to-all contact search end r = min(dx, dy)/2. + if include_atmosphere + sim.atmosphere = SeaIce.createRegularAtmosphereGrid([nx, ny, 2], + [nx*dx, ny*dy, 10.]) + end # add ice floes in regular packing for iy=1:ny @@ -40,7 +45,10 @@ function timeSingleStepInDenseSimulation(nx::Int; verbose::Bool=true, end info("number of ice floes: $(length(sim.ice_floes))") if grid_sorting - info("using cell-based spatial decomposition") + info("using cell-based spatial decomposition (ocean)") + if include_atmosphere + info("using cell-based spatial decomposition (ocean + atmosphere)") + end else info("using all-to-all contact search") end @@ -83,12 +91,16 @@ elements = zeros(length(nx)) t_elapsed = zeros(length(nx)) t_elapsed_all_to_all = zeros(length(nx)) t_elapsed_cell_sorting = zeros(length(nx)) +t_elapsed_cell_sorting2 = zeros(length(nx)) for i=1:length(nx) info("nx = $(nx[i])") t_elapsed_all_to_all[i] = timeSingleStepInDenseSimulation(Int(nx[i]), grid_sorting=false) t_elapsed_cell_sorting[i] = timeSingleStepInDenseSimulation(Int(nx[i]), grid_sorting=true) + t_elapsed_cell_sorting2[i] = + timeSingleStepInDenseSimulation(Int(nx[i]), grid_sorting=true, + include_atmosphere=true) elements[i] = nx[i]*nx[i] end @@ -101,15 +113,15 @@ Plots.scatter(elements, t_elapsed_all_to_all, fit_all_to_all = CurveFit.curve_fit(CurveFit.PowerFit, elements, t_elapsed_all_to_all) label_all_to_all = @sprintf "%1.3g n^%3.2f" fit_all_to_all.coefs[1] fit_all_to_all.coefs[2] - Plots.plot!(elements, fit_all_to_all(elements), xscale=:log10, yscale=:log10, label=label_all_to_all) + Plots.scatter!(elements, t_elapsed_cell_sorting, xscale=:log10, yscale=:log10, - label="Cell-based spatial decomposition") + label="Cell-based spatial decomposition (ocean only)") fit_cell_sorting = CurveFit.curve_fit(CurveFit.PowerFit, elements, t_elapsed_cell_sorting) label_cell_sorting = @sprintf "%1.3g n^%3.2f" fit_cell_sorting.coefs[1] fit_cell_sorting.coefs[2] @@ -117,6 +129,19 @@ Plots.plot!(elements, fit_cell_sorting(elements), xscale=:log10, yscale=:log10, label=label_cell_sorting) + +Plots.scatter!(elements, t_elapsed_cell_sorting2, + xscale=:log10, + yscale=:log10, + label="Cell-based spatial decomposition (ocean + atmosphere)") +fit_cell_sorting2 = CurveFit.curve_fit(CurveFit.PowerFit, + elements, t_elapsed_cell_sorting2) +label_cell_sorting2 = @sprintf "%1.3g n^%3.2f" fit_cell_sorting2.coefs[1] fit_cell_sorting2.coefs[2] +Plots.plot!(elements, fit_cell_sorting2(elements), + xscale=:log10, + yscale=:log10, + label=label_cell_sorting2) + Plots.title!("Dense granular system " * "(host: $(gethostname()))") Plots.xaxis!("Number of ice floes") Plots.yaxis!("Wall time per time step [s]")