Skip to content

Add sundials mpi check#1918

Merged
speth merged 4 commits intoCantera:mainfrom
ischoegl:sundials-mpi-check
Jun 27, 2025
Merged

Add sundials mpi check#1918
speth merged 4 commits intoCantera:mainfrom
ischoegl:sundials-mpi-check

Conversation

@ischoegl
Copy link
Copy Markdown
Member

@ischoegl ischoegl commented Jun 24, 2025

Changes proposed in this pull request

Create a more meaningful error message if Sundials is compiled with MPI support but mpi.h is not found.

I am hesitant to fix the post-merge tests via

scons build CC=mpicc CXX=mpicxx env_vars=all

though, as there is still some hope that Debian maintainers will reconsider the MPI default - relinking https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082085

  • Post-merge tests are fixed
  • Fixed issue for FORTRAN=mpifort

If applicable, fill in the issue number this pull request is fixing

Relates to #1843

If applicable, provide an example illustrating new features this pull request is introducing

See failing "post-merge" tests. Edit: no longer failing

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference 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 ischoegl force-pushed the sundials-mpi-check branch from a4f2b2c to 0b0d66c Compare June 25, 2025 00:05
@ischoegl ischoegl marked this pull request as ready for review June 25, 2025 00:08
@ischoegl ischoegl force-pushed the sundials-mpi-check branch 2 times, most recently from fedb775 to 88254aa Compare June 25, 2025 02:19
@ischoegl ischoegl requested a review from speth June 25, 2025 02:22
@ischoegl ischoegl force-pushed the sundials-mpi-check branch 2 times, most recently from 59e3ee7 to 4fc66b9 Compare June 25, 2025 03:06
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.28%. Comparing base (dee0d51) to head (1cacbf0).
Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1918      +/-   ##
==========================================
+ Coverage   74.11%   74.28%   +0.17%     
==========================================
  Files         445      448       +3     
  Lines       55454    55744     +290     
  Branches     9121     9190      +69     
==========================================
+ Hits        41101    41411     +310     
+ Misses      11262    11232      -30     
- Partials     3091     3101      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@speth
Copy link
Copy Markdown
Member

speth commented Jun 25, 2025

Should we apply the fix of usingmpicc/mpicxx for the post-merge tests? Otherwise, these are going to fail indefinitely, which doesn't seem all that useful.

@ischoegl ischoegl force-pushed the sundials-mpi-check branch 3 times, most recently from 3a65d56 to 3d3f59f Compare June 25, 2025 04:16
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Jun 25, 2025

Should we apply the fix of usingmpicc/mpicxx for the post-merge tests? Otherwise, these are going to fail indefinitely, which doesn't seem all that useful.

Fair. Reading the Debian message, I'm not too hopeful that there's any change in their approach.

I ended up moving the check into buildutils.py so we have a fallback if system_sundials=default; both resolution versions are now covered in "post-merge" tests.

PS: had to disable the f90 interface for MPI as there were some issues:

gfortran -o build/samples/f90/demo -pthread -Wl,-rpath=/usr/local/lib build/samples/f90/demo.o -Lbuild/lib -lcantera_fortran -lcantera -lsundials_cvodes -lsundials_idas -lsundials_nvecserial -lsundials_core -ldl -lhdf5_serial -lfmt -lyaml-cpp -lstdc++
/usr/bin/ld: build/lib/libcantera.a(CVodesIntegrator.os): undefined reference to symbol 'ompi_mpi_comm_null'
/usr/bin/ld: /lib/x86_64-linux-gnu/libmpi.so.40: error adding symbols: DSO missing from command line

which is the same as reported in #1843. Tried adding FORTRAN=mpifort but that wasn’t resolved correctly:

mpifort -o build/src/fortran/fct_interface.os -c -O3 -fPIC -Ibuild/src/fortran -Isrc/fortran -Isrc/fortran -module build/src/fortran src/fortran/fct_interface.f90
gfortran: error: unrecognized command-line option ‘-module’; did you mean ‘-Mmodules’?

@ischoegl ischoegl force-pushed the sundials-mpi-check branch 8 times, most recently from e42f395 to 8128822 Compare June 25, 2025 13:14
@speth
Copy link
Copy Markdown
Member

speth commented Jun 25, 2025

PS: had to disable the f90 interface for MPI as there were some issues:

gfortran -o build/samples/f90/demo -pthread -Wl,-rpath=/usr/local/lib build/samples/f90/demo.o -Lbuild/lib -lcantera_fortran -lcantera -lsundials_cvodes -lsundials_idas -lsundials_nvecserial -lsundials_core -ldl -lhdf5_serial -lfmt -lyaml-cpp -lstdc++
/usr/bin/ld: build/lib/libcantera.a(CVodesIntegrator.os): undefined reference to symbol 'ompi_mpi_comm_null'
/usr/bin/ld: /lib/x86_64-linux-gnu/libmpi.so.40: error adding symbols: DSO missing from command line

which is the same as reported in #1843. Tried adding FORTRAN=mpifort but that wasn’t resolved correctly:

mpifort -o build/src/fortran/fct_interface.os -c -O3 -fPIC -Ibuild/src/fortran -Isrc/fortran -Isrc/fortran -module build/src/fortran src/fortran/fct_interface.f90
gfortran: error: unrecognized command-line option ‘-module’; did you mean ‘-Mmodules’?

Did you try FORTRAN=mpif90? I think mpifort might be assuming it's supposed to be an F77 compiler, where "modules" have no meaning. If that doesn't work, disabling this seems fine, too.

@ischoegl ischoegl force-pushed the sundials-mpi-check branch from 8128822 to 703708c Compare June 25, 2025 13:51
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Jun 25, 2025

Did you try FORTRAN=mpif90? I think mpifort might be assuming it's supposed to be an F77 compiler, where "modules" have no meaning. If that doesn't work, disabling this seems fine, too.

It's something where you have to check what Fortran is wrapped by mpifort. I think I've got it ...

PS: confirmed that we just have to match gfortran syntax. The PR should be ready ...

@ischoegl ischoegl added the CI label Jun 25, 2025
@ischoegl ischoegl force-pushed the sundials-mpi-check branch from 703708c to 92beaad Compare June 25, 2025 22:46
@ischoegl ischoegl force-pushed the sundials-mpi-check branch from 92beaad to c05ee8b Compare June 25, 2025 22:59
@ischoegl
Copy link
Copy Markdown
Member Author

ischoegl commented Jun 26, 2025

After correcting the glitch @bryanwweber noticed, it looks like we're now getting - unrelated - crashes on macOS-13 / Python 13:

One runner crashed with:

[gw2] darwin -- Python 3.13.5 /Library/Frameworks/Python.framework/Versions/3.13/bin/python3
worker 'gw2' crashed while running 'test_reactor.py::TestWellStirredReactorIgnition::test_solve_steady[MoleReactor]'

and another one crashed with:

[gw2] darwin -- Python 3.13.5 /Library/Frameworks/Python.framework/Versions/3.13/bin/python3
worker 'gw2' crashed while running 'test_reactor.py::TestIdealGasMoleReactor::test_advance_with_limits'

The same happened during the merge of #1907, see https://github.com/Cantera/cantera/actions/runs/15888865696/job/44807273791

Another crashing runner is on #1911, see https://github.com/Cantera/cantera/actions/runs/15890473825/job/44811946486?pr=1911

@ischoegl
Copy link
Copy Markdown
Member Author

Pinning Python 3.13 to 3.13.4 on macOS 13 resolves failures similar to those documented in #1916.

Copy link
Copy Markdown
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks, @ischoegl. This looks good to me.

@speth speth merged commit 284a989 into Cantera:main Jun 27, 2025
60 checks passed
@ischoegl ischoegl deleted the sundials-mpi-check branch June 27, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants