Skip to content

Commit fa5b732

Browse files
committed
clean blas and lapack examples
1 parent a4353f7 commit fa5b732

76 files changed

Lines changed: 726 additions & 1169 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/blas-lapack.yml‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ jobs:
6363
env:
6464
PYTHONPATH: .
6565
HYPOTHESIS_PROFILE: ci
66-
run: >-
67-
python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"
68-
examples/blas examples/blas/ci_full_surface.py
66+
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
67+
run: |
68+
source examples/blas/build_all.sh
69+
python -m pytest -q examples/blas/tests examples/blas/ci/full_surface.py
6970
- name: Report reviewed LAPACK inventory
7071
env:
7172
PYTHONPATH: .
7273
run: |
7374
python - <<'PY'
74-
from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS
75+
from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS
7576
from examples.lapack.routine_inventory import (
7677
EXPECTED_LAPACK_ROOT_PROCEDURES,
7778
EXPECTED_LAPACK_SOURCE_FILES,
@@ -93,6 +94,6 @@ jobs:
9394
PYTHONPATH: .
9495
HYPOTHESIS_PROFILE: ci
9596
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
96-
run: >-
97-
python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"
98-
examples/lapack examples/lapack/ci_full_surface.py
97+
run: |
98+
source examples/lapack/build_all.sh
99+
python -m pytest -q examples/lapack/tests examples/lapack/ci/full_surface.py

‎.github/workflows/merge-validation.yml‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,15 +618,16 @@ jobs:
618618
env:
619619
PYTHONPATH: .
620620
HYPOTHESIS_PROFILE: ci
621-
run: >-
622-
python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"
623-
examples/blas examples/blas/ci_full_surface.py
621+
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
622+
run: |
623+
source examples/blas/build_all.sh
624+
python -m pytest -q examples/blas/tests examples/blas/ci/full_surface.py
624625
- name: Report reviewed LAPACK inventory
625626
env:
626627
PYTHONPATH: .
627628
run: |
628629
python - <<'PY'
629-
from examples.lapack.f2py_contract import F2PY_INOUT_ARGUMENTS
630+
from examples.lapack.f2py_build import F2PY_INOUT_ARGUMENTS
630631
from examples.lapack.routine_inventory import (
631632
EXPECTED_LAPACK_ROOT_PROCEDURES,
632633
EXPECTED_LAPACK_SOURCE_FILES,
@@ -648,9 +649,9 @@ jobs:
648649
PYTHONPATH: .
649650
HYPOTHESIS_PROFILE: ci
650651
PRIK_REAL_LIBRARY_NATIVE_CACHE_DIR: ${{ runner.temp }}/prik-real-library-native
651-
run: >-
652-
python -m pytest -q -o "python_files=test_*.py ci_full_surface.py"
653-
examples/lapack examples/lapack/ci_full_surface.py
652+
run: |
653+
source examples/lapack/build_all.sh
654+
python -m pytest -q examples/lapack/tests examples/lapack/ci/full_surface.py
654655
655656
documentation-benchmark:
656657
name: Documentation performance benchmark · Ubuntu 24.04 ARM64 · Python 3.12

‎docs/developer/quality-assurance.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ For subprocess coverage investigations, mirror that command shape before
100100
deciding a fix. A plain local coverage run can miss subprocess data.
101101
Every Python version excludes the full BLAS/LAPACK real-library wrapper test
102102
while retaining general native-bundle coverage. The `Native Libraries`
103-
component runs the complete BLAS and LAPACK examples on Python 3.12. Those
104-
pytest invocations explicitly add each example's non-discovered
105-
`ci_full_surface.py`, reusing the session-scoped extension for complete
106-
root-export audits and runtime smoke calls instead of rebuilding the wrapper
107-
layer in a second process. A pull request may use the
103+
component runs the complete BLAS and LAPACK examples on Python 3.12. Each job
104+
step sources `build_all.sh`, which sources the exact `build_prik.sh` and
105+
`build_f2py.sh` sequences displayed in the user documentation, before starting
106+
pytest. Each f2py script reuses the native library from its PRIK script, and
107+
each explicitly selected `ci/full_surface.py` audit reuses the PRIK extension.
108+
The job therefore verifies the copyable commands without repeating native
109+
compilation or wrapper construction in a second process. A
110+
pull request may use the
108111
`ignore-real-library-wrappers` label to skip that expensive component without
109112
disabling the ordinary Python-version matrix.
110113

‎docs/developer/repository-structure.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ through `prik/__init__.py`.
5656
| `tests/fortran/infrastructure/` | Internal cross-feature policy, wrapper-generation, compiler, and runtime frameworks with no honest public-capability owner. |
5757
| `tests/c/` | C input-language parsing, preprocessing, probe, semantic, CLI, and fixture evidence. |
5858
| `tests/shared/` | Language-neutral product architecture, documentation, naming, tools, type mapping, and utility checks. |
59-
| `examples/blas/test_*.py` | Dedicated real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. |
60-
| `examples/lapack/test_*.py` | CI-only real-library correctness documentation: explicit independent and PRIK/SciPy/f2py validation for the reviewed double-precision routine inventory. |
59+
| `examples/blas/tests/test_*.py` | User-facing real-library correctness documentation: explicit independent and PRIK/f2py differential validation for every Reference BLAS routine. |
60+
| `examples/blas/ci/full_surface.py` | Maintainer-only complete BLAS export and smoke audit, selected explicitly by CI. |
61+
| `examples/lapack/tests/test_*.py` | User-facing real-library correctness documentation: explicit independent and PRIK/SciPy/f2py validation for the reviewed double-precision routine inventory. |
62+
| `examples/lapack/ci/full_surface.py` | Maintainer-only complete LAPACK export and smoke audit, selected explicitly by CI. |
6163

6264
<!-- PRIK_C_DOCS_START
6365
| `tests/c/fixtures/parser/` | C parser-specific tests and fixture maintenance. |

‎docs/developer/source-map.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ change crosses ownership boundaries.
5050
| Immediate callback policy, typed adapters, and trampolines | `prik/semantics/wrapper_policy.py`, `prik/semantics/policy_completion.py`, `prik/wrapper_codegen/plan.py`, `prik/wrapper_codegen/planner.py`, `prik/wrapper_codegen/c/binding.py`, `prik/wrapper_codegen/fortran/bridge.py` | `docs/user/guide/callbacks.md`, `docs/user/reference/semantic-pyi-format.md` | `tests/fortran/callbacks/` |
5151
| Native compilation, binding support, and shared-library linking | `prik/pipeline/build.py`, `prik/compiling/compilers.py`, `prik/compiling/native_support.py` | `docs/user/reference/fortran-wrapper.md`, `docs/developer/build-system.md` | `tests/fortran/building_shared_library/end_to_end/test_runtime_compatibility.py`, `tests/fortran/building_shared_library/end_to_end/test_source_build_modes.py` |
5252
| Public Python exports | `prik/__init__.py` | `README.md`, `docs/user/reference/python-api.md` | `tests/fortran/source_parsing/parsing/test_public_entrypoints.py` |
53-
| Reference BLAS source ownership, inventory, and numerical validation | `examples/blas/routine_inventory.py`, `examples/blas/test_routine_coverage.py` | `examples/blas/README.md`, `docs/user/examples/blas-wrapper.md` | `examples/blas/test_*.py`, dedicated BLAS/LAPACK workflow |
54-
| Reference LAPACK source ownership, inventory, and numerical validation | `examples/lapack/routine_inventory.py`, `examples/lapack/test_routine_coverage.py` | `examples/lapack/README.md`, `docs/user/examples/lapack-wrapper.md` | `examples/lapack/test_*.py`, dedicated BLAS/LAPACK workflow |
53+
| Reference BLAS source ownership, inventory, and numerical validation | `examples/blas/routine_inventory.py`, `examples/blas/tests/test_routine_coverage.py` | `examples/blas/README.md`, `docs/user/examples/blas-wrapper.md` | `examples/blas/tests/test_*.py`, `examples/blas/ci/full_surface.py`, dedicated BLAS/LAPACK workflow |
54+
| Reference LAPACK source ownership, inventory, and numerical validation | `examples/lapack/routine_inventory.py`, `examples/lapack/tests/test_routine_coverage.py` | `examples/lapack/README.md`, `docs/user/examples/lapack-wrapper.md` | `examples/lapack/tests/test_*.py`, `examples/lapack/ci/full_surface.py`, dedicated BLAS/LAPACK workflow |
5555
| Source navigation documentation | `docs/developer/source-map.md`, `docs/developer/feature-to-code-map.md`, package README files | `docs/developer/source-map.md` | `tests/shared/docs/test_structure.py` |
5656

5757
<!-- PRIK_C_DOCS_START

‎docs/developer/testing-strategy.md‎

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,35 +120,44 @@ Keep fixtures beside their final behavioral owner:
120120
`examples/lapack/native/`, shared by its correctness example and full-library
121121
integration.
122122

123-
Generate build products and temporary contracts in pytest temporary
124-
directories. Check in generated `.pyi` only where exact generation text,
123+
Generate build products and temporary contracts in temporary directories.
124+
Check in generated `.pyi` only where exact generation text,
125125
imports, placement, or package shape is the invariant.
126126

127-
For BLAS behavior, run `python3 -m pytest -q examples/blas` or one of its named
128-
test functions. The example-owned native builder compiles the sorted
129-
155-source implementation once; PRIK and f2py generate their own wrappers and
130-
link both to that artifact. `test_routine_coverage.py` audits the parsed source
131-
inventory, both export sets, visible named tests, and terminal outcomes. The
132-
separate full-library node remains available as opt-in
133-
`build_pyi_extension` and native-link integration evidence, but the dedicated
134-
CI lane explicitly adds `examples/blas/ci_full_surface.py` to the same pytest
135-
invocation and does not rebuild its wrappers afterward. Ordinary example runs
136-
do not discover that CI-only file.
137-
138-
For LAPACK behavior, the dedicated lane runs
139-
`python3 -m pytest -q examples/lapack`. Its example-owned builder compiles the
140-
complete LAPACK corpus and required authoritative BLAS dependencies once;
141-
PRIK and f2py link their distinct wrappers to that same artifact while testing
142-
the reviewed 127-routine SciPy 1.18.0 `float64` inventory. The inventory audit fails on SciPy drift,
143-
missing sources or exports, missing explicitly named tests, and divergent
144-
documentation totals. CI explicitly adds `examples/lapack/ci_full_surface.py`
127+
For BLAS behavior, source `examples/blas/build_all.sh`, then run
128+
`python3 -m pytest -q examples/blas/tests` or one of its named test functions.
129+
The aggregate script sources the exact documented `build_prik.sh` and
130+
`build_f2py.sh` sequences. This compiles the sorted 155-source implementation
131+
once and builds each wrapper once; f2py links to the native artifact produced
132+
by the PRIK script.
133+
Documentation source markers require the displayed commands to remain
134+
byte-for-byte equal to the executed scripts. `test_routine_coverage.py` audits
135+
the parsed source inventory, both export sets, visible named tests, and terminal
136+
outcomes. The dedicated CI lane explicitly adds
137+
`examples/blas/ci/full_surface.py` to the same pytest invocation and does not
138+
rebuild its wrappers afterward. User-run correctness tests and maintainer-only
139+
audits therefore have separate directories.
140+
141+
For LAPACK behavior, the dedicated lane sources `examples/lapack/build_all.sh`
142+
and then runs `python3 -m pytest -q examples/lapack/tests`. The aggregate
143+
script sources the exact documented `build_prik.sh` and `build_f2py.sh`
144+
sequences. The complete native corpus is compiled once, each wrapper is built
145+
once, and the f2py script reuses the native artifact produced by the PRIK
146+
script while testing the reviewed 127-routine SciPy 1.18.0 `float64`
147+
inventory. Documentation source markers keep the displayed commands equal to
148+
the executed scripts. The inventory audit fails on SciPy drift, missing
149+
sources or exports, missing explicitly named tests, and divergent
150+
documentation totals. CI explicitly adds `examples/lapack/ci/full_surface.py`
145151
to the same pytest invocation, reusing the complete PRIK extension to require
146-
all 2,064 root exports and run a non-inventory runtime smoke call. Ordinary
147-
example runs do not discover that file.
152+
all 2,064 root exports and run a non-inventory runtime smoke call. User-run
153+
correctness tests and maintainer-only audits have separate directories.
148154

149155
The complete `examples/` tree is a copyable execution boundary. Example code
150156
may depend on an installed `prik` and its documented external toolchain, but it
151-
must not import repository-only helpers from `tests/`.
157+
must not import repository-only helpers from `tests/`. The workflow must source
158+
the documented build scripts through `build_all.sh` before starting pytest,
159+
rather than run a second build test that repeats native compilation or wrapper
160+
construction.
152161

153162
## Ownership discipline
154163

‎docs/maintainer/roadmap/fortran-test-suite-cleanup-checklist.md‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ tests/
9393
building_shared_library/
9494
pipeline/
9595
end_to_end/
96-
real_libraries/
97-
blas/
98-
lapack/
9996
source_parsing/
10097
parsing/
10198
source_preprocessing/
@@ -260,8 +257,8 @@ Register a structural marker for cross-feature selection:
260257
- [x] Shared tests import no language-owned helpers.
261258
- [x] Fortran and C tests import neither each other's helpers nor fixtures.
262259
- [x] Feature-local fixtures live with their owner. Minimized parser
263-
regressions live under `source_parsing/parsing/`; BLAS and LAPACK live only under
264-
`building_shared_library/end_to_end/real_libraries/`.
260+
regressions live under `source_parsing/parsing/`; BLAS and LAPACK live only
261+
under `examples/blas/` and `examples/lapack/`.
265262
- [x] `python -m pytest tests/fortran/arrays` runs every stage of the
266263
Arrays contract without collecting unrelated features.
267264
- [x] Every node below a feature's `end_to_end/` directory carries
@@ -1219,8 +1216,7 @@ Historical regression ownership after reduction:
12191216
### BLAS and LAPACK
12201217

12211218
- [x] Move the real-library projects to
1222-
`examples/blas/` and
1223-
`tests/fortran/building_shared_library/end_to_end/real_libraries/lapack/`.
1219+
`examples/blas/` and `examples/lapack/`.
12241220
- [x] Treat them only as full-pipeline evidence: build from the library sources,
12251221
generate wrappers, compile/link, import the extension, and verify the public
12261222
Python surface and representative runtime calls.

‎docs/maintainer/roadmap/semantic-pyi-wrapper-checklist.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ argument handoff from the native barrier action.
110110

111111
Runtime wrapper tests are organized by stable subjects under
112112
`tests/wrapper/fortran/`: `build_from_source/`, `build_from_pyi/`,
113-
`multiple_files/`, `external_routines/`, `real_libraries/`,
114-
`edit_pyi_contracts/`, `arrays/`, `scalars/`, `function_calls/`,
113+
`multiple_files/`, `external_routines/`, `edit_pyi_contracts/`, `arrays/`,
114+
`scalars/`, `function_calls/`,
115115
`strings/`, `derived_types/`, `callbacks/`, `module_state/`,
116116
`runtime_behavior/`, `naming/`, and `layout_rules/`.
117117

@@ -350,9 +350,9 @@ evidence lives in `tests/cli/`.
350350

351351
### Stage 7 — Library-Scale And Mixed-Bundle Evidence
352352

353-
Real BLAS/LAPACK artifact-shape evidence lives in
354-
`tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py`. Native
355-
bundle, order, transitive-library, and failure-path evidence lives in
353+
Real BLAS/LAPACK artifact-shape evidence lives in `examples/blas/` and
354+
`examples/lapack/`. Native bundle, order, transitive-library, and failure-path
355+
evidence lives in
356356
`tests/fortran/building_shared_library/end_to_end/test_native_bundles.py`.
357357

358358
- [x] Full real BLAS and LAPACK source corpora under `examples/blas/native/`
@@ -364,11 +364,11 @@ bundle, order, transitive-library, and failure-path evidence lives in
364364
helper declarations, imported symbols, and representative runtime behavior.
365365
Real-library evidence keeps no checked generated `.pyi`, edited `.pyi`, or
366366
source-free replay fixture.
367-
- [x] The full-library evidence builds each full root procedure contract with
368-
`build_pyi_extension`, links it against a cached full native shared library,
369-
imports every generated root procedure through the normalized Python names,
370-
and checks that source stems and known generated helper declarations line up
371-
with the shared native corpora.
367+
- [x] The example evidence builds each full root procedure contract through the
368+
documented PRIK command, links it against one native shared library, imports
369+
every generated root procedure through normalized Python names, and checks
370+
that source stems and known generated helper declarations line up with the
371+
shared native corpora.
372372
- [x] Full native BLAS/LAPACK object files are compiled once into a deterministic
373373
`.pytest_cache/prik/real-library-native` cache, archived once, and linked once
374374
into the shared libraries reused by repeated wrapper test runs; CI can move

‎docs/maintainer/roadmap/wrapper-plan-migration-checklist.md‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,10 @@ route easier to exercise.
561561
generates a runtime wrapper must use the wrapper-plan route after cutover.
562562
Tests that only inspect documentation, layout, parsing, or `.pyi` generation
563563
may be `not-applicable` but must still pass.
564-
- During active migration, every local and GitHub Actions pytest invocation
565-
excludes
566-
`tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py`. Mark its BLAS
567-
and LAPACK rows `deferred-real-library`; do not use either corpus for lane
568-
parity or general migration verification. General native-bundle tests in
569-
`test_stage7_native_bundles.py` remain active because they test linker/build
570-
mechanics independently of the full BLAS/LAPACK corpora.
564+
- During active migration, ordinary pytest invocations exclude the full BLAS
565+
and LAPACK example projects. Their dedicated lane owns library-scale
566+
verification. General native-bundle tests remain active because they test
567+
linker/build mechanics independently of the full corpora.
571568

572569
### Wrapper Test Migration Matrix
573570

@@ -795,7 +792,6 @@ already covered by the new generator.
795792
| `tests/wrapper/fortran/naming/test_phase9_class_overloads.py::*` | reduced direct-plan constructor and method overload runtime proof | class-owned exact predicates; constructor ownership; no speculative calls | `wrapper-plan` |
796793
| `tests/wrapper/fortran/naming/test_visibility_naming.py::test_strict_wrapper_names_reject_python_name_fixes` | direct wrapper/build route | naming/visibility/dispatch; classes/methods/properties/overloads | `wrapper-plan` |
797794
| `tests/wrapper/fortran/naming/test_visibility_naming.py::test_visibility_and_default_python_name_fixing_policy[*]` | source/generated-.pyi parity or parametrized route | naming/visibility/dispatch; classes/methods/properties/overloads | `wrapper-plan` |
798-
| `tests/fortran/building_shared_library/end_to_end/real_libraries/test_full_libraries.py::*` | canonical full BLAS/LAPACK wrapper generation; BLAS runs locally and both exact nodes run together in the dedicated GitHub Actions job | external symbols/native linkage; build/compile/link orchestration; broad wrapper corpus | `wrapper-plan` |
799795
| `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_duplicate_native_definitions_report_linker_error` | direct wrapper/build route | scalar external symbols; linker failure propagation | `wrapper-plan` |
800796
| `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_imported_contracts_resolve_from_one_archive_or_shared_library[*]` | source/generated-.pyi parity or parametrized route | external symbols/native linkage; build/compile/link orchestration | `wrapper-plan` |
801797
| `tests/fortran/building_shared_library/end_to_end/test_native_bundles.py::test_incompatible_native_artifact_reports_linker_error` | non-generating: validation/failure-path assertion | external symbols/native linkage; build/compile/link orchestration | `not-applicable` |
@@ -4679,8 +4675,8 @@ Implement in these dependency-ordered waves:
46794675

46804676
- [x] Reconcile every remaining `legacy` or `dual-route` matrix row by owning
46814677
test area: `build_from_source`, `build_from_pyi`, `edit_pyi_contracts`,
4682-
`external_routines`, `multiple_files`, `naming`, `runtime_behavior`, and
4683-
`real_libraries`.
4678+
`external_routines`, `multiple_files`, `naming`, `runtime_behavior`, and the
4679+
full BLAS/LAPACK examples.
46844680
- [x] Group remaining rows into dependency-ordered waves by their actual
46854681
unsupported owner paths. Do not implement a broad test directory as one
46864682
special case and do not add per-test backend fallbacks.

0 commit comments

Comments
 (0)