Skip to content

Add Fortran export selection and PRIMA static-library example - #72

Merged
saidctb merged 6 commits into
mainfrom
codex/fortran-export-symbols-prima
Sep 22, 2026
Merged

saidctb merged 6 commits into
mainfrom
codex/fortran-export-symbols-prima

Conversation

@saidctb

@saidctb saidctb commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Extend --export-symbols and build_fortran_extension(export_symbols=...) to case-insensitive Fortran module::procedure identities. Only declared Fortran modules can satisfy the module side; source builds and generated-contract builds publish the same selected callable surface.
  • Add a maintained PRIMA example. CMake compiles 55 Fortran sources once into libprimaf.a; PRIK analyzes that source universe, emits contracts for five selected solvers and their callback dependency, then links the wrapper to the archive.
  • Run the PRIMA build and numerical tests in the existing real-library portability matrix on Linux x86-64/ARM64 and macOS Intel/ARM64. The example asserts the exact five-module Python API and exercises required and optional callbacks.

Review guide

Most of the roughly 29,000 added lines are the unmodified, licensed PRIMA Fortran snapshot pinned to upstream commit 1d76fb88aeffb427cd17ed1e9d0d3b34f414913f. The PRIK implementation is concentrated in prik/semantics/fortran_exports.py, the CLI/source-build integration, and contract dependency emission. The wrapper planner and callback backends are unchanged.

The relevant behavior tests are in tests/fortran/functions/semantics/test_fortran_export_symbol_selection.py and tests/fortran/functions/end_to_end/test_fortran_export_symbol_workflow.py. They cover qualified-name validation, a real module colliding with a synthetic external root, generic-interface selection, and source-build versus generated-contract parity. The maintained runtime example is examples/fortran/prima/tests/test_solvers.py.

Verification

  • PRIMA static-library build and runtime: 7 passed locally (GNU Fortran 11.4).
  • Affected Fortran functions, C export selection, and tools: 146 passed, 5 parked-benchmark skips.
  • Documentation: 759 passed, 1 local Jupyter-socket skip; strict MkDocs build passed.
  • Ruff, Bandit, Vulture, and Radon policy passed. The codegen complexity checker reported only advisory recommendations.

The four-target hosted portability run is configured by this PR and will provide its platform results in GitHub Actions.

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@saidctb saidctb changed the title prima Add Fortran export selection and PRIMA static-library example Sep 22, 2026
@saidctb
saidctb merged commit f63f396 into main Sep 22, 2026
@saidctb
saidctb deleted the codex/fortran-export-symbols-prima branch September 22, 2026 23:24
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.

1 participant