-
Notifications
You must be signed in to change notification settings - Fork 2
Avoiding distributed fill_halo_regions! in dynamics by extending the halos
#88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
339f9ed
this should work?
simone-silvestri 21e6feb
Merge remote-tracking branch 'origin/main' into ss/no-heat-flux-when-…
simone-silvestri ddfdcca
launch this
simone-silvestri 2c98f69
remove this
simone-silvestri ef87337
go like this
simone-silvestri c643d1e
make it work
simone-silvestri df016c4
Merge remote-tracking branch 'origin/main' into ss/no-heat-flux-when-…
simone-silvestri ef9a3ab
try it out
simone-silvestri 56a57bc
let's go!
simone-silvestri 1a5e2ff
Merge branch 'main' into ss/no-heat-flux-when-unconsolidated
simone-silvestri 1def747
Update sea_ice_time_stepping.jl
simone-silvestri e222a0f
Update sea_ice_model.jl
simone-silvestri bb87c8b
Optimize halo region filling for momentum equations
simone-silvestri bed7f64
go ahead
simone-silvestri 72b8f9e
add this
simone-silvestri 20d164a
go back
simone-silvestri 5508c80
Update sea_ice_model.jl
simone-silvestri 9199c44
assume
simone-silvestri df1dace
Update runtests.jl
simone-silvestri 055f89e
Adjust halo size calculation in sea ice model
simone-silvestri b03d502
add a test
simone-silvestri f35150f
separate tests
simone-silvestri 90ba288
remove ext
simone-silvestri c9bc9ce
ensure the correct group
simone-silvestri 992afb6
fix distributed tests
simone-silvestri 56619c6
add the dynamics
simone-silvestri abbd164
fix tests
simone-silvestri fb51b14
sea ice model
simone-silvestri 3dffd81
another bugfix
simone-silvestri cba00d7
add stuff
simone-silvestri f92c1d3
add Oceananigans
simone-silvestri 4bc0e60
fix keyword
simone-silvestri bcc35c2
fix these tests
simone-silvestri 8e74f4e
fix stuff
simone-silvestri b87ca1e
add with _halo
simone-silvestri 9639f34
fix
simone-silvestri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,150 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ["*"] | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/ci.yml' | ||
| - 'src/**' | ||
| - 'test/**' | ||
| - 'Project.toml' | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: '*' | ||
| paths: | ||
| - '.github/workflows/ci.yml' | ||
| - 'src/**' | ||
| - 'test/**' | ||
| - 'Project.toml' | ||
|
|
||
| concurrency: | ||
| # Skip intermediate builds: always. | ||
| # Cancel intermediate builds: only if it is a pull request build. | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
| checkpointing_tests: | ||
| name: Checkpointing Tests - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 120 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - '1.10' | ||
| os: | ||
| - ubuntu-latest | ||
| arch: | ||
| - x64 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| version: ${{ matrix.version }} | ||
| arch: ${{ matrix.arch }} | ||
| - uses: julia-actions/cache@v2 | ||
| - uses: julia-actions/julia-buildpkg@v1 | ||
| - uses: julia-actions/julia-runtest@v1 | ||
| env: | ||
| TEST_GROUP: "checkpointing" | ||
|
|
||
| distributed: | ||
| name: Distributed Tests - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 120 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - '1.10' | ||
| os: | ||
| - ubuntu-latest | ||
| arch: | ||
| - x64 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| version: ${{ matrix.version }} | ||
| arch: ${{ matrix.arch }} | ||
| - uses: julia-actions/cache@v2 | ||
| - uses: julia-actions/julia-buildpkg@v1 | ||
| - uses: julia-actions/julia-runtest@v1 | ||
| env: | ||
| TEST_GROUP: "distributed" | ||
|
|
||
| advection: | ||
| name: Sea Ice Advection - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 120 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - '1.10' | ||
| - '1.12' | ||
| os: | ||
| - ubuntu-latest | ||
| arch: | ||
| - x64 | ||
| - x86 | ||
| include: | ||
| # test macOS and Windows with latest Julia only | ||
| - os: macOS-latest | ||
| arch: x64 | ||
| version: '1.10' | ||
| - os: windows-latest | ||
| arch: x64 | ||
| version: '1.10' | ||
| - os: windows-latest | ||
| arch: x86 | ||
| version: '1.10' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: julia-actions/setup-julia@latest | ||
| - uses: actions/checkout@v5 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| version: ${{ matrix.version }} | ||
| arch: ${{ matrix.arch }} | ||
| - uses: actions/cache@v3 | ||
| - uses: julia-actions/cache@v2 | ||
| - uses: julia-actions/julia-buildpkg@v1 | ||
| - uses: julia-actions/julia-runtest@v1 | ||
| env: | ||
| cache-name: cache-artifacts | ||
| TEST_GROUP: "advection" | ||
|
|
||
| timestepping: | ||
| name: Time Stepping - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 120 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - '1.10' | ||
| os: | ||
| - ubuntu-latest | ||
| arch: | ||
| - x64 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| path: ~/.julia/artifacts | ||
| key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-test-${{ env.cache-name }}- | ||
| ${{ runner.os }}-test- | ||
| ${{ runner.os }}- | ||
| version: ${{ matrix.version }} | ||
| arch: ${{ matrix.arch }} | ||
| - uses: julia-actions/cache@v2 | ||
| - uses: julia-actions/julia-buildpkg@v1 | ||
| - uses: julia-actions/julia-runtest@v1 | ||
| - uses: julia-actions/julia-processcoverage@v1 | ||
| - uses: codecov/codecov-action@v2 | ||
| env: | ||
| TEST_GROUP: "timestepping" | ||
|
|
||
| enthalpy: | ||
| name: Enthalpy Model - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 120 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| version: | ||
| - '1.10' | ||
| os: | ||
| - ubuntu-latest | ||
| arch: | ||
| - x64 | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: julia-actions/setup-julia@v2 | ||
| with: | ||
| file: lcov.info | ||
| version: ${{ matrix.version }} | ||
| arch: ${{ matrix.arch }} | ||
| - uses: julia-actions/cache@v2 | ||
| - uses: julia-actions/julia-buildpkg@v1 | ||
| - uses: julia-actions/julia-runtest@v1 | ||
| env: | ||
| TEST_GROUP: "enthalpy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| using JLD2 | ||
| using MPI | ||
| using Oceananigans | ||
| using Oceananigans.DistributedComputations: reconstruct_global_field, reconstruct_global_grid | ||
| using Oceananigans.Units | ||
| using ClimaSeaIce | ||
| using ClimaSeaIce.SeaIceDynamics: SeaIceMomentumEquation, ElastoViscoPlasticRheology, SemiImplicitStress | ||
|
|
||
| # Run the distributed grid simulation and save down reconstructed results | ||
| function run_distributed_sea_ice(arch, filename) | ||
| distributed_grid = RectilinearGrid(arch; | ||
| size = (100, 100, 1), | ||
| x = (-10kilometers, 10kilometers), | ||
| y = (-10kilometers, 10kilometers), | ||
| z = (-1, 0), | ||
| halo = (5, 5, 5)) | ||
|
|
||
| model = run_distributed_simulation(distributed_grid) | ||
|
|
||
| u = reconstruct_global_field(model.velocities.u) | ||
| v = reconstruct_global_field(model.velocities.v) | ||
|
|
||
| if arch.local_rank == 0 | ||
| jldsave(filename; u = Array(interior(u, :, :, 1)), | ||
| v = Array(interior(v, :, :, 1))) | ||
| end | ||
|
|
||
| MPI.Barrier(MPI.COMM_WORLD) | ||
| MPI.Finalize() | ||
|
|
||
| return nothing | ||
| end | ||
|
|
||
| # Just a random simulation on a rectilinear grid | ||
| function run_distributed_simulation(grid) | ||
|
|
||
| τᵤ = 0.01 | ||
| τᵥ = 0.01 | ||
| τₒ = SemiImplicitStress() | ||
|
|
||
| # We use an elasto-visco-plastic rheology and WENO seventh order | ||
| # for advection of h and ℵ | ||
| dynamics = SeaIceMomentumEquation(grid; | ||
| top_momentum_stress = (u=τᵤ, v=τᵥ), | ||
| bottom_momentum_stress = τₒ, | ||
| rheology = ElastoViscoPlasticRheology(), | ||
| solver = SplitExplicitSolver(grid, substeps=50)) | ||
|
|
||
| model = SeaIceModel(grid; ice_thermodynamics = nothing, dynamics, advection = WENO(order=7)) | ||
|
|
||
| for N in 1:100 | ||
| time_step!(model, 1minutes) | ||
| end | ||
|
|
||
| return model | ||
| end | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought --- should we distinguish between the halo size and number of substeps? This would allow adaptive time-stepping; users just have to select the maximum number of substeps they expect to need. This could be combined with a max time step option in the
TimeStepWizardThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words the abstraction here is baking in an equivalence between substeps and halo points, but it need not be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is kind of the downside of this method. We could think about giving a "maximum halo", which would limit the amount of substeps (and in turn the maximum allowable timestep for the
TimeStepWizard).