-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor primary construction into aux data + generator #1390
Comments
Thanks for this @sethrj! Sorry it's taking me a minute to fully grasp it; just a few clarifying questions:
Does that mean a "generator" action would create new initializers, on device, directly in the initializer buffer (i.e. skip the step of creating primaries) when they can be generated from a distribution? And "extend from primaries" would still be used e.g. when reading from a HepMC3 event record?
Not sure exactly what you mean by this.
Or would the generator create and store primaries? Then we'd still need to convert them into initializers (except in the optical loop where primaries are initializers)?
Would this refactor change how we're doing the initialization (and in a way that would make this possible)? |
Exactly. HepMC3, Geant4 offloading, and other methods for explicitly creating primaries will use the refactored
Instead of the track initializers (which are different between the core and optical stepping loops) being part of the
Nope I think initializers. The Primary class would just be a higher-level abstraction for building track initializers. Its definition could, for example, be moved into the
Well, maybe not all the way. But I think at least a step in that direction is to movie the |
Thanks, that makes a lot of sense. I guess one potential snag with the track ID stuff is the in-place initialization we do in the |
True that... perhaps if we add logical volume and surface IDs to the track initializers we can skip the in-place stuff. |
In the optical transport loop, we want to be able to use Cerenkov/Scintillation "generators" (which have signature
(RNG&) -> Primary
) to produce optical photons on device. Like buffered track initializers, we'd like to be able to fill up track slots, pause partway (if there aren't enough track slots), and then fill any empty slots on the next loop. We'll also want to do this to support sampling for optical maps: a generator could be initialized with a volume ID and a region of space and only accept samples within that region.We should consider doing something similar for core tracks, since there is a memory usage/bandwidth advantage to initializing tracks on device rather than on host. (We'd also be able to use a consistent RNG.)
I propose we add a new StepActionOrder "generate" before the "initialize" that fills empty track slots:
phys/PrimaryGenerator.hh
or define new generalized distributionsPerhaps we could also use this refactor to think of a way to make track IDs
deterministic (currently, tracks from secondaries get their event ID-associated
track count using an
atomic_add
). This would involve removing the track IDfrom the track initializer and instead constructing new track IDs in the
initialization stage.
The new
PrimaryGeneratorAction
class that replacesExtendFromPrimariesAction
would still be a
CoreStepActionInterface
(definingstep(params, state)
) but also be aAuxParamsInterface
(for storing the primaries), and perhaps a newGeneratorInterface
for providing information about how many potential new tracks are buffered and waiting.Considerations:
primaries->insert(...)
.cc @drbenmorgan @amandalund
The text was updated successfully, but these errors were encountered: