Skip to content

Conversation

@simone-silvestri
Copy link
Collaborator

fill_halo_regions! is massively expensive when kernels are small.
This is because there is a lot of type instability in the fill_halo_regions! that slows down the computation and the momentum kernels are very small so the performance hit is felt massively when running a small computation like a one-degree simulation.

This PR is just a draft that tries to implement the same strategy as the free surface in oceananigans to avoid fill halo regions.

However, I feel like it is possible to revisit fill_halo_regions! to make sure it is lightning fast under certain assumption, so does not really need to be merged, I will try to figure out how to speed up fill halo regions. We can keep this as last resort

@simone-silvestri
Copy link
Collaborator Author

I think this can be closed since the solution in #89 is much better

@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Oct 13, 2025

I reopen this PR given the state of distributed sea ice in #96. This might be the solution. We can proceed once we have a profile.

@simone-silvestri simone-silvestri marked this pull request as ready for review October 27, 2025 07:22
@simone-silvestri
Copy link
Collaborator Author

@taimoorsohail I think this PR might be ready. I need to add some tests, but I think I will do a whole test overhaul in a new PR and add some distributed tests there. This might increase the efficiency of distributed sea ice tremendously.

@simone-silvestri simone-silvestri changed the title Try avoiding fill_halo_regions! Avoiding distributed fill_halo_regions! in dynamics by extending the halos Nov 1, 2025
bottom_momentum_stress = nothing,
free_drift = nothing,
solver = SplitExplicitSolver(150),
solver = SplitExplicitSolver(grid; substeps=150),
Copy link
Member

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 TimeStepWizard

Copy link
Member

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

Copy link
Collaborator Author

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).

@glwagner
Copy link
Member

glwagner commented Nov 1, 2025

Impressive how simple it is, I had to double check I wasn't missing anything. I suggest adding tests though before merging...

@simone-silvestri simone-silvestri merged commit cc0d33a into main Nov 6, 2025
6 checks passed
@simone-silvestri simone-silvestri deleted the ss/no-heat-flux-when-unconsolidated branch November 6, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants