celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/user/index.html
Other
62 stars 33 forks source link

Add actions and executors for generating optical distribution data #1184

Closed amandalund closed 5 months ago

amandalund commented 5 months ago

This adds a gather action to cache the pre-step data needed for the scintillation and Cerenkov pre-generators and a post-step pre-generator action to create the optical distribution data. The distributions are stored in two large buffers indexed by the current size plus the track slot ID which is compacted at the end of each step by removing all the invalid distributions (this will ensure reproducibility). These actions will be created by the optical collector in #1173.

amandalund commented 5 months ago

Thanks @whokion: yes, we could separate the Cerenkov and scintillation actions, but this should also work as is either if both of the processes are enabled or if only one or the other is. I've added a test in #1173 (which I'll open once this is merged) which runs the stepping loop with these actions and checks the buffered data. For reproducibility the order of the distribution data in the buffers should always be the same, which is done by making sure the distributions created at each step are ordered by thread ID (originally I had used a stack allocator to buffer the data, but this would have required some additional post-processing to sort the distributions since the atomic add leads to a non-deterministic order: see https://github.com/celeritas-project/celeritas/pull/1173#discussion_r1552483425).