Celeritas
0.5.0-56+6b053cd
|
Create track initializers on device from secondary particles. More...
#include <ExtendFromSecondariesAction.hh>
Public Member Functions | |
ExtendFromSecondariesAction (ActionId id) | |
Construct with explicit Id. | |
Action interface | |
ID of the action | |
ActionId | action_id () const final |
Short name for the action. | |
std::string_view | label () const final |
Short name for the action. | |
std::string_view | description () const final |
Get a long description of the action. | |
StepActionOrder | order () const final |
Dependency ordering of the action. | |
ExplicitAction interface | |
void | step (CoreParams const &, CoreStateHost &) const final |
Execute the action with host data. | |
void | step (CoreParams const &, CoreStateDevice &) const final |
Execute the action with device data. | |
BeginRunAction interface | |
void | begin_run (CoreParams const &, CoreStateHost &) final |
Warm up asynchronous allocation. More... | |
void | begin_run (CoreParams const &, CoreStateDevice &) final |
Warm up asynchronous allocation. More... | |
Public Member Functions inherited from celeritas::StepActionInterface< P, S > | |
virtual void | step (P const &, S< MemSpace::host > &) const =0 |
Execute the action with host data. | |
virtual void | step (P const &, S< MemSpace::device > &) const =0 |
Execute the action with device data. | |
Public Member Functions inherited from celeritas::ActionInterface | |
virtual | ~ActionInterface () noexcept=0 |
Default destructor. | |
Public Member Functions inherited from celeritas::BeginRunActionInterface< P, S > | |
virtual void | begin_run (P const &, S< MemSpace::host > &)=0 |
Set host data at the beginning of a run. | |
virtual void | begin_run (P const &, S< MemSpace::device > &)=0 |
Set device data at the beginning of a run. | |
Additional Inherited Members | |
Public Types inherited from celeritas::ActionTypeTraits< P, S > | |
using | CoreParams = P |
using | CoreStateHost = S< MemSpace::host > |
using | CoreStateDevice = S< MemSpace::device > |
using | SpanCoreStateHost = Span< S< MemSpace::host > *const > |
using | SpanCoreStateDevice = Span< S< MemSpace::device > *const > |
Protected Member Functions inherited from celeritas::ActionInterface | |
ActionInterface ()=default | |
CELER_DEFAULT_COPY_MOVE (ActionInterface) | |
Create track initializers on device from secondary particles.
Secondaries produced by each track are ordered arbitrarily in memory, and the memory may be fragmented if not all secondaries survived cutoffs. For example, after the interactions have been processed and cutoffs applied, the track states and their secondaries might look like the following (where 'X' indicates a track or secondary that did not survive):
thread ID | 0 1 2 3 4 5 6 7 8 9 track ID | 10 X 8 7 X 5 4 X 2 1 secondaries | [X] [X, 11, 12] [13, X] [X] [14, X, 15] [X, 16] [X]
Because the order in which threads receive a chunk of memory from the secondary allocator is nondeterministic, the actual ordering of the secondaries in memory is unpredictable; for instance:
secondary storage | [X, 13, X, X, 11, 12, X, X, 16, 14, X, 15, X]
When track initializers are created from secondaries, they are ordered by thread ID to ensure reproducibility. If a track that produced secondaries has died (e.g., thread ID 7 in the example above), one of its secondaries is immediately used to fill that track slot:
thread ID | 0 1 2 3 4 5 6 7 8 9 track ID | 10 X 8 7 X 5 4 16 2 1 secondaries | [X] [X, 11, 12] [13, X] [X] [14, X, 15] [X, X] [X]
This way, the geometry state is reused rather than initialized from the position (which is expensive). This also prevents the geometry state from being overwritten by another track's secondary, so if the track produced multiple secondaries, the rest are still able to copy the parent's state.
Track initializers are created from the remaining secondaries and are added to the back of the vector. The thread ID of each secondary's parent is also stored, so any new tracks initialized from secondaries produced in this step can copy the geometry state from the parent. The indices of the empty slots in the track vector are identified and stored as a sorted vector of vacancies.
track initializers | 11 12 13 14 15 parent | 2 2 3 6 6 vacancies | 1 4
|
final |
Warm up asynchronous allocation.
This just calls MallocAsync before the first step, since it's used by detail::remove_if_alive
under the hood.
|
inlinefinal |
Warm up asynchronous allocation.
This just calls MallocAsync before the first step, since it's used by detail::remove_if_alive
under the hood.