Skip to content

2026-09-10 Engineering Team #138

Open

Description

@joecastiglione

Agenda

  • Phase 11 closeout and release readiness: confirm release scope, remaining blockers, and timing; coordinate version/beta status with Product/Community.

ActivitySim

PopulationSim

Performance-testing infrastructure

Coordination

  • Modeling Mobility: decide joint submission and technical topics; assign authors ahead of the September 19 deadline.

Activity

  1. jpn-- commented on Sep 18, 2026

    @jpn--
    Member

    Meeting Overview

    Agenda

    • Review the faster random number generator (RNG) and the maintainability of AI-generated core code.
    • Confirm park-and-ride and calibration documentation status.
    • Agree on the scope of the upcoming ActivitySim release.
    • Review memory reductions in PR #1110 and identify validation needs.

    Participants

    Duration

    Approximately 62 minutes.

    Executive Summary

    The group agreed to proceed with the reviewed RNG implementation after clarifying its error reporting, without adopting an additional AI-generated rewrite that maintainers could not confidently understand. The upcoming ActivitySim release will include the RNG changes and park-and-ride documentation, with other pending work deferred to later releases. The group confirmed that user-facing calibration documentation already exists in the calibration PR. Memory improvements in PR #1110 reportedly allow the CTPS model to run with approximately 52–53 GB of peak memory, but require careful review of chunking behavior and compatibility across models.

    Meeting Notes

    Faster RNG and AI-generated core code

    Jeff proposed replacing the names “simple,” “fast,” and “faster” with names that identify the implementations: legacy, PCG64, and SFC64 hash. The existing names could imply a performance ordering that does not always hold.

    Jan’s review identified a concern about reading a fixed-width block from a NumPy RNG state address. In exploring alternatives, Jeff used AI to develop a rewrite that removed reliance on NumPy internals and CFFI. An initial version introduced an approximately 10% runtime regression; a subsequent version reportedly recovered performance and produced bit-for-bit identical results, but introduced low-level Numba/LLVM and architecture-specific code that Jeff could not confidently maintain.

    The discussion emphasized that:

    • Acceptance of AI-generated code should consider its role, testability, and maintainability.
    • Passing tests does not establish that maintainers understand all relevant failure modes or can safely modify the code later.
    • The reviewed implementation depends on NumPy internals, but its behavior and potential failure points are understood by the reviewers.
    • Jan simulated a memory-layout change and confirmed that tests detected the failure.
    • RNG unit tests cover expected draws, reseeding, entropy, and channel behavior; pipeline and integration tests provide additional coverage.
    • Clear, localized errors are important so that a NumPy compatibility issue does not appear as unexplained failures throughout CI.

    Jan also questioned whether retaining EET sampling justified the added complexity and suggested considering a simpler set of supported options. Jeff explained that repeatedly using NumPy’s standard seeding approach would impose substantial runtime costs under ActivitySim’s reproducibility requirements. No decision was made to remove EET sampling.

    Decision: Jeff will clarify the memory-layout error message and merge the reviewed RNG implementation without the additional low-level AI-generated rewrite.

    Park-and-ride documentation and release scope

    Park-and-ride functionality is already on the main branch, but its documentation was omitted. Jeff prepared documentation for the model components and lot choice functionality, reviewed it briefly, and requested David’s review for accuracy and usability.

    David committed to reviewing the documentation that day.

    Decision: Merge the RNG changes and reviewed park-and-ride documentation, then issue a release within days. This will allow agencies, including TfNSW, to share an installable released version with stakeholders.

    Other pending changes, including memory improvements, shadow-price segmentation, and calibration work, will be considered for later releases. No additional release-blocking engineering requirements were raised.

    Calibration documentation

    Jan relayed an earlier request for searchable, user-facing Sphinx documentation, an example setup, and concise guidance alongside the YAML configurations users edit.

    David showed that the calibration PR already includes user-guide documentation. It is not yet visible in the published documentation because the PR has not been merged and built.

    The group agreed that this addressed the documentation concern. The calibration PR itself remains unfinished and is outside the immediate release scope.

    Memory reductions in PR #1110

    Jeff described PR #1110, developed to help the CTPS Boston model run on a computer with 64 GB of RAM.

    The main change moves preprocessing inside explicit chunk loops, particularly for destination-choice logsums. Previously, preprocessing could create temporary columns for the entire chooser table before chunking began, limiting the memory savings from chunking. In some components, joins between preprocessing and utility evaluation also needed to move inside the chunk loop.

    The PR also reduces table copies and attempts to release unused process memory across operating systems.

    Jeff reported that:

    • The CTPS model has approximately 6,000 zones and now runs end to end with peak memory around 52–53 GB.
    • Some components use roughly 50–100 chunks, trading runtime for lower memory use.
    • Configuration-level optimizations, including compact data types and limited skim contents, were already in place but were insufficient to meet the memory goal.
    • Existing CI tests pass without configuration changes, including tests for the complete SANDAG and MTC models.

    Review requirements

    David and Jan questioned whether existing CI tests exercise the relevant chunking paths. They also raised concerns about preprocessing expressions that depend on information outside a chunk, such as household-level trip counts.

    Reviewers need to determine whether chunk boundaries preserve the necessary household context and whether calculations remain valid when preprocessing operates on subsets of the data.

    Jeff requested review from Jan, David, CJ, and Andrew, including consideration of client models outside CI coverage, such as MWCOG and ARC models. Jan agreed to continue his review.

    David requested before-and-after memory profiles and timing logs to help assess the changes. Jeff agreed to locate and share them.

    Further optimization opportunities

    The PR addresses the components needed to meet the CTPS memory target; it does not optimize every ActivitySim component.

    Jeff identified repeated Sharrow flow selection and hashing within chunk loops as a possible source of avoidable overhead. Reusing the appropriate compiled flow across chunks could improve runtime, but this optimization has not been implemented or fully measured.

    Review direction: Correctness concerns should be resolved before merging. Additional optimization opportunities should be recorded as follow-up issues rather than blocking the PR solely because more improvements are possible.

    Deferred topics

    • Discussion of Kubernetes-related PR #1106 was deferred.
    • The “Momo” topic was left for a subsequent product/community discussion.

    Action Items

    • Jeff: Push the RNG naming changes, clarify the error message for an unexpected NumPy state-memory layout, and merge the reviewed implementation without the additional low-level rewrite.
    • David: Review the park-and-ride documentation for correctness and usability that day.
    • Jeff: Merge the reviewed park-and-ride documentation and prepare an ActivitySim release containing it and the RNG changes within days.
    • Jan, David, CJ, and Andrew: Review PR #1110 for compatibility with agency and client models, especially preprocessing dependencies across chunks, household boundaries, and relevant CI coverage.
    • Jeff: Add before-and-after memory profiles and available timing logs to PR #1110.
    • Reviewers: Open follow-up issues for additional memory and runtime improvements, including reuse of compiled Sharrow flows across chunks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    meetingMeeting notes.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions