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

Speed up CI tests #1025

Merged
merged 31 commits into from
May 9, 2021
Merged

Speed up CI tests #1025

merged 31 commits into from
May 9, 2021

Conversation

speth
Copy link
Member

@speth speth commented Apr 28, 2021

Changes proposed in this pull request

  • Allow a subset of "slow" tests to be disabled, and use this on the "coverage" CI runs. Mechanisms for this are introduced for Python tests, gtest tests, and the "test_problems" regression tests.
  • Speed up some tests by switching from CTI inputs to YAML
  • Avoid creating unnecessary Transport objects during tests that use gri30 and h2o2 mechanisms.

Checklist

  • There is a clear use-case for this code change
  • The commit message has a short title & references relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

@ischoegl
Copy link
Member

ischoegl commented Apr 28, 2021

Great to see some of this moving along! One question I had was about replacing kineticsFromScratch.cti in kineticsFromScratch.cpp (which has come up in #995). Conversion to YAML isn't the issue here (file is already in #995), but setting up the objects has created some double-free's (?) that I am unable to track down (gdb, valgrind and all). There's a parallel implementation in kineticsFromScratch3.cpp that uses the new framework ...

@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #1025 (e81c33e) into main (f27c68e) will decrease coverage by 0.03%.
The diff coverage is 95.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1025      +/-   ##
==========================================
- Coverage   72.57%   72.54%   -0.04%     
==========================================
  Files         364      355       -9     
  Lines       46816    46422     -394     
==========================================
- Hits        33978    33675     -303     
+ Misses      12838    12747      -91     
Impacted Files Coverage Δ
include/cantera/base/AnyMap.h 100.00% <ø> (ø)
src/base/plots.cpp 0.00% <0.00%> (-92.11%) ⬇️
test/thermo/phaseConstructors.cpp 100.00% <ø> (ø)
test/equil/equil_gas.cpp 79.34% <55.55%> (-9.24%) ⬇️
src/base/AnyMap.cpp 89.41% <100.00%> (-0.11%) ⬇️
src/kinetics/Reaction.cpp 89.70% <100.00%> (+0.02%) ⬆️
src/thermo/MaskellSolidSolnPhase.cpp 71.69% <100.00%> (-1.20%) ⬇️
src/thermo/SurfPhase.cpp 82.88% <100.00%> (+0.09%) ⬆️
test/general/test_serialization.cpp 100.00% <100.00%> (ø)
test/kinetics/kineticsFromScratch.cpp 100.00% <100.00%> (ø)
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfa96aa...e81c33e. Read the comment docs.

@speth
Copy link
Member Author

speth commented Apr 28, 2021

Great to see some of this moving along! One question I had was about replacing kineticsFromScratch.cti in kineticsFromScratch.cpp (which has come up in #995). Conversion to YAML isn't the issue here (file is already in #995), but setting up the objects has created some double-free's (?) that I am unable to track down (gdb, valgrind and all). There's a parallel implementation in kineticsFromScratch3.cpp that uses the new framework ...

Sorry, I'm not sure I understand the issue as it relates to this PR. Are you saying that if I were to substitute kineticsFromScratch.yaml for kineticsFromScratch.cti (which I haven't done yet, but would fit within the overall scope of this PR, I suppose), I should be able to see some of these errors?

@ischoegl
Copy link
Member

ischoegl commented Apr 28, 2021

Are you saying that if I were to substitute kineticsFromScratch.yaml for kineticsFromScratch.cti (which I haven't done yet, but would fit within the overall scope of this PR, I suppose), I should be able to see some of these errors?

Correct. My own attempt in the conversion runs without errors, but the gtest doesn't shut down properly. I am likely overlooking something in the way I set up my objects. It's the first issue in a long time that leaves me stumped. And yes, I was hoping that it would fit into the scope of this PR 😉

@speth speth force-pushed the speed-up-tests branch 2 times, most recently from f5ed357 to 5ae11d8 Compare May 1, 2021 17:34
@ischoegl
Copy link
Member

ischoegl commented May 1, 2021

Would it be possible to add d3ee682 as a separate PR? This part of CI apparently broke yesterday, and it would be good if it were available for anyone else to rebase to.

speth added 19 commits May 8, 2021 20:08
Use YAML input format to avoid repeated calls ctml_writer
Blessed output file changed because of addition of N2 to h2o2.yaml
The CTI and XML files in test/data are still in use for tests of the
conversion process.

fixup! [Test] Transition use to pdep-test.yaml
Use to speed up CI coverage testing
The default phase definition for gri30.yaml and h2o2.* includes a
transport model, and setting this slows down tests that don't need
transport properties.

For any tests changed, also switch to using the YAML versions of these
input files. The addition of N2 to h2o2.yaml, along with one reaction,
means that some indices had to change. This also uncovered a bug in
the Gibbs equilibrium solver, which is documented in Cantera#1023.
Species are added before phase-specific parameters like site density
are set. Adding the species sets their coverages, which uses the site
density. Therefore, the initial value for the site density needs to be
non-zero.

This only affected the specific SurfPhase constructor, not methods
which use ThermoFactory, since in that case the default constructor
for SurfPhase gets called, which does set a non-zero site density.
For the case where a Quantity has a converter lambda function,
replacing the converted value has to be done carefully to avoid
accessing already-deleted memory.
Explicit tests of parsing/conversion should remain until removal of
CTI/XML formats.
More consistent with the methods of standard library containers
If the phase is being created from a YAML input file, both the
excess-enthalpy and product-species fields must be provided in that
input.
speth added 12 commits May 8, 2021 20:08
The test IonsFromNeutralConstructor.fromXML test is made redundant by
the combination of ctml2yamlTest.test_mock_ion (which include
instantiation from an XML file) and ThermoFromYaml.IonsFromNeutral
(which instantiates an identical phase from a YAML input file).
These reactions were unintentionally relying on having been created
from YAML when serializing to YAML, where the "type" field from the
input is retained by default.
fixup! [Test] Replace XML with YAML in gtest equilibrium solver tests
@speth speth marked this pull request as ready for review May 9, 2021 00:47
Copy link
Member

@ischoegl ischoegl left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@speth speth merged commit 19f1593 into Cantera:main May 9, 2021
@speth speth deleted the speed-up-tests branch May 9, 2021 22:08
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.

2 participants