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
58 stars 32 forks source link

Add auxiliary extensible params and state #1278

Closed sethrj closed 2 weeks ago

sethrj commented 2 weeks ago

For #886 it would be good to start storing state data alongside the core state rather than using the hacky stream store to make the params class mutable.

A follow-up PR refactors the optical data using this new change set.

Closes #392 .


Non-critical follow-on work: how to combine and output params data with the results of multiple states. Currently the states are unique pointers owned by the core state and created when we build the stepper, and outputs are usually shared pointers that are registered when the params are created. Maybe we should punt on the output for now (so we can get this into the optical state) and consider having a separate "multithread output" class, or using actions to integrate over the streams at the end of a run, or something...

The action diagnostic execution kernel looks like this:

void ActionDiagnostic::execute(CoreParams const& params,
                               CoreStateHost& state) const
{
    auto execute = make_active_track_executor(
        params.ptr<MemSpace::native>(),
        state.ptr(),
        detail::ActionDiagnosticExecutor{
            this->ref<MemSpace::native>(),
            state.user_state_data<ParticleTallyStateData>(user_id_)});
    return launch_action(*this, params, state, execute);
}