Skip to content
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

Add missing blocks to the dycore Jacobian #2427

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Add missing blocks to the dycore Jacobian #2427

merged 1 commit into from
Jan 12, 2024

Conversation

dennisYatunin
Copy link
Member

@dennisYatunin dennisYatunin commented Dec 12, 2023

Purpose

This PR adds a couple of missing blocks to the dycore Jacobian and modifies the linear solver to handle them. This improves the stability of two longrun simulations that were previously failing (Held-Suarez with topography and aquaplanet with topography).

Content

  • Account for the u 3 u h derivative, which scales with g 3 h and is therefore significant in simulations with topography. This adds the tridiagonal E ρ u h , E ρ e t o t u h , and E ρ χ u h blocks to the Jacobian.
  • Account for the κ u h derivative. This scales with g h h and g 3 h , so it is relevant both with and without topography. However, it only adds the bidiagonal E u 3 u h block to the Jacobian, which, along with the E u 3 u 3 block, is smaller than similar blocks by a factor of roughly ( u c ) 2 . In the future, we might want to drop both of these blocks if they do not significantly improve stability. Since they do not affect the structure of the linear solver, we will keep them in for now.
  • Account for the p ρ q t o t derivative, which is significant in simulations with moisture. This adds the bidiagonal E u 3 ρ q t o t block to the Jacobian, along with the tridiagonal E ρ e t o t ρ q t o t block in simulations with implicit diffusion.
  • Account for the e t o t ρ and χ ρ derivatives. These add the tridiagonal E ρ e t o t ρ and E ρ χ ρ blocks to the Jacobian in simulations with implicit diffusion.
  • Simplify update_implicit_equation_jacobian! and cache several matrix Fields in order to improve performance. Remove outdated code comments (new documentation will be ported from Overleaf in a future PR).
  • Slightly increase the allocation limits of some performance tests and bump the ref counter.

  • I have read and checked the items on the review checklist.

Sorry, something went wrong.

@dennisYatunin dennisYatunin force-pushed the dy/jacobian_blocks branch 2 times, most recently from 366ddfc to 1bf5f63 Compare December 12, 2023 01:27
@szy21
Copy link
Member

szy21 commented Dec 12, 2023

Is this ready for testing? Maybe @akshaysridhar could try running some topography simulations.

@dennisYatunin
Copy link
Member Author

@szy21 There seem to be a couple of performance+GPU issues, but other than that this is ready for testing. I'm trying out the longruns here.

@szy21
Copy link
Member

szy21 commented Dec 13, 2023

@dennisYatunin dennisYatunin force-pushed the dy/jacobian_blocks branch 10 times, most recently from 9874154 to f7927db Compare December 22, 2023 03:28
@dennisYatunin dennisYatunin requested a review from szy21 December 22, 2023 18:21
@dennisYatunin
Copy link
Member Author

CPU longruns: https://buildkite.com/clima/climaatmos-longruns/builds/1303
GPU longruns: https://buildkite.com/clima/climaatmos-gpulongruns/builds/10

@szy21 Would you mind taking a look at the results before I merge this in?

@szy21
Copy link
Member

szy21 commented Dec 22, 2023

I looked at some of the dycore simulations that are done and they look good. Feel free to merge this in. Thanks!

@dennisYatunin dennisYatunin added this pull request to the merge queue Dec 22, 2023
@szy21
Copy link
Member

szy21 commented Dec 22, 2023

The GPU pipeline seems to be 40% slower though. Is this as expected? (The CPU timeline is likely slower too as many simulations are timing out.)

@dennisYatunin
Copy link
Member Author

dennisYatunin commented Dec 22, 2023

Yeah this PR replaces the simple diagonal solver for the diffusion matrix with an iterative solver. This needs to run on every iteration of the higher-level solver for the full Jacobian, so it'll have a significant performance effect. This PR also adds a bunch of additional blocks to the Jacobian, and these currently take a while to compute.

@szy21
Copy link
Member

szy21 commented Dec 22, 2023

Ok, sounds good to me. Just want to let people who work on performance know (@simonbyrne @sriharshakandala).

@dennisYatunin
Copy link
Member Author

From the flame graphs, it looks like the new blocks are the main source of the performance hit. So, we might want to change something in ClimaCore to speed up long chains of matrix-matrix multiplications. I'll look into this when I get back.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 22, 2023
@szy21
Copy link
Member

szy21 commented Dec 22, 2023

I did want to know whether this helps with the topography runs though. I'm ok with merging it in for now as 40% is not too bad, or @akshaysridhar can test with this branch. Either way is fine.

@dennisYatunin
Copy link
Member Author

Hmm, looks like more memory increases are required. Before I merge this in, I'll try dropping some of the new Jacobian blocks in simulations without topography, which will probably improve the performance of those simulations.

@dennisYatunin dennisYatunin force-pushed the dy/jacobian_blocks branch 10 times, most recently from 9740d6a to 38e535b Compare January 12, 2024 00:56
@dennisYatunin
Copy link
Member Author

CPU longruns: https://buildkite.com/clima/climaatmos-longruns/builds/1355
GPU longruns: https://buildkite.com/clima/climaatmos-gpulongruns/builds/24

Performance issues appear to be resolved. I'll merge this in when the longruns are done.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@dennisYatunin dennisYatunin added the enhancement New feature or request label Jan 12, 2024
@szy21
Copy link
Member

szy21 commented Jan 12, 2024

The longrun looks fine. Feel free to merge it.

@dennisYatunin dennisYatunin added this pull request to the merge queue Jan 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 12, 2024
@szy21 szy21 added this pull request to the merge queue Jan 12, 2024
Merged via the queue into main with commit 3a42a70 Jan 12, 2024
@szy21 szy21 deleted the dy/jacobian_blocks branch January 12, 2024 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants