Celeritas
0.5.0-86+4a8eea4
|
Shared (one instance for all threads) Celeritas problem data. More...
#include <SharedParams.hh>
Public Types | |
Type aliases | |
using | SPConstParams = std::shared_ptr< CoreParams const > |
using | VecG4ParticleDef = std::vector< G4ParticleDefinition const * > |
Public Member Functions | |
Accessors | |
SPConstParams | Params () const |
Access Celeritas data. More... | |
VecG4ParticleDef const & | OffloadParticles () const |
Get a vector of particles supported by Celeritas offloading. | |
operator bool () const | |
Whether Celeritas core params have been created. | |
Internal use only | |
using | SPHitManager = std::shared_ptr< detail::HitManager > |
Hit manager, to be used only by LocalTransporter. More... | |
using | SPOffloadWriter = std::shared_ptr< detail::OffloadWriter > |
Hit manager, to be used only by LocalTransporter. More... | |
using | SPOutputRegistry = std::shared_ptr< OutputRegistry > |
Hit manager, to be used only by LocalTransporter. More... | |
using | SPState = std::shared_ptr< CoreStateInterface > |
Hit manager, to be used only by LocalTransporter. More... | |
using | SPConstGeantGeoParams = std::shared_ptr< GeantGeoParams const > |
Hit manager, to be used only by LocalTransporter. More... | |
SPHitManager const & | hit_manager () const |
Hit manager, to be used only by LocalTransporter. More... | |
SPOffloadWriter const & | offload_writer () const |
Optional offload writer, only for use by LocalTransporter. | |
SPOutputRegistry const & | output_reg () const |
Output registry for writing data at end of run. | |
void | set_state (unsigned int stream_id, SPState &&) |
Let LocalTransporter register the thread's state. | |
unsigned int | num_streams () const |
Lazily obtained number of streams. | |
SPConstGeantGeoParams const & | geant_geo_params () const |
Lazily created Geant geometry parameters. | |
Construction | |
static bool | CeleritasDisabled () |
On worker threads, set up data with thread storage duration. More... | |
static bool | KillOffloadTracks () |
On worker threads, set up data with thread storage duration. More... | |
static void | InitializeWorker (SetupOptions const &options) |
On worker threads, set up data with thread storage duration. More... | |
SharedParams ()=default | |
On worker threads, set up data with thread storage duration. More... | |
SharedParams (SetupOptions const &options) | |
Set up Celeritas using Geant4 data. More... | |
SharedParams (std::string output_filename) | |
Set up Celeritas components for a Geant4-only run. More... | |
void | Initialize (SetupOptions const &options) |
Helper for making initialization more obvious from user code. | |
void | Initialize (std::string output_filename) |
Helper for making initialization more obvious from user code. | |
void | Finalize () |
Clear shared data after writing out diagnostics. More... | |
Shared (one instance for all threads) Celeritas problem data.
The CeleritasDisabled
accessor queries the CELER_DISABLE
environment variable as a global option for disabling Celeritas offloading. This is implemented by SimpleOffload
This should be instantiated on the master thread during problem setup, preferably as a shared pointer. The shared pointer should be passed to a thread-local LocalTransporter
instance. At the beginning of the run, after Geant4 has initialized physics data, the Initialize
method must be called first on the "master" thread to populate the Celeritas data structures (geometry, physics). InitializeWorker
must subsequently be invoked on all worker threads to set up thread-local data (specifically, CUDA device initialization).
Some low-level objects, such as the output diagnostics and Geant4 geometry wrapper, can be created independently of Celeritas being enabled.
using celeritas::SharedParams::SPConstGeantGeoParams = std::shared_ptr<GeantGeoParams const> |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
using celeritas::SharedParams::SPHitManager = std::shared_ptr<detail::HitManager> |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
using celeritas::SharedParams::SPOffloadWriter = std::shared_ptr<detail::OffloadWriter> |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
using celeritas::SharedParams::SPOutputRegistry = std::shared_ptr<OutputRegistry> |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
using celeritas::SharedParams::SPState = std::shared_ptr<CoreStateInterface> |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
|
default |
On worker threads, set up data with thread storage duration.
Some data that has "static" storage duration (such as CUDA device properties) in single-thread mode has "thread" storage in a multithreaded application. It must be initialized on all threads.
|
explicit |
Set up Celeritas using Geant4 data.
This is a separate step from construction because it has to happen at the beginning of the run, not when user classes are created. It should be called from the "master" thread (for MT mode) or from the main thread (for Serial), and it must complete before any worker thread tries to access the shared data.
|
explicit |
Set up Celeritas components for a Geant4-only run.
This is for doing standalone Geant4 calculations without offloading from Celeritas, but still using components such as the simple calorimeter.
|
static |
On worker threads, set up data with thread storage duration.
Some data that has "static" storage duration (such as CUDA device properties) in single-thread mode has "thread" storage in a multithreaded application. It must be initialized on all threads.
void celeritas::SharedParams::Finalize | ( | ) |
Clear shared data after writing out diagnostics.
This should be executed exactly once across all threads and at the end of the run.
|
inline |
Hit manager, to be used only by LocalTransporter.
If sensitive detector callback is disabled, the hit manager will be null.
|
static |
On worker threads, set up data with thread storage duration.
Some data that has "static" storage duration (such as CUDA device properties) in single-thread mode has "thread" storage in a multithreaded application. It must be initialized on all threads.
|
static |
On worker threads, set up data with thread storage duration.
Some data that has "static" storage duration (such as CUDA device properties) in single-thread mode has "thread" storage in a multithreaded application. It must be initialized on all threads.
|
inline |
Access Celeritas data.
This can only be called after Initialize
.