Skip to content

Algorithm

#include <xalgospp/algorithm.hh>
template<class Derived, typename Tag = ncarray::HostTag>
class Algorithm

Defined in src/lib/xalgospp/algorithm.hh:90

Subclassed by: Calibration< Policy, MemTag >, Peakfinder8< MemTag >

Base Algorithm class.

All algorithms in XAlgosPP derive from this basic class. An Algorithm is simply a wrapper which consists of the following states/life-cycle stages:

  1. Construction/configuration - The algorithm is setup with input parameters.

  2. Staging [OPTIONAL] - The algorithm may optionally have a staging step when appropriate. This allows for performing auxiliary actions like determining extra metadata that may be useful for processing.

  3. Processing - Various APIs/interfaces are provided to run the actual algorithm.

Furthermore, each algorithm will define, via type aliases, the inputs and outputs that it can accept, along with the type of Parameters object it requires.

  • Derived CRTP subclass type.

  • Tag An indicator of whether the algorithm is to operate on host or device memory.

Name Kind Owner
Algorithm function Declared here
configure function Declared here
stage function Declared here
get_staged_data function Declared here
set_staged_data function Declared here
staged_data_size function Declared here
process function Declared here
process function Declared here
operator() function Declared here
operator() function Declared here
process_many function Declared here
process_many function Declared here
name function Declared here
print_configuration function Declared here
print_configuration function Declared here
params function Declared here
TypeConstraint variable Declared here
Input typedef Declared here
Output typedef Declared here
Return Name Description
Algorithm Defaulted constructor.
void configure inline Perform configuration of the algorithm given an input set of parameters.
void stage inline Optional stage to perform associated actions before processing.
const auto get_staged_data const inline For Algorithms which provide staging of associated data, retrieve what was staged.
void set_staged_data inline For Algorithms which provide staging of associated data, alternatively set it.
hd_std::size_t staged_data_size const inline For Algorithms which provide staging, retrieve the size (in bytes) of the staged data.
void process const inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())
void process inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())
void operator() inline
void operator() const inline
void process_many const inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())
void process_many inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())
const char * name const inline
void print_configuration const inline Print the name and current values of the Algorithm’s Parameters.
void print_configuration inline Print the name and current values of the Algorithm’s Parameters.
const auto & params const inline Retrieve the current Parameters for the Algorithm.

Algorithm() = default

Defined in src/lib/xalgospp/algorithm.hh:92

Defaulted constructor.


inline

template<typename Params> inline void configure(const Params & params)

Defined in src/lib/xalgospp/algorithm.hh:125

Perform configuration of the algorithm given an input set of parameters.

Parameter Type Description
params const Params & The Algorithm-specific Parameters to use.

inline

inline void stage()

Defined in src/lib/xalgospp/algorithm.hh:137

Optional stage to perform associated actions before processing.

An algorithm implementation may optionally provide a staging routine when associated steps, e.g. for metadata retreival, would be useful.


const inline

inline const auto get_staged_data() const

Defined in src/lib/xalgospp/algorithm.hh:153

For Algorithms which provide staging of associated data, retrieve what was staged.

In some execution contexts, it may be desirable to control which of many parallel processing units performs staging. This function and the related setter allow for retrieving and setting staged data, allowing precise control of how and when different parallel units perform these actions.

Any staged data for the Algorithm. If applicable.


inline

template<typename... StagedData> inline void set_staged_data(StagedData &&... staged_data)

Defined in src/lib/xalgospp/algorithm.hh:172

For Algorithms which provide staging of associated data, alternatively set it.

In some execution contexts, it may be desirable to control which of many parallel processing units performs staging. This function and the related getter allow for retrieving and setting staged data, allowing precise control of how and when different parallel units perform these actions.

Parameter Type Description
staged_data StagedData &&... The data that was staged somehow and should be used by the Algorithm. This is Algorithm-specific.

const inline

inline hd_std::size_t staged_data_size() const

Defined in src/lib/xalgospp/algorithm.hh:185

For Algorithms which provide staging, retrieve the size (in bytes) of the staged data.

The size in bytes of any (and all) staged data. If no data is staged, then 0.


const inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

template<typename InputArg, typename OutputArg> inline void process(InputArg && input, OutputArg && output) const requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

Defined in src/lib/xalgospp/algorithm.hh:205


inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

template<typename InputArg, typename OutputArg> inline void process(InputArg && input, OutputArg && output) requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

Defined in src/lib/xalgospp/algorithm.hh:227


inline

template<typename InputArg, typename OutputArg> inline void operator()(InputArg && input, OutputArg && output)

Defined in src/lib/xalgospp/algorithm.hh:246


const inline

template<typename InputArg, typename OutputArg> inline void operator()(InputArg && input, OutputArg && output) const

Defined in src/lib/xalgospp/algorithm.hh:251


const inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

template<typename InputArg, typename OutputArg> inline void process_many(hd_std::size_t count, InputArg && input, OutputArg && output) const requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

Defined in src/lib/xalgospp/algorithm.hh:268


inline requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

template<typename InputArg, typename OutputArg> inline void process_many(hd_std::size_t count, InputArg && input, OutputArg && output) requires ([]() { if constexpr (requires { Derived::TypeConstraint == AlgTypeConstraint::StrictOrdering; }) { return Derived::Input::template accepts_when_paired< InputArg, OutputArg, typename Derived::Output >; } else { return Derived::Input::template accepts<InputArg> && Derived::Output::template accepts<OutputArg>; } }())

Defined in src/lib/xalgospp/algorithm.hh:291


const inline

inline const char * name() const

Defined in src/lib/xalgospp/algorithm.hh:312


const inline

inline void print_configuration() const

Defined in src/lib/xalgospp/algorithm.hh:323

Print the name and current values of the Algorithm’s Parameters.


inline

inline void print_configuration()

Defined in src/lib/xalgospp/algorithm.hh:336

Print the name and current values of the Algorithm’s Parameters.


const inline

inline const auto & params() const

Defined in src/lib/xalgospp/algorithm.hh:349

Retrieve the current Parameters for the Algorithm.

A const reference to the Parameters.

Return Name Description
constexpr AlgTypeConstraint TypeConstraint static constexpr

static constexpr

constexpr AlgTypeConstraint TypeConstraint { }

Defined in src/lib/xalgospp/algorithm.hh:116

Name Description
Input The list of supported input types.
Output The list of supported output types.

using Input = type_list<>

Defined in src/lib/xalgospp/algorithm.hh:97

The list of supported input types.


using Output = type_list<>

Defined in src/lib/xalgospp/algorithm.hh:114

The list of supported output types.

Algorithm’s process data by receiving an output to write the result to. These types are those supported for that purpose.

Algorithms provide a type_list of supported inputs and outputs. These are used both to provide easy access to supported types, but also to constrain the inputs on the Algorithm’s processing routine. By default, the constraint is to allow the cartesian product of the Input and Output type_lists. An Algorithm subclass may opt instead to enforce stronger constraints, e.g., it may require strict ordering such that the first item in the Input list must be paired with the first item in the output list. Refer to each Algorithm to verify if extra constraints are in effect.