Skip to content

Commit

Permalink
Keeping number of workers to default for all tests (#46)
Browse files Browse the repository at this point in the history
* Integration tests for PDE solved added

The test suite is starting to become a little bit more complete.

* Fix merge conflicts

* Muninn added as dependency

Now we can run simulations with MB, run by Muninn. New tests have been added covering those usescases. This means that Huginn should be ready to run simulations for most cases. Now it needs to be extensively tested for different regions and finish polishing the remaining issues.

* Changes for compatibility with ODINN.jl

* Sleipnir and Munnin versions updated

* Clean-up and test reference files changes

* Bump version

* Multiprocessing fixed

* Multiprocessing fixed for OGGM

* Tolerance fixed for tests

* Default # of workers set for all tests

There might be issue with removing workers on GH CI, so just keeping them constant throughout all tests.

* Test mode added for tests

* Changing test running order
  • Loading branch information
JordiBolibar committed Dec 18, 2023
1 parent fcad936 commit 34d0e54
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/setup/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function clean()
@everywhere using Reexport
@everywhere @reexport using Huginn
end # @eval
elseif nprocs() != procs && procs == 1
elseif nprocs() != procs && procs == 1 && !params.simulation_test_mode
@eval begin
rmprocs(workers(), waitfor=0)
println("Number of cores: ", nprocs())
Expand Down
6 changes: 3 additions & 3 deletions test/PDE_UDE_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
velocities=false,
tspan=(2010.0, 2015.0),
working_dir = Huginn.root_dir,
workers=4,
multiprocessing=true),
test_mode = true),
solver = SolverParameters(reltol=1e-12)
)

Expand Down Expand Up @@ -103,7 +102,8 @@ function TI_run_test!(save_refs::Bool = false; rtol::F, atol::F) where {F <: Abs
simulation = SimulationParameters(use_MB=true,
velocities=false,
tspan=(2010.0, 2015.0),
working_dir = Huginn.root_dir),
working_dir = Huginn.root_dir,
test_mode = true),
solver = SolverParameters(reltol=1e-8)
)
model = Model(iceflow = SIA2Dmodel(params), mass_balance = TImodel1(params))
Expand Down
2 changes: 0 additions & 2 deletions test/halfar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ function unit_halfar_test(; A, n, t₀, t₁, Δx, Δy, nx, ny, h₀, r₀, rtol
parameters = Parameters(simulation=SimulationParameters(tspan=(t₀, t₁),
use_MB=false,
use_iceflow=true,
multiprocessing=true,
workers=1,
working_dir=Huginn.root_dir),
physical=PhysicalParameters(),
solver=SolverParameters(reltol=1e-12))
Expand Down
4 changes: 1 addition & 3 deletions test/mass_conservation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ function unit_mass_test(; H₀, B, A, n, t_sim, Δx, Δy, rtol=0.02, save_plot=f
# Get parameters for a simulation
parameters = Parameters(simulation=SimulationParameters(tspan=(0.0, t_sim),
use_MB=false,
use_iceflow=true,
multiprocessing=true,
workers=1),
use_iceflow=true),
physical=PhysicalParameters(),
solver=SolverParameters(reltol=1e-12))

Expand Down
3 changes: 1 addition & 2 deletions test/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ function plot_analysis_flow_parameters_test()
use_iceflow= true,
tspan=(2000.0, 2015.0),
working_dir = working_dir,
multiprocessing=true,
workers=2),
test_mode = true),
solver = SolverParameters(reltol=1e-8)
)

Expand Down
12 changes: 6 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ include("plotting.jl")
# Activate to avoid GKS backend Plot issues in the JupyterHub
ENV["GKSwstype"]="nul"

@testset "PDE solving integration tests w/o MB" pde_solve_test(; rtol=0.01, atol=0.01, save_refs=false, MB=false, fast=true)

@testset "PDE solving integration tests w/ MB" pde_solve_test(; rtol=0.01, atol=0.01, save_refs=false, MB=true, fast=true)

@testset "Run TI models in place" TI_run_test!(false; rtol=1e-5, atol=1e-5)

@testset "Solver parameters construction with specified variables" params_constructor_specified()

@testset "Solver parameters construction with default variables" params_constructor_default()
Expand All @@ -28,12 +34,6 @@ ENV["GKSwstype"]="nul"

@testset "Halfar Solution (out-of-place)" halfar_test(; rtol=0.02, atol=1.0, inplace=false)

@testset "PDE solving integration tests w/o MB" pde_solve_test(; rtol=0.01, atol=0.01, save_refs=false, MB=false, fast=true)

@testset "PDE solving integration tests w/ MB" pde_solve_test(; rtol=0.01, atol=0.01, save_refs=false, MB=true, fast=true)

@testset "Run TI models in place" TI_run_test!(false; rtol=1e-5, atol=1e-5)

@testset "Conservation of Mass - Flat Bed" unit_mass_flatbed_test(; rtol=1.0e-7)

@testset "Glacier Plotting" plot_analysis_flow_parameters_test()

2 comments on commit 34d0e54

@JordiBolibar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Version 0.4.0 already exists

Please sign in to comment.