Skip to content

docs(hotpaths): a tour of the hot path for readers who are not Fortran programmers - #136

Merged
elijahmathews merged 2 commits into
feat/hotpath-04b-sfh-stagefrom
feat/hotpath-doc-tour
Nov 19, 2026
Merged

elijahmathews merged 2 commits into
feat/hotpath-04b-sfh-stagefrom
feat/hotpath-doc-tour

Conversation

@elijahmathews

Copy link
Copy Markdown
Owner

Stack: after #135. Merge order: ..., #134, #135, this. Documentation only.

doc/HOT_PATH_TOUR.md: a map of the hot path for someone who knows stellar populations and not necessarily Fortran. The route of a call from the C API to compute_csp_batch; the steps of the routine in order (checks, per-model setup, SFH weights, age sums, nebular emission, dust attenuation, dust emission, IGM and AGN, smoothing, magnitudes, the reverse pass) with the routine and the file of each; the three sources of the SSPs and the K slabs; the age-sum kernel as a first thing to read; a glossary of the Fortran and OpenMP constructs the code uses (real(WP)/real(KP), intent, assumed and explicit shape, pointers, !$omp directives, the #if switch, .inc templates); and where to look when a batch is refused, slow, or differs between builds.

Names are used instead of line numbers, so the tour does not go stale as the code moves; every routine named in it was checked to exist.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5

…n programmers

The route of a call, the steps of compute_csp_batch with the routine and file of each, the SSP source and the K slabs, a first kernel to read, a glossary of the Fortran and OpenMP in the code, and where to look when something is wrong.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5
@elijahmathews
elijahmathews added this pull request to stack #114 November 19, 2026 11:58
@elijahmathews
elijahmathews marked this pull request as ready for review November 19, 2026 16:55
@elijahmathews
elijahmathews merged commit de3376b into main Nov 19, 2026
@elijahmathews
elijahmathews deleted the feat/hotpath-doc-tour branch November 19, 2026 17:49
elijahmathews added a commit that referenced this pull request Nov 19, 2026
…nes, and a stage index in the driver (step 4, third part) (#137)

Stack: the unification plan (`doc/HOT_PATHS_PLAN.md`), step 4 of 5,
third part, after #136 (the tour). Merge order: ..., #135, #136, this.

## What changes

- `batch_mass_cotangent`: the mass output's cotangent in the reverse
pass (the resident basis): `wbl(k, m)` gains `mass_bar(m)` times the
model's blend of the basis' surviving masses, and with per-model
metallicity and gradients the `logzsol` and `afe` rows gain the mass's
derivative with respect to `dz` and `da`.
- `batch_sfh_gradients`: the SFH parameters' gradients through the
weights' tangents (`sfh_weights_tangent`, FP64 on the host, one model
per thread).
- A stage index at the top of `compute_csp_batch`: a comment that lists
the stages (0 checks and plan, 1 setup, 2 SFH weights, 3 age sums, 4
nebular, 5 attenuation, 6 dust emission / IGM / AGN, 7 smoothing, 8
magnitudes, 9 the reverse pass) with the routine of each, so that
reading the driver gives the map that `doc/HOT_PATH_TOUR.md` explains in
plain terms.

The code of the driver is 759 lines (1037 at the start of step 4), 775
with the index. The plan (`doc/HOT_PATHS_PLAN.md`) gets the status.

## Verification

- CPU, both trees built with `-fno-tree-vectorize` (see #134): forward
dumps 6 of 6 and gradient dumps 6 of 6 bit for bit (the resident basis,
metallicity, [alpha/Fe], the IMF per model with the modification
factors, a closed-form field). The gradient dumps exercise both new
routines (the benchmark gives `mass_bar` and the SFH parameters' rows).
- R9700 (both trees rebuilt from scratch, `csp_batch.f90` in both
compile logs): 45 forward dumps, 0 differ bit for bit.
- Host FP64 and FP32 suites, the six R9700 device tests and the
nvfortran 26.1 compile pass.
- The stage index is a comment (checked: it builds).

🤖 Generated with [Claude Code](https://claude.ai/code)

https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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