Repository navigation
docs(hotpaths): a tour of the hot path for readers who are not Fortran programmers - #136
Merged
Merged
Conversation
…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
marked this pull request as ready for review
November 19, 2026 16:55
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]>
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.
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 tocompute_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,!$ompdirectives, the#ifswitch,.inctemplates); 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