Add quantum-kick synchrotron radiation mode#815
Open
JPTS2 wants to merge 38 commits into
Open
Conversation
Found issue with the tables for lambda is one Currently too high probability
Remove other options and cleanup
Contributor
Author
Diff size noteMost of the line count in this PR comes from the generated header The table is generated by: |
Reduce the number of particles in test_ring_with_radiation from 100 to 50 to keep the serial test runner time acceptable. With 50 particles the stochastic RMS estimate has larger finite-sample spread, so relax the ring emittance tracking tolerance from 20% to 25%. The same tolerance is used for both quantum and quantum-kick.
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.
Summary
This PR adds a new stochastic synchrotron-radiation mode,
quantum-kick.The existing
quantummode samples individual photon emissions. This is physically detailed and supports photon logging, but it is expensive, especially on GPU backends. The newquantum-kickmode instead samples the stochastic total radiation kick using precomputed total-energy tables. It is intended for cases where the stochastic radiation effect is needed, but individual photon logging is not.The public API is:
Internally, this maps to
radiation_flag == 3.Motivation
The main motivation is making stochastic radiation tracking practical on GPU backends.
On the machines tested, CPU performance is not the main differentiator:
quantum-kickhas broadly comparable cost to photon-by-photonquantumtracking on CPU. The important difference appears on GPU, where photon-by-photon radiation becomes the limiting path.Using the timing examples under
examples/tracking_timeon the FCC-ee example line:quantumreached the timing limit at 8 particles.quantum-kickcontinued scaling to 16384 particles.quantum-kickwas about 3.4x faster thanquantum.This matters because the Titan V result is already substantially faster than the CPU machines available for this workflow. In these measurements, a MacBook Pro using 8 OpenMP threads is often around 2x faster than an 8-core HTCondor CPU job, while the Titan V is about 3x faster again for the relevant stochastic-radiation workload. That makes the Titan V roughly comparable to many HTCondor CPU cores for this use case, and this is before testing the H100 GPUs available for production studies.
The intended performance message is therefore:
Implementation
This PR adds:
configure_radiation(model='quantum-kick')radiation_flag == 3handling in radiation-enabled elementsquantum-kickThe behavior distinction is:
quantum: samples individual photons and supports photon loggingquantum-kick: samples the stochastic total kick and does not log individual photonsExamples
The examples under
examples/radiation/quantum_kick_vs_quantum/validate the new model against the existingquantummodel.They cover:
The tracking-time examples under
examples/tracking_time/were used for the performance checks described above. They now also print the raw particle-count and timing arrays used for the plots, making it easier to copy results from different machines and produce comparison figures without modifying the scripts.Tests
The test suite has been updated so that
quantum-kickis treated as a first-class radiation mode wherever the expected particle-coordinate behavior should matchquantum.Updated tests include:
tests/test_radiation.pyradiation_flag=3checks beside the existing stochastic radiation checkquantumquantum-kickno-photon-record checkquantum-kickto the ring stochastic tracking comparisontests/test_splineboris.pyquantum-kickto the SplineBoris bend-radiation checkquantumquantum-kickno-photon-record checktests/test_elements_thick.pyquantum-kickto the solenoid radiation equivalence teststests/test_radiation_equilibrium_emittances.pyquantum-kicktracking comparison inside the existingcheck_against_trackingbranch onlytests/test_radiation_equilibrium_emittances_thick.pyquantum-kickonly inside the tracking-comparison branchThe emittance tracking checks now use 50 particles instead of 30. The previous sample size was too low for a stable stochastic RMS comparison when testing both stochastic radiation modes.
Validation
The targeted updated tests pass locally:
Photon logging is intentionally not supported by
quantum-kick, because the model samples the total stochastic energy kick rather than individual photons. Tests explicitly check this distinction.