-
Notifications
You must be signed in to change notification settings - Fork 198
speed up tests #5331
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
base: release
Are you sure you want to change the base?
speed up tests #5331
Changes from all commits
4bf52f1
f369aae
8a27c6f
b7b6b7a
c1171e9
fe12e5c
d165f07
599e391
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,11 +296,21 @@ We then use this to build a solver. :: | |
| We are getting close to the time loop. We set up some timestepping | ||
| parameters. :: | ||
|
|
||
| T = 50.0 # maximum timestep | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not accurate. The comment should say T = final time |
||
| t = 0. # model time | ||
| ndump = 100 # frequency of file dumps | ||
| dumpn = 0 # dump counter | ||
| nsteps = 5000 | ||
| import os | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's surprising that one of our slowest demos is 1D.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's 2D (extruded) with a lot of timesteps.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| if os.getenv("FIREDRAKE_CI") == "1": | ||
| # Setup for a faster test execution. | ||
| T = 0.5 # maximum timestep | ||
| t = 0. # model time | ||
| ndump = 50 # frequency of file dumps | ||
| dumpn = 0 # dump counter | ||
| nsteps = 50 | ||
| else: | ||
| T = 50.0 # maximum timestep | ||
| t = 0. # model time | ||
| ndump = 100 # frequency of file dumps | ||
| dumpn = 0 # dump counter | ||
| nsteps = 5000 | ||
|
|
||
| dt = T/nsteps | ||
| dtc.assign(dt) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,7 +93,12 @@ | |
| # So now we need to specify the number of refinements (say 4). Let's also set the mesh `degree` to be cubic. With this choice of coordinate space, we can better resolve the actual curvature of the sphere using bendy quadrilateral elements: | ||
|
|
||
| # %% | ||
| mesh = CubedSphereMesh(radius=R0, refinement_level=4, degree=3) | ||
| # Use a coarser mesh when running CI tests. | ||
| 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) | ||
|
Comment on lines
+97
to
+101
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can just set the refinement_level inside the if-statement. |
||
|
|
||
| # %% [markdown] | ||
| # And now we just initialize the global normals on this mesh: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,7 +64,12 @@ | |
| # We can create a hexahedral mesh by extruding a quadrilateral mesh. | ||
|
|
||
| # %% | ||
| mesh = ExtrudedMesh(UnitSquareMesh(10, 10, quadrilateral=True), 10) | ||
| # Setup for faster test execution. | ||
| 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) | ||
|
Comment on lines
+68
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| # %% [markdown] | ||
| # Let's choose the continuous Lagrange element of degree 5 as our function space. | ||
|
|
@@ -160,6 +165,10 @@ def gauss_lobatto_legendre_cube_rule(dimension, degree): | |
| # %% | ||
| flops = defaultdict(list) | ||
| ps = range(1, 33) # polynomial degrees | ||
|
|
||
| if os.getenv("FIREDRAKE_CI") == "1": | ||
| ps = [1, 2, 4, 8] | ||
|
|
||
| modes = { | ||
| 'gll': {'mode': 'spectral', 'variant': 'spectral', 'rule': gauss_lobatto_legendre_cube_rule}, | ||
| 'spectral': {'mode': 'spectral', 'variant': None, 'rule': lambda *args: None}, | ||
|
|
@@ -194,6 +203,10 @@ def gauss_lobatto_legendre_cube_rule(dimension, degree): | |
| # This might take some time to run | ||
| flops_curl = defaultdict(list) | ||
| ps_curl = range(1, 17) | ||
|
|
||
| if os.getenv("FIREDRAKE_CI") == "1": | ||
| ps_curl = [1, 2, 4] | ||
|
|
||
| for p in ps_curl: | ||
| for mode in modes: | ||
| element = FiniteElement('NCE', mesh.ufl_cell(), degree=p, variant=modes[mode]['variant']) | ||
|
|
||
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.
This is polluting the demo.