Generate m_thermochem as Fypp source using MFC's conventions - #1917
Open
sbryngelson wants to merge 1 commit into
Open
sbryngelson wants to merge 1 commit into
sbryngelson wants to merge 1 commit into
Conversation
The generated module defined its own sp/dp kinds and a #define GPU_ROUTINE shim chosen per build from --single and --gpu. It is now Fypp source like the rest of MFC: it includes macros.fpp, takes wp from m_precision_select and marks device routines with $:GPU_ROUTINE(parallelism='[seq]'). One generated source therefore serves every precision and offload configuration, the generator no longer takes scalar_type or offload, and compiler-specific directive handling stays in MFC's macros. CMake already preprocesses build/modules/<target>/*.fpp. syscheck builds without MFC's common sources and does not use the module, so it no longer receives one. Fypp directive lines are exempt from the generator's line wrapping. The kernel tests run the generated source through Fypp with MFC's include paths, as the build does. Done with Claude Code.
|
Claude Code Review Head SHA: 7d0bf93 Files changed:
Findings:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1917 +/- ##
=======================================
Coverage 61.48% 61.48%
=======================================
Files 86 86
Lines 22485 22485
Branches 3298 3299 +1
=======================================
Hits 13826 13826
Misses 6206 6206
Partials 2453 2453 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1915. The generated
m_thermochemwas a standalone Fortran file with its ownsp/dpkinds and a#define GPU_ROUTINEshim, chosen per build from--singleand--gpu. It is now Fypp source that follows MFC's conventions:#:include 'macros.fpp',use m_precision_select, only: wp,real(wp)and_wpliterals.$:GPU_ROUTINE(function_name='...', parallelism='[seq]'), so OpenACC/OpenMP/CPU directive emission and any compiler-specific handling happen in MFC's macros, not in the generator.generate_fortranno longer takesscalar_typeoroffload, andrun/input.pyloses the precision/offload plumbing.The generated file is written as
build/modules/<target>/m_thermochem.fpp;cmake/Fypp.cmakealready preprocesses*.fppthere. The template is renamedmodule.fpp.mako.Two small consequences:
syscheckis built without MFC's common sources (HANDLE_SOURCES(syscheck OFF)), so it has nom_precision_select. It never usedm_thermochem, so the toolchain stops generating it for that target.$:,#:,@:) whole.What this does not do
The two call-site workarounds around
m_thermochemstay: callers formingR_species = gas_constant/molecular_weightsbecause nvfortran cannot pass theparameterarray into a declare-target routine, and species properties evaluated in the loop body because CCE faults one routine deeper. Neither is a directive problem, so moving to$:GPU_ROUTINEdoes not address them, and I could not test nvfortran or CCE here.Testing
--gpu mp,OMP_TARGET_OFFLOAD=MANDATORY):./mfc.sh test --only Chemistry- 16 passed, 0 failed against the existing goldens.--only Chemistry- 16 passed, 0 failed.toolchain/mfc/test_thermochem.py(15 tests): the kernel tests now run the generated source through Fypp with MFC's include paths, as the build does, and compile it withm_precision_select.f90; double, single (-DMFC_SINGLE_PRECISION), mixed, and OpenACC/OpenMP (-DMFC_OpenACC/-DMFC_OpenMP) variants all compare against Cantera. I also checked that the same generated source preprocesses to!$acc routine seq,!$omp declare target device_type(any), and no directive on CPU../mfc.sh precheckpasses.Worth watching in CI: nvfortran OpenACC and CCE (Frontier) lanes, which are the ones I could not run.
Prepared with Claude Code.
Contribution Policy
We do not accept pull requests generated primarily by AI without genuine understanding or real-world usage context.
All contributions are expected to demonstrate:
If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.
Acknowledgement
PR template credit: junegunn