|
Celeritas 0.7.0-22+develop.9704a67c5
|
#include "DetectorSteps.hh"#include <thrust/iterator/counting_iterator.h>#include "corecel/Macros.hh"#include "corecel/Types.hh"#include "corecel/data/AsyncSnapshot.hh"#include "corecel/data/Collection.hh"#include "corecel/data/Copier.hh"#include "corecel/data/DeviceAlgorithms.device.hh"#include "corecel/data/ObserverPtr.hh"#include "corecel/sys/KernelLauncher.device.hh"#include "corecel/sys/KernelParamCalculator.device.hh"#include "corecel/sys/ScopedProfiling.hh"#include "corecel/sys/Stream.hh"#include "StepData.hh"#include "detail/StepScratchCopyExecutor.hh"Macros | |
| #define | DS_ASSIGN(FIELD) copy_field(&(output->FIELD), state.scratch.FIELD, num_valid, stream) |
| #define | DS_RESERVE(FIELD) reserve_field(&(output->FIELD), state.scratch.FIELD) |
Functions | |
| void | celeritas::compact_steps_async (StepStateDeviceRef const &state, AsyncSnapshot< size_type > &num_selected) |
| Compact selected device step data without synchronizing the stream. | |
| void | celeritas::copy_compacted_steps_async (DetectorStepOutput *output, StepStateDeviceRef const &state, size_type num_valid, Stream const &stream) |
| Enqueue a copy of compacted device step data to the host. | |
| void | celeritas::reserve_compacted_steps (DetectorStepOutput *output, StepStateDeviceRef const &state) |
| Reserve output capacity for the largest possible compacted step. | |
| void celeritas::compact_steps_async | ( | StepStateDeviceRef const & | state, |
| AsyncSnapshot< size_type > & | num_selected | ||
| ) |
Compact selected device step data without synchronizing the stream.
Tracks are selected if they interacted with a detector or, if no detectors are used, if their track ID was set during gathering. This enqueues on the state's stream:
num_selected .The snapshot must not be destroyed until its load completes, which also implies that the compaction has completed. The scratch space must not be overwritten until the copy enqueued by copy_compacted_steps_async completes.
StepInterface callbacks of a StepCollector, but nothing tracks its outstanding copies: each caller can only order its compaction after its own copies. Only one callback per collector may therefore compact step data with this function if any caller defers its copy (currently only GeantSd , through detail::HitProcessor ). | void celeritas::copy_compacted_steps_async | ( | DetectorStepOutput * | output, |
| StepStateDeviceRef const & | state, | ||
| size_type | num_valid, | ||
| Stream const & | stream | ||
| ) |
Enqueue a copy of compacted device step data to the host.
The number of selected tracks must have been loaded to the host already, i.e., the snapshot passed to compact_steps_async must be ready. Since that load follows the compaction, the copies may be enqueued on any stream. The output is resized immediately, and copies from the state's scratch space are enqueued on the given stream without synchronizing.
The output must not be read or resized, and the scratch space must not be overwritten, until the stream reaches this point.
| void celeritas::reserve_compacted_steps | ( | DetectorStepOutput * | output, |
| StepStateDeviceRef const & | state | ||
| ) |
Reserve output capacity for the largest possible compacted step.
Each field in use is reserved to the size of its scratch space, which bounds the number of items copy_compacted_steps_async can copy, so later copies into the output never reallocate it. Reallocating pinned memory calls cudaHostAlloc and cudaFreeHost, which serialize CUDA API calls from all host threads.
The output must not be the destination of a copy in flight.