SpECTRE  2021.08.02
Parallel Namespace Reference

Functionality for parallelization. More...

Namespaces

namespace  InboxInserters
 Structs that have insert_into_inbox methods for commonly used cases.
 

Classes

class  AlgorithmImpl< ParallelComponent, tmpl::list< PhaseDepActionListsPack... > >
 A distributed object (Charm++ Chare) that executes a series of Actions and is capable of sending and receiving data. Acts as an interface to Charm++. More...
 
struct  ArrayIndex
 The array index used for indexing Chare Arrays, mostly an implementation detail. More...
 
class  Callback
 An abstract base class, whose derived class holds a function that can be invoked at a later time. The function is intended to be invoked only once. More...
 
struct  get_action_list_from_phase_dep_action_list
 (Lazy) metafunction to get the action list from a PhaseActions More...
 
struct  get_mutable_cache_tag
 
struct  get_phase_from_phase_dep_action_list
 (Lazy) metafunction to get the phase as a std::integral_constant from a PhaseActions More...
 
struct  get_phase_type_from_phase_dep_action_list
 (Lazy) metafunction to get the phase type from a PhaseActions More...
 
class  GlobalCache
 A Charm++ chare that caches constant data once per Charm++ node or non-constant data once per Charm++ core. More...
 
struct  has_pup_member
 Check if T has a pup member function. More...
 
struct  is_array_proxy
 Check if T is a Charm++ proxy for an array chare. More...
 
struct  is_bound_array
 Check if T is a ParallelComponent for a Charm++ bound array. More...
 
struct  is_bound_array< T, std::void_t< typename T::bind_to > >
 
struct  is_chare_proxy
 Check if T is a Charm++ proxy for a chare. More...
 
struct  is_group_proxy
 Check if T is a Charm++ proxy for a group chare. More...
 
struct  is_node_group_proxy
 Check if T is a Charm++ proxy for a node group chare. More...
 
struct  is_pupable
 Check if type T has operator| defined for Charm++ serialization. More...
 
class  Main
 The main function of a Charm++ executable. See the Parallelization documentation for an overview of Metavariables, Phases, and parallel components. More...
 
struct  MutableCacheTag
 
class  MutableGlobalCache
 A Charm++ chare that caches mutable data once per Charm++ core. More...
 
class  NodeLock
 A typesafe wrapper for a lock for synchronization of shared resources on a given node, with safe creation, destruction, and serialization. More...
 
struct  NoSection
 Can be used instead of a Parallel::Section when no section is desired. More...
 
class  PerformAlgorithmCallback
 Wraps a call to perform_algorithm. More...
 
struct  PhaseActions
 List of all the actions to be executed in the specified phase. More...
 
struct  ReductionData< ReductionDatum< Ts, InvokeCombines, InvokeFinals, InvokeFinalExtraArgsIndices >... >
 Used for reducing a possibly heterogeneous collection of types in a single reduction call. More...
 
struct  ReductionDatum
 The data to be reduced, and invokables to be called whenever two reduction messages are combined and after the reduction has been completed. More...
 
struct  Section
 A subset of chares in a parallel component. More...
 
class  SimpleActionCallback
 Wraps a call to a simple action and its arguments. Can be invoked only once. More...
 
class  SimpleActionCallback< SimpleAction, Proxy >
 Wraps a call to a simple action without arguments. More...
 

Typedefs

using ArrayIndex1D = ArrayIndex< CkIndex1D >
 
using ArrayIndex2D = ArrayIndex< CkIndex2D >
 
using ArrayIndex3D = ArrayIndex< CkIndex3D >
 
using ArrayIndex4D = ArrayIndex< CkIndex4D >
 
using ArrayIndex5D = ArrayIndex< CkIndex5D >
 
using ArrayIndex6D = ArrayIndex< CkIndex6D >
 
template<class ActionsList >
using get_inbox_tags = tmpl::remove_duplicates< tmpl::join< tmpl::transform< ActionsList, detail::get_inbox_tags_from_action< tmpl::_1 > > > >
 Given a list of Actions, get a list of the unique inbox tags.
 
template<class ActionsList >
using get_const_global_cache_tags_from_actions = tmpl::remove_duplicates< tmpl::join< tmpl::transform< ActionsList, detail::get_const_global_cache_tags_from_parallel_struct< tmpl::_1 > > > >
 Given a list of Actions, get a list of the unique tags specified in the actions' const_global_cache_tags aliases.
 
template<class ActionsList >
using get_mutable_global_cache_tags_from_actions = tmpl::remove_duplicates< tmpl::join< tmpl::transform< ActionsList, detail::get_mutable_global_cache_tags_from_parallel_struct< tmpl::_1 > > > >
 Given a list of Actions, get a list of the unique tags specified in the actions' mutable_global_cache_tags aliases.
 
template<typename Metavariables >
using get_const_global_cache_tags = tmpl::remove_duplicates< tmpl::flatten< tmpl::list< typename detail::get_const_global_cache_tags_from_parallel_struct< Metavariables >::type, tmpl::transform< typename Metavariables::component_list, detail::get_const_global_cache_tags_from_parallel_struct< tmpl::_1 > >, tmpl::transform< typename Metavariables::component_list, detail::get_const_global_cache_tags_from_pdal< tmpl::_1 > > > > >
 Given the metavariables, get a list of the unique tags that will specify the items in the GlobalCache.
 
template<typename Metavariables >
using get_mutable_global_cache_tags = tmpl::remove_duplicates< tmpl::flatten< tmpl::list< typename detail::get_mutable_global_cache_tags_from_parallel_struct< Metavariables >::type, tmpl::transform< typename Metavariables::component_list, detail::get_mutable_global_cache_tags_from_parallel_struct< tmpl::_1 > >, tmpl::transform< typename Metavariables::component_list, detail::get_mutable_global_cache_tags_from_pdal< tmpl::_1 > > > > >
 Given the metavariables, get a list of the unique tags that will specify the mutable items in the GlobalCache.
 
template<typename Metavariables >
using get_mutable_global_cache_tag_storage = tmpl::transform< get_mutable_global_cache_tags< Metavariables >, get_mutable_cache_tag< tmpl::_1 > >
 
template<typename PhaseDepActionList >
using get_initialization_actions_list = tmpl::flatten< tmpl::transform< PhaseDepActionList, detail::get_initialization_actions_list< tmpl::_1 > > >
 Given the phase dependent action list, return the list of actions in the Initialization phase (or an empty list if the Initialization phase is absent from the phase dependent action list)
 
template<typename InitializationActionsList , typename AllocationTagsList = tmpl::list<>>
using get_initialization_tags = tmpl::remove_duplicates< tmpl::flatten< tmpl::list< AllocationTagsList, tmpl::transform< InitializationActionsList, detail::get_initialization_tags_from_action< tmpl::_1 > > > > >
 Given a list of initialization actions, and possibly a list of tags needed for allocation of an array component, returns a list of the unique initialization_tags for all the actions (and the allocate function).
 
template<typename InitializationActionsList >
using get_initialization_tags_to_keep = tmpl::remove_duplicates< tmpl::flatten< tmpl::transform< InitializationActionsList, detail::get_initialization_tags_to_keep_from_action< tmpl::_1 > > > >
 Given a list of initialization actions, returns a list of the unique initialization_tags_to_keep for all the actions. These are the tags that are not removed from the DataBox after initialization.
 
template<typename InitializationTagsList , typename Metavariables >
using get_option_tags = tmpl::remove_duplicates< tmpl::flatten< tmpl::transform< InitializationTagsList, tmpl::bind< detail::get_option_tags_from_initialization_tag< Metavariables >::template f, tmpl::_1 > > > >
 Given a list of initialization tags, returns a list of the unique option tags required to construct them.
 

Enumerations

enum class  AlgorithmExecution { Continue , Retry , Pause , Halt }
 The possible options for altering the current execution of the algorithm, used in the return type of iterable actions. More...
 

Functions

template<typename Metavariables , typename... Tags, typename... OptionTags>
tuples::TaggedTuple< Tags... > create_from_options (const tuples::TaggedTuple< OptionTags... > &options, tmpl::list< Tags... >) noexcept
 Given a list of tags and a tagged tuple containing items created from input options, return a tagged tuple of items constructed by calls to create_from_options for each tag in the list.
 
template<typename ParallelComponent , typename SectionIdTag , typename DbTagsList >
auto & get_section (const gsl::not_null< db::DataBox< DbTagsList > * > box) noexcept
 Retrieve the section that the element belongs to, or Parallel::no_section() if SectionIdTag is void. More...
 
template<typename DistribObject >
int number_of_procs (const DistribObject &distributed_object) noexcept
 Number of processing elements.
 
template<typename DistribObject >
int my_proc (const DistribObject &distributed_object) noexcept
 Index of my processing element.
 
template<typename DistribObject >
int number_of_nodes (const DistribObject &distributed_object) noexcept
 Number of nodes.
 
template<typename DistribObject >
int my_node (const DistribObject &distributed_object) noexcept
 Index of my node.
 
template<typename DistribObject >
int procs_on_node (const int node_index, const DistribObject &distributed_object) noexcept
 Number of processing elements on the given node.
 
template<typename DistribObject >
int my_local_rank (const DistribObject &distributed_object) noexcept
 The local index of my processing element on my node. This is in the interval 0, ..., procs_on_node(my_node()) - 1.
 
template<typename DistribObject >
int first_proc_on_node (const int node_index, const DistribObject &distributed_object) noexcept
 Index of first processing element on the given node.
 
template<typename DistribObject >
int node_of (const int proc_index, const DistribObject &distributed_object) noexcept
 Index of the node for the given processing element.
 
template<typename DistribObject >
int local_rank_of (const int proc_index, const DistribObject &distributed_object) noexcept
 The local index for the given processing element on its node.
 
template<typename ReceiveTag , typename Proxy , typename ReceiveDataType >
void receive_data (Proxy &&proxy, typename ReceiveTag::temporal_id temporal_id, ReceiveDataType &&receive_data, const bool enable_if_disabled=false) noexcept
 Send the data args... to the algorithm running on proxy, and tag the message with the identifier temporal_id. More...
 
template<typename Action , typename Proxy , typename... Args>
decltype(auto) local_synchronous_action (Proxy &&proxy, Args &&... args) noexcept
 Invoke a local synchronous action on proxy
 
template<typename... Args>
void printf (const std::string &format, Args &&... args)
 Print an atomic message to stdout with C printf usage. More...
 
template<typename... Args>
void printf_error (const std::string &format, Args &&... args)
 Print an atomic message to stderr with C printf usage. More...
 
template<class Action , class SenderProxy , class TargetProxy , class... Ts, class SectionType = NoSection>
void contribute_to_reduction (ReductionData< Ts... > reduction_data, const SenderProxy &sender_component, const TargetProxy &target_component, const gsl::not_null< SectionType * > section=&no_section()) noexcept
 Perform a reduction from the sender_component (typically your own parallel component) to the target_component, performing the Action upon receiving the reduction. More...
 
template<typename... Registrants>
void register_classes_with_charm (const tmpl::list< Registrants... >={}) noexcept
 Register specified classes. This function can either take classes to register as template arguments or take a tmpl::list of classes as a function argument.
 
template<typename Base >
void register_derived_classes_with_charm () noexcept
 Register derived classes of the Base class.
 
template<typename Metavariables >
void register_factory_classes_with_charm () noexcept
 Register all classes in Metavariables::factory_classes.
 
template<typename ParallelComponentTag , typename Metavariables >
auto get_parallel_component (GlobalCache< Metavariables > &cache) noexcept -> Parallel::proxy_from_parallel_component< GlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag > > &
 Access the Charm++ proxy associated with a ParallelComponent. More...
 
template<typename ParallelComponentTag , typename Metavariables >
auto get_parallel_component (const GlobalCache< Metavariables > &cache) noexcept -> const Parallel::proxy_from_parallel_component< GlobalCache_detail::get_component_if_mocked< typename Metavariables::component_list, ParallelComponentTag > > &
 Access the Charm++ proxy associated with a ParallelComponent. More...
 
template<typename GlobalCacheTag , typename Metavariables >
auto get (const GlobalCache< Metavariables > &cache) noexcept -> const GlobalCache_detail::type_for_get< GlobalCacheTag, Metavariables > &
 Access data in the cache. More...
 
template<typename GlobalCacheTag , typename Function , typename Metavariables >
bool mutable_cache_item_is_ready (GlobalCache< Metavariables > &cache, const Function &function) noexcept
 Returns whether the object identified by GlobalCacheTag is ready to be accessed by get. More...
 
template<typename GlobalCacheTag , typename Function , typename Metavariables , typename... Args>
void mutate (GlobalCache< Metavariables > &cache, Args &&... args) noexcept
 Mutates non-const data in the cache, by calling Function::apply() More...
 
template<typename GlobalCacheTag , typename Function , typename Metavariables , typename... Args>
void mutate (CProxy_GlobalCache< Metavariables > &cache_proxy, Args &&... args) noexcept
 Mutates non-const data in the cache, by calling Function::apply() More...
 
template<typename Action , typename Proxy >
void simple_action (Proxy &&proxy) noexcept
 Invoke a simple action on proxy
 
template<typename Action , typename Proxy , typename Arg0 , typename... Args>
void simple_action (Proxy &&proxy, Arg0 &&arg0, Args &&... args) noexcept
 Invoke a simple action on proxy
 
template<typename Action , typename Proxy >
void threaded_action (Proxy &&proxy) noexcept
 Invoke a threaded action on proxy, where the proxy must be a nodegroup.
 
template<typename Action , typename Proxy , typename Arg0 , typename... Args>
void threaded_action (Proxy &&proxy, Arg0 &&arg0, Args &&... args) noexcept
 Invoke a threaded action on proxy, where the proxy must be a nodegroup.
 
template<typename SenderComponent , typename ArrayIndex , typename Metavariables , class... Ts>
void contribute_to_phase_change_reduction (tuples::TaggedTuple< Ts... > data_for_reduction, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index) noexcept
 Send data from a parallel component to the Main chare for making phase-change decisions. More...
 
template<typename SenderComponent , typename Metavariables , class... Ts>
void contribute_to_phase_change_reduction (tuples::TaggedTuple< Ts... > data_for_reduction, Parallel::GlobalCache< Metavariables > &cache) noexcept
 Send data from a parallel component to the Main chare for making phase-change decisions. More...
 
NoSectionno_section () noexcept
 
template<typename T >
using has_pup_member_t = typename has_pup_member< T >::type
 
template<typename T >
constexpr bool has_pup_member_v = has_pup_member<T>::value
 
template<typename T >
using is_pupable_t = typename is_pupable< T >::type
 
template<typename T >
constexpr bool is_pupable_v = is_pupable<T>::value
 

Detailed Description

Functionality for parallelization.

The functions in namespace Parallel that return information on nodes and cores are templated on DistribObject. Actions should use these functions rather than the raw charm++ versions (in the sys namespace in Utilities/System/ParalleInfo.hpp) so that the mocking framework will see the mocked cores and nodes.

Typedef Documentation

◆ has_pup_member_t

template<typename T >
using Parallel::has_pup_member_t = typedef typename has_pup_member<T>::type
See also
has_pup_member

◆ is_pupable_t

template<typename T >
using Parallel::is_pupable_t = typedef typename is_pupable<T>::type
See also
is_pupable

Enumeration Type Documentation

◆ AlgorithmExecution

enum class Parallel::AlgorithmExecution
strong

The possible options for altering the current execution of the algorithm, used in the return type of iterable actions.

Enumerator
Continue 

Leave the algorithm termination flag in its current state.

Retry 

Temporarily stop executing iterable actions, but try the same action again after receiving data from other distributed objects. If the returned tuple has a third element, it must be std::numeric_limits<size_t>::max().

Pause 

Stop the execution of iterable actions, but allow entry methods (communication) to explicitly request restarting the execution.

Halt 

Stop the execution of iterable actions and do not allow their execution until after a phase change. Simple actions will still execute.

Function Documentation

◆ contribute_to_phase_change_reduction() [1/2]

template<typename SenderComponent , typename Metavariables , class... Ts>
void Parallel::contribute_to_phase_change_reduction ( tuples::TaggedTuple< Ts... >  data_for_reduction,
Parallel::GlobalCache< Metavariables > &  cache 
)
noexcept

Send data from a parallel component to the Main chare for making phase-change decisions.

This function is distinct from Parallel::contribute_to_reduction because this function contributes reduction data to the Main chare via the entry method phase_change_reduction. This must be done because the entry method must alter member data specific to the Main chare, and the Main chare cannot execute actions like most SpECTRE parallel components. For all cases other than sending phase-change decision data to the Main chare, you should use Parallel::contribute_to_reduction.

◆ contribute_to_phase_change_reduction() [2/2]

template<typename SenderComponent , typename ArrayIndex , typename Metavariables , class... Ts>
void Parallel::contribute_to_phase_change_reduction ( tuples::TaggedTuple< Ts... >  data_for_reduction,
Parallel::GlobalCache< Metavariables > &  cache,
const ArrayIndex array_index 
)
noexcept

Send data from a parallel component to the Main chare for making phase-change decisions.

This function is distinct from Parallel::contribute_to_reduction because this function contributes reduction data to the Main chare via the entry method phase_change_reduction. This must be done because the entry method must alter member data specific to the Main chare, and the Main chare cannot execute actions like most SpECTRE parallel components. For all cases other than sending phase-change decision data to the Main chare, you should use Parallel::contribute_to_reduction.

◆ get_section()

template<typename ParallelComponent , typename SectionIdTag , typename DbTagsList >
auto & Parallel::get_section ( const gsl::not_null< db::DataBox< DbTagsList > * >  box)
noexcept

Retrieve the section that the element belongs to, or Parallel::no_section() if SectionIdTag is void.

This function is useful to support sections in parallel algorithms. Specify the SectionIdTag template parameter to retrieve the associated section, or set it to void when the parallel algorithm runs over all elements of the parallel component. See Parallel::Section for details on sections.

Only call this function on elements that are part of a section. In case not all elements are part of a section with the SectionIdTag, make sure to skip those elements before calling this function.

Variable Documentation

◆ has_pup_member_v

template<typename T >
constexpr bool Parallel::has_pup_member_v = has_pup_member<T>::value
constexpr
See also
has_pup_member

◆ is_pupable_v

template<typename T >
constexpr bool Parallel::is_pupable_v = is_pupable<T>::value
constexpr
See also
is_pupable