-
Notifications
You must be signed in to change notification settings - Fork 159
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
Test suite clean up #3385
base: master
Are you sure you want to change the base?
Test suite clean up #3385
Conversation
|
ecb9628
to
f3685b7
Compare
f3685b7
to
f848c6f
Compare
93a0aae
to
a20fc9d
Compare
a5f614f
to
27b9af3
Compare
2a7f468
to
6ed1774
Compare
8132b64
to
1122a3b
Compare
9d5f056
to
df4aea3
Compare
|
|
bf317f5
to
ef87021
Compare
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.
Generally very happy with this.
8435a69
to
10f7f0c
Compare
10f7f0c
to
f493334
Compare
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.
Leaving notes for someone (most likely me) to refer to in future. In summary:
- Need to rebase/merge in
master
. - Tweaks to
Makefile
andbuild.yml
.
.github/workflows/build.yml
Outdated
-o faulthandler_timeout=1860 \ | ||
--junit-xml=firedrake2_\$MPISPAWN_TASK_ID1.xml \ | ||
-m "parallel[\$MPISPAWN_WORLD_SIZE] and not broken" \ | ||
-v tests |
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.
TODO: "dogfood" (bleh) Makefile
and use a matrix to massively cut down on boilerplate
.PHONY: test_smoke | ||
test_smoke: | ||
@echo " Running the bare minimum smoke tests" | ||
@python -m pytest -k "poisson_strong or stokes_mini or dg_advection" -v tests/regression/ |
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.
It would be better to use MPI on the "outside" here for the parallel tests so this can be run to check things on HPC
endif | ||
# Requires pytest and pytest-mpi only | ||
.PHONY: test_serial | ||
test_serial: |
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.
Terrible name! This runs all the parallel tests too!
|
||
# Requires pytest and pytest-mpi only | ||
.PHONY: test_smoke | ||
test_smoke: |
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.
bikeshedding: I prefer make smoke_tests
or make smoketests
done | ||
|
||
.PHONY: _test_large_world_test | ||
_test_large_world_tests: |
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.
I'm not sure why we have small_world
and large_world
tests separately.
config.addinivalue_line( | ||
"markers", | ||
"skipreal: mark as skipped unless in complex mode") | ||
"broken: mark a test that is broken" |
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.
remove this
) | ||
config.addinivalue_line( | ||
"markers", | ||
"skipcomplexnoslate: mark as skipped in complex mode due to lack of Slate" |
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.
duplicate
config.addinivalue_line( | ||
"markers", | ||
"skipvtk: mark as skipped if vtk is not installed") | ||
"skipnetgen: mark as skipped if netgen and ngsPETSc is not installed" |
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.
duplicate
@@ -7,6 +7,7 @@ | |||
import ngsPETSc | |||
del ngsPETSc | |||
except ImportError: | |||
# Netgen is not installed |
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.
# Netgen is not installed |
@pytest.mark.markif_fixture(pytest.mark.slow, num_points="sparse") | ||
@pytest.mark.markif_fixture(pytest.mark.slow, num_points="dense") |
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.
@pytest.mark.markif_fixture(pytest.mark.slow, num_points="sparse") | |
@pytest.mark.markif_fixture(pytest.mark.slow, num_points="dense") |
@@ -321,6 +321,7 @@ def test_EquationBC_mixedpoisson_matrix_fieldsplit(): | |||
assert abs(math.log2(err[0][0]) - math.log2(err[1][0]) - (porder+1)) < 0.05 | |||
|
|||
|
|||
@pytest.mark.slow |
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.
@pytest.mark.slow |
@@ -231,7 +231,7 @@ def test_EquationBC_poisson_matrix(eq_type, with_bbc): | |||
assert abs(math.log2(err[0]) - math.log2(err[1]) - (porder+1)) < 0.05 | |||
|
|||
|
|||
@pytest.mark.parametrize("with_bbc", [False, True]) | |||
@pytest.mark.parametrize("with_bbc", [False, pytest.param(True, marks=pytest.mark.slow)]) |
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.
@pytest.mark.parametrize("with_bbc", [False, pytest.param(True, marks=pytest.mark.slow)]) | |
@pytest.mark.parametrize("with_bbc", [False, True]) |
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="09-hybridisation.ipynb") | ||
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="10-sum-factorisation.ipynb") | ||
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="12-HPC_demo.ipynb") |
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.
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="09-hybridisation.ipynb") | |
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="10-sum-factorisation.ipynb") | |
@pytest.mark.markif_fixture(pytest.mark.slow, ipynb_file="12-HPC_demo.ipynb") |
markif_fixtures = [m for m in item.own_markers if m.name == "markif_fixture"] | ||
for mark in markif_fixtures: | ||
'''@pytest.mark.markif_fixture(*marks, **conditions) | ||
marks: str | pytest.mark.structures.Mark | ||
marks to apply if conditions are met | ||
conditions: dict | ||
dictionary of conditions; consisting of function argument keys | ||
and fixture values or ids | ||
''' | ||
# (function argument names, fixture ids) in a list | ||
fixtures = [(name, id_) for name, id_ in zip(item.callspec.params.keys(), item.callspec._idlist)] | ||
# If all the fixtures are in the dictionary of conditions apply all of the marks | ||
if all((k, str(v)) in fixtures for k, v in mark.kwargs.items()): | ||
for label in mark.args: | ||
if isinstance(label, str): | ||
item.add_marker(getattr(pytest.mark, label)()) | ||
else: | ||
item.add_marker(label()) | ||
|
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.
markif_fixtures = [m for m in item.own_markers if m.name == "markif_fixture"] | |
for mark in markif_fixtures: | |
'''@pytest.mark.markif_fixture(*marks, **conditions) | |
marks: str | pytest.mark.structures.Mark | |
marks to apply if conditions are met | |
conditions: dict | |
dictionary of conditions; consisting of function argument keys | |
and fixture values or ids | |
''' | |
# (function argument names, fixture ids) in a list | |
fixtures = [(name, id_) for name, id_ in zip(item.callspec.params.keys(), item.callspec._idlist)] | |
# If all the fixtures are in the dictionary of conditions apply all of the marks | |
if all((k, str(v)) in fixtures for k, v in mark.kwargs.items()): | |
for label in mark.args: | |
if isinstance(label, str): | |
item.add_marker(getattr(pytest.mark, label)()) | |
else: | |
item.add_marker(label()) |
config.addinivalue_line( | ||
"markers", | ||
"slow: mark a test that takes a while to run" | ||
) |
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.
remove
Why would you remove the slow markers? They are really useful if you want to run the test suite faster (especially in parallel!) and are also there to highlight tests that can be sped up. |
Sorry to undo your hard work but I don't see the benefit in having them:
But it doesn't run all of the tests. It is useful to be able to run only a few fast tests (a la
We already know which tests are slow from
output from pytest. This is another source of truth and I think it will immediately bit-rot. |
Description
This PR started as an experiment to "cheaply" speed up the test suite by calling
mpiexec
wrappingpytest
, rather than forking a subprocess which callsmpiexec
(which is also problematic for other reasons).This PR now carries around multiple test suite fixes that should be merged back to master and includes fixes including:
Ensemble
needs a proper fix!)We need to consider what aspects of this experiment we want to incorporate back into master.
Some timings for the actual speed-up (the original intention):
Results
(Real only)
Master
This week's scheduled execution:
This branch
With fixed caches, mpispawn, fixed FInAT hashes and pytest-split based on a timed execution.
NB: We tweak
vertexonly/test_poisson_inverse_conductivity.py
to only do 3 iterations (see diff)Important, this branch only runs a maximum of 12 ranks/threads!