Celeritas 0.7+be44d7947
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
celeritas::StepperInterface Class Referenceabstract

Interface class for stepper classes. More...

#include <Stepper.hh>

Inheritance diagram for celeritas::StepperInterface:
Inheritance graph
[legend]

Public Types

Type aliases
using Input = StepperInput
 
using SpanConstPrimary = Span< Primary const >
 
using result_type = StepperResult
 
using SPState = std::shared_ptr< CoreStateInterface >
 

Public Member Functions

virtual void warm_up ()=0
 
virtual void async ()=0
 
virtual void async (SpanConstPrimary primaries)=0
 
virtual bool valid () const noexcept=0
 Whether an asynchronous step result can be retrieved.
 
virtual bool ready () const =0
 
virtual void wait () const =0
 
virtual StepperResult get ()=0
 
virtual size_type primary_capacity () const noexcept=0
 Fixed capacity of each stepper-owned primary buffer.
 
virtual size_type initializer_capacity () const noexcept=0
 Fixed capacity of the track initializer queue.
 
virtual size_type secondary_capacity () const noexcept=0
 Fixed capacity of the per-step secondary stack.
 
virtual size_type num_buffered_primaries () const noexcept=0
 Number of primaries accumulated in the producer buffer.
 
virtual void push_primary (Primary const &primary)=0
 
virtual void stage_primaries ()=0
 
virtual SpanConstPrimary staged_primaries () const noexcept=0
 Access the unsubmitted primary batch staged for the next step.
 
virtual StepperResult operator() ()=0
 
virtual void stage_primaries (SpanConstPrimary primaries)=0
 
virtual StepperResult operator() (SpanConstPrimary primaries)=0
 
virtual void kill_active ()=0
 
virtual void reseed (UniqueEventId event_id)=0
 
virtual ActionSequence constactions () const =0
 Get action sequence for timing diagnostics.
 
virtual CoreStateInterface conststate () const =0
 Get the core state interface.
 
virtual SPState sp_state ()=0
 Get a shared pointer to the state (TEMPORARY)
 

Protected Member Functions

 StepperInterface (StepperInterface const &)=default
 
StepperInterfaceoperator= (StepperInterface const &)=default
 
 StepperInterface (StepperInterface &&)=default
 
StepperInterfaceoperator= (StepperInterface &&)=default
 

Detailed Description

Interface class for stepper classes.

This allows higher-level classes not to care whether the stepper operates on host or device.

A stepper initially has no asynchronous result, so valid returns false. Calling async, with or without primaries, starts one step and makes the result valid. No other step can be started until get returns the result and restores the initial state. The ready function queries completion without blocking, wait blocks without consuming the result, and get waits if necessary before consuming it. All three require a valid result. A valid result can be ready: valid describes whether the result can be retrieved, rather than whether device execution is still underway.

Primary input is accumulated in a fixed-capacity producer buffer owned by the stepper. Calling stage_primaries transfers that batch into the core state and makes it available to the next call to async. The producer can then accept another batch, including while a previous step result is valid. At most one unsubmitted batch can be staged. The span overload copies its input into stepper-owned storage, so the caller's span need not remain valid after the call returns. The span returned by staged_primaries represents only the current unsubmitted batch and should not be retained after a call that changes the staging state.

Calling async submits staged primaries, if present, and otherwise advances existing tracks without changing the producer buffer. This allows prior transport to be drained while a later primary batch remains buffered. Primaries can be pushed and staged while a previous result is valid, but the next step cannot start until get consumes that result. Thus result completion and primary production have independent lifecycles.

Host steps execute synchronously and are immediately ready. The deprecated call operators preserve synchronous behavior by calling async followed by get.

Before destroying a device Stepper, the caller must ensure that any valid asynchronous operation has completed by calling wait or get, and that any staged primary batch has been submitted with async. Destruction does not add hidden synchronization.

Note
This interface and its implementations may be removed soon to facilitate step gathering.

Member Function Documentation

◆ actions()

virtual ActionSequence const & celeritas::StepperInterface::actions ( ) const
pure virtual

Get action sequence for timing diagnostics.

Implemented in celeritas::Stepper< M >.

◆ async() [1/2]

virtual void celeritas::StepperInterface::async ( )
pure virtual

Implemented in celeritas::Stepper< M >.

◆ async() [2/2]

virtual void celeritas::StepperInterface::async ( SpanConstPrimary  primaries)
pure virtual

Implemented in celeritas::Stepper< M >.

◆ get()

virtual StepperResult celeritas::StepperInterface::get ( )
pure virtual

Implemented in celeritas::Stepper< M >.

◆ initializer_capacity()

virtual size_type celeritas::StepperInterface::initializer_capacity ( ) const
pure virtualnoexcept

Fixed capacity of the track initializer queue.

Implemented in celeritas::Stepper< M >.

◆ kill_active()

virtual void celeritas::StepperInterface::kill_active ( )
pure virtual

Implemented in celeritas::Stepper< M >.

◆ num_buffered_primaries()

virtual size_type celeritas::StepperInterface::num_buffered_primaries ( ) const
pure virtualnoexcept

Number of primaries accumulated in the producer buffer.

Implemented in celeritas::Stepper< M >.

◆ operator()() [1/2]

virtual StepperResult celeritas::StepperInterface::operator() ( )
pure virtual
Deprecated:
Transport existing states

Implemented in celeritas::Stepper< M >.

◆ operator()() [2/2]

virtual StepperResult celeritas::StepperInterface::operator() ( SpanConstPrimary  primaries)
pure virtual
Deprecated:
Transport existing states and these new primaries

Implemented in celeritas::Stepper< M >.

◆ primary_capacity()

virtual size_type celeritas::StepperInterface::primary_capacity ( ) const
pure virtualnoexcept

Fixed capacity of each stepper-owned primary buffer.

Implemented in celeritas::Stepper< M >.

◆ push_primary()

virtual void celeritas::StepperInterface::push_primary ( Primary const primary)
pure virtual

Implemented in celeritas::Stepper< M >.

◆ ready()

virtual bool celeritas::StepperInterface::ready ( ) const
pure virtual

Implemented in celeritas::Stepper< M >.

◆ reseed()

virtual void celeritas::StepperInterface::reseed ( UniqueEventId  event_id)
pure virtual

Implemented in celeritas::Stepper< M >.

◆ secondary_capacity()

virtual size_type celeritas::StepperInterface::secondary_capacity ( ) const
pure virtualnoexcept

Fixed capacity of the per-step secondary stack.

Implemented in celeritas::Stepper< M >.

◆ sp_state()

virtual SPState celeritas::StepperInterface::sp_state ( )
pure virtual

Get a shared pointer to the state (TEMPORARY)

Implemented in celeritas::Stepper< M >.

◆ stage_primaries() [1/2]

virtual void celeritas::StepperInterface::stage_primaries ( )
pure virtual

Implemented in celeritas::Stepper< M >.

◆ stage_primaries() [2/2]

virtual void celeritas::StepperInterface::stage_primaries ( SpanConstPrimary  primaries)
pure virtual

Implemented in celeritas::Stepper< M >.

◆ staged_primaries()

virtual SpanConstPrimary celeritas::StepperInterface::staged_primaries ( ) const
pure virtualnoexcept

Access the unsubmitted primary batch staged for the next step.

Implemented in celeritas::Stepper< M >.

◆ state()

virtual CoreStateInterface const & celeritas::StepperInterface::state ( ) const
pure virtual

Get the core state interface.

Implemented in celeritas::Stepper< M >.

◆ valid()

virtual bool celeritas::StepperInterface::valid ( ) const
pure virtualnoexcept

Whether an asynchronous step result can be retrieved.

Implemented in celeritas::Stepper< M >.

◆ wait()

virtual void celeritas::StepperInterface::wait ( ) const
pure virtual

Implemented in celeritas::Stepper< M >.

◆ warm_up()

virtual void celeritas::StepperInterface::warm_up ( )
pure virtual

Implemented in celeritas::Stepper< M >.


The documentation for this class was generated from the following files: