Skip to content

speed up tests - #5331

Open
leo-collins wants to merge 8 commits into
releasefrom
leo/reduce-tests
Open

speed up tests#5331
leo-collins wants to merge 8 commits into
releasefrom
leo/reduce-tests

Conversation

@leo-collins

Copy link
Copy Markdown
Contributor

No description provided.

@pbrubeck

pbrubeck commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I have been working towards faster codegen for sum-factorization. Maybe there's no need to chop the degree on some of these tests

ids=["Rectangle", "Box"])
def mesh(request):
nx = 4
nx = 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I had nx = 4 for a good reason. With nx=2 every cell touches the boundary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So nx=3 is fine?

@pbrubeck pbrubeck Aug 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think if the test is slow even for nx=4, it means that we are setting the wrong solver options. The whole point of the FDM stuff is to ensure a very sparse operator, so I'd rather dig into the root of the problem and strengthen this test instead of just tweaking the mesh size.

Almost every test in this module uses the mesh fixture. I think only a few tests that rely on mumps are compute-dominated, and I think those can be speed up by tweaking mumps options, perhaps by changing mat_ordering_type.

Comment on lines +68 to +72
import os
if os.getenv("FIREDRAKE_CI") == "1":
mesh = ExtrudedMesh(UnitSquareMesh(2, 2, quadrilateral=True), 2)
else:
mesh = ExtrudedMesh(UnitSquareMesh(10, 10, quadrilateral=True), 10)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The mesh size in the actual demo can become 2. The purpose of demo is just to measure flops

Comment on lines +97 to +101
import os
if os.getenv("FIREDRAKE_CI") == "1":
mesh = CubedSphereMesh(radius=R0, refinement_level=2, degree=3)
else:
mesh = CubedSphereMesh(radius=R0, refinement_level=4, degree=3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can just set the refinement_level inside the if-statement.

ndump = 100 # frequency of file dumps
dumpn = 0 # dump counter
nsteps = 5000
import os

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's surprising that one of our slowest demos is 1D.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's 2D (extruded) with a lot of timesteps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

5,000 timesteps of a three-stage RK method with two solves in each stage will do that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah. The splitting method has quite a small stability limit on the timestep.

We are getting close to the time loop. We set up some timestepping
parameters. ::

T = 50.0 # maximum timestep

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not accurate. The comment should say T = final time


base = UnitSquareMesh(8, 8, quadrilateral=True)
mesh = ExtrudedMesh(base, 8)
# Setup for faster test execution.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is polluting the demo.

  1. Can we just do it one place? Can there be only one branch (no else statement, just set the demo parameters before the if statment).
  2. Can we hide it so it does not appear in the html?

coarse = {
"mat_type": "aij",
"ksp_type": "preonly",
"pc_type": "cholesky",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"pc_type": "cholesky",
"pc_factor_mat_solver_type": "mumps",

"pc_type": "python",
"pc_python_type": "firedrake.ASMExtrudedStarPC",
"pc_star_mat_ordering_type": "nd",
"pc_star_sub_sub_pc_type": "cholesky",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"pc_star_sub_sub_pc_type": "cholesky",
"pc_star_sub_sub_pc_factor_mat_solver_type": "cholmod",

"pc_type": "python",
"pc_python_type": "firedrake.ASMExtrudedStarPC",
"pc_star_mat_ordering_type": "nd",
"pc_star_sub_sub_pc_type": "cholesky",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"pc_star_sub_sub_pc_type": "cholesky",
"pc_star_sub_sub_pc_factor_mat_solver_type": "cholmod",

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