Skip to content

Commit

Permalink
Issue with OGGM multiprocessing fixed (#44)
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
  • Loading branch information
JordiBolibar committed Dec 15, 2023
1 parent f396314 commit 7e3bfd4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/parameters/SolverParameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ function Parameters(;
parameters = Sleipnir.Parameters(physical, simulation, OGGM,
nothing, solver, nothing)

if parameters.simulation.multiprocessing
enable_multiprocessing(parameters)
end

oggm_config(OGGM.working_dir; oggm_processes=OGGM.workers)

return parameters
end

Expand Down
2 changes: 1 addition & 1 deletion src/setup/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function clean()
end

function enable_multiprocessing(params::Sleipnir.Parameters)
procs::Int = params.simulation.workers
procs = params.simulation.workers
if procs > 0 && params.simulation.multiprocessing
if nprocs() < procs
@eval begin
Expand Down
2 changes: 0 additions & 2 deletions src/simulations/predictions/prediction_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ In-place run of the model.
"""
function run!(simulation::Prediction)

enable_multiprocessing(simulation.parameters)

println("Running forward in-place PDE ice flow model...\n")
results_list = @showprogress pmap((glacier_idx) -> batch_iceflow_PDE!(glacier_idx, simulation), 1:length(simulation.glaciers))

Expand Down
6 changes: 4 additions & 2 deletions test/PDE_UDE_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ function pde_solve_test(; rtol::F, atol::F, save_refs::Bool=false, MB::Bool=fals
simulation = SimulationParameters(use_MB=MB,
velocities=false,
tspan=(2010.0, 2015.0),
working_dir = Huginn.root_dir),
solver = SolverParameters(reltol=1e-12)
working_dir = Huginn.root_dir,
workers=4,
multiprocessing=true),
solver = SolverParameters(reltol=1e-8)
)

## Retrieving gdirs and climate for the following glaciers
Expand Down

0 comments on commit 7e3bfd4

Please sign in to comment.