Repository navigation
Conversation
The SSA aggregators drew every waiting time with `randexp(rng)`, a Float64, so `t + randexp(rng) / rate` widened Float32 times (making CCNRM's Float32 time table fail) and gave BigFloat times only Float64 draws; VR_Direct mixed typed and untyped draws. A new `typed_randexp(rng, t)` draws in `typeof(one(t))`, the time's numeric type without units: floating-point types with `randexp(rng, T)`, other numbers (e.g. dual numbers) by converting a Float64 draw. All exponential draws in the aggregators and the VR aggregators use it. For Float64, `randexp(rng, Float64)` is `randexp(rng)`: seeded results are unchanged, and the compiled code of every JumpProcesses method reached from the aggregators is identical (up to stack-slot assignment in four spatial methods), as are timings within run-to-run noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rectCRDirect Ported from SciML#716 (issue SciML#674). The composition-rejection aggregators computed their minimum rate as `2.0^minexponent`, a Float64, so building a problem with Float32 or BigFloat rates failed with a MethodError. The minimum rate is now in the rates' type. For Float32, the default minimum rate 2^-40 is also below eps(Float32), which `priortogid` maps to group 1, so the initial table (maxpriority = 2 * minrate) would get no groups and a zero maxpriority, and growing it to fit a rate would loop forever: `PriorityTable` now keeps at least the three base groups {0}, (0, minpriority) and [minpriority, 2 * minpriority). For Float64, 2 * minrate is above eps, so the table already had three groups; both changes run only when a JumpProblem is built, and seeded results and the compiled solve code are unchanged. SciML#716's `convert`s in `update!(::PriorityTimeTable)` aren't needed, since times are now drawn in the time's type. Tests: Float32 priority tables (from SciML#716); Float32 and BigFloat solves with every SSA aggregator (except RDirect for BigFloat), NSM and DirectCRDirect, checking the mean; and isolated_copy of unsolved BigFloat DirectCR and RSSACR problems. Co-Authored-By: ChrisRackauckas-Claude <224351616+ChrisRackauckas-Claude@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
Benchmark Results (Julia lts)Time benchmarks
Memory benchmarks
|
Test the sample means to 4 standard deviations of a Poisson mean, with 4000 Float32 and 1000 BigFloat simulations: within 2% (Float32) and 4% (BigFloat) of the mean of X(10), where they were within 5% and 10%. The two-site spatial totals used twice the one-site tolerance, about 7 standard deviations; they now use their own, sqrt(20 / Nsims). All the current means are within 1.2 standard deviations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the second review of SciML#718: - NSM and DirectCRDirect stored reaction rates as Float64 (`RxRates`), so a BigFloat rate below floatmin(Float64) rounded to zero and its reaction never fired. `RxRates` now takes the rate type, and both use the time's type, as the other aggregators do; the two-argument constructor still makes Float64 rates. - DirectCR, RSSACR and DirectCRDirect took the exponent of a `minrate` keyword before converting it to the rates' type: with `minrate = 1e-50` and Float32 rates, the minimum rate became zero and growing the table looped forever. `minrate` is now converted first and raised to at least floatmin(T) (converting 1e-50 to Float32 gives zero, whose exponent is an error); rates that small are in the table's lowest group either way. - A rate of at least 2^exponent(floatmax(T)) (e.g. 2f0^127) is in the group whose upper bound overflows to Inf, so `sample` could never accept it. `padtable!` caps a new group's rejection bound at floatmax(T), while the table's `maxpriority` still reaches Inf. The constructor never makes that group, since its groups end below `maxpriority`. This also affected Float64, on master too. - `typed_randexp` draws floating-point times in their own type without `one(t)`, which allocated a BigFloat per draw (~93 bytes). - The Float32 table-growth test inserted id 1 twice; it now updates it, and checks `resum!`. Float64 results are unchanged (seeded paths identical to master in 18 cases), and the compiled solve code is identical except `padtable!`, which runs only when a table grows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1cf3c-03f2-7cb3-aab3-147657206439, reviewed head cb1a0be
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. CI: green Riskmedium (M2: changes numerical results on working Float32 spatial paths; a silent regression is confirmed against the base revision). Blocking findings
Non-blocking findingsNone. What I ranReviewer: codex-cli 0.164.0, model gpt-6.1-sol. Julia reported
What I did not verifyOther Julia versions, QA, the dedicated ThreadSafety group, GPU execution, or the documentation build. CI green is supplied by the review job; I did not inspect remote CI, the PR body, comments, reviews, author risk ratings, or sibling review artifacts. The newest commit has no Agent-Harness or Agent-Model trailers, so both author attribution fields below are unknown. 🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
|
Thanks for the report. The cancellation is real, but it isn't specific to This PR makes the spatial reaction rates follow the time's type, like every other aggregator's rates, so 🤖 Generated with Claude Code 2.1.321 (model: claude-opus-5-5) |
From the fourth review of SciML#718. Rates at or below eps(T) all go in the tables' first group, so a smaller minrate only adds empty groups, one per power of two: with minrate = floatmin(BigFloat) (2^-1073741824 on Julia 1.13), a rate of 1 maps to group about 1.07e9, and growing the table to it exhausts memory. DirectCR, RSSACR and DirectCRDirect now raise minrate to at least eps(T), replacing the floatmin(T) floor. The Float64 and BigFloat defaults (2^-40) are unchanged; the Float32 default rises to eps(Float32) = 2^-23, which removes 17 empty groups and leaves seeded paths unchanged. The suggested upper bound, floatmax(T) / 2, is left out: a minrate of 2f0^127 fails at construction (DomainError), and clamping it to 2^126 puts every ordinary rate in one group rejection-sampled against 2^126, so a solve with rates [10, 1] doesn't finish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR: #718 Reviewed head: 49901d4 Risk assessment
Review reportVERDICT: CHANGES Riskmedium (M2: changes trajectories on working Float32 spatial paths; a silent regression is confirmed against the base revision). Blocking findings
Non-blocking findingsNone found in the delta. The minimum-rate change passes the targeted execution, sampling and seeded-trajectory checks below. What I ranReviewer: codex-cli 0.164.0, model gpt-6.1-sol. Julia reported
What I did not verifyOther Julia versions, QA, the dedicated ThreadSafety group, GPU execution or the documentation build. I did not inspect remote CI, the PR body, comments, author ratings, same-head prior reviews or sibling review directories. CI status above is supplied by the review job. The newest commit has neither Agent-Harness nor Agent-Model trailers, so both author attribution values are unknown. AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":3,"rounds":3,"author_harness":"unknown","author_model":"unknown","note":"The minimum-rate delta passes constructor, BigFloat solve, analytic sampling and seeded compatibility probes, but the prior Float32 spatial regression remains reproducible on the head and passes on the base."} Head link: 49901d4 🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol |
Supersedes #716, whose priority-table fix is ported in the second commit (with its author as co-author). Fixes #674.
Changes
randexp(rng), aFloat64, sot + randexp(rng) / ratewidenedFloat32times (making CCNRM'sFloat32time table fail with aMethodError) and gaveBigFloattimes onlyFloat64draws.VR_Directmixed typed and untyped draws. A new internaltyped_randexp(rng, t)draws intypeof(one(t)), the time's numeric type without units:randexp(rng, T)for floating-point types, and a convertedFloat64draw for other numbers such asForwardDiff.Dual. All 25 exponential draws in the SSA aggregators and the 6 inVR_FRM,VR_DirectandVR_DirectFWuse it. The uniformrand(rng)draws used for selection stayFloat64.Float32andBigFloatpriority tables (from Fix Float32/BigFloat priority-table setup (issue #674) #716). The minimum rate is built in the rates' type (T(2)^minexponentinstead of2.0^minexponent).PriorityTablekeeps at least its three base groups: forFloat32, the default minimum rate 2^-40 is beloweps(Float32), so the initial table would otherwise have no groups and a zeromaxpriority, and growing it to fit a rate would loop forever. Fix Float32/BigFloat priority-table setup (issue #674) #716'sconverts inupdate!(::PriorityTimeTable)aren't needed after the first change, since times now arrive in the table's type.On master,
DirectCR,RSSACRandDirectCRDirectfail with aMethodErrorwhen building a problem withFloat32orBigFloatrates, andCCNRMfails when solving one withFloat32times. With this PR, every SSA aggregator,NSMandDirectCRDirectsolve problems withFloat32andBigFloattimes, exceptRDirectwithBigFloat, which still fails at construction (a separate issue).No
Float64changesFor
Float64,randexp(rng, Float64)israndexp(rng),T(2)^eis2.0^e, and the table already had three groups (2 * minrate > eps(Float64)). Checked on Julia 1.13.3 against master d9c94ec:Coevolvewith a boundedVariableRateJump,VR_FRM,VR_Direct,VR_DirectFW,NSMandDirectCRDirect.initialize!,generate_jumps!andexecute_jumps!is identical, except for the GC stack-slot offsets in a few spatial methods, which also differ between two builds of the same code. The VR aggregators' affect and initialization code is identical too. The priority-table changes run only when aJumpProblemis built.NSM/DirectCRDirect, in rotated rounds against master and an A/A control (a second build of master): all differences are within the A/A spread.Seeded results can change for
Float32problems (the same draws, butFloat32arithmetic) andBigFloatproblems (full-precision draws), as noted in HISTORY.Tests
test/fp_unknowns.jl:typed_randexp's types (Float32,Float64,BigFloat,Dual);Float32andBigFloatsolves with every SSA aggregator (exceptRDirectforBigFloat),NSMandDirectCRDirect, checking the mean of a birth-death process.test/table_test.jl:Float32priority tables, including the one DirectCR builds (from Fix Float32/BigFloat priority-table setup (issue #674) #716).test/isolated_copy.jl: unsolvedBigFloatproblems now includeDirectCRandRSSACR.fp_unknowns.jl,table_test.jl,isolated_copy.jl,ssa_aggregator_smoke.jl,spatial/ABC.jlandvariable_rate.jlpass.🤖 Generated with Claude Code 2.1.321 (model: claude-opus-5-5)