SpECTRE  v2022.12.02
Parallel Namespace Reference

Functionality for parallelization. More...

Namespaces

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

Classes

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_parallel_component_from_proxy
 Retrieve a parallel component from its proxy. More...
 
struct  get_parallel_component_from_proxy< Proxy< ParallelComponent, Ts... > >
 
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
 Check if T is a SpECTRE Array. More...
 
struct  is_array_element_proxy
 Check if T is a Charm++ proxy for an array chare element (from indexing into the array chare) More...
 
struct  is_array_proxy
 Check if T is a Charm++ proxy for an array chare (the entire array) 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_group
 Check if T is a SpECTRE Group. 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_nodegroup
 Check if T is a SpECTRE Nodegroup. More...
 
struct  is_pupable
 Check if type T has operator| defined for Charm++ serialization. More...
 
struct  is_singleton
 Check if T is a SpECTRE Singleton. 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  ResourceInfo
 Holds resource info for all singletons and for avoiding placing array elements/singletons on the global proc 0. 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...
 
struct  SingletonInfoHolder
 Holds resource info for a single singleton component. More...
 
struct  SingletonPack
 
struct  SingletonPack< tmpl::list< ParallelComponents... > >
 Holds options for a group of singleton components. More...
 

Typedefs

using iterable_action_return_t = std::tuple< AlgorithmExecution, std::optional< size_t > >
 Return type for iterable actions. The std::optional can be used to specify the index of the action to be called next in the phase dependent action list. Passing std::nullopt will execute the next action in the list.
 
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 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...
 
enum class  Phase {
  Phase::AdjustDomain , Phase::CheckDomain , Phase::Cleanup , Phase::EvaluateAmrCriteria ,
  Phase::Evolve , Phase::Execute , Phase::Exit , Phase::ImportInitialData ,
  Phase::Initialization , Phase::InitializeInitialDataDependentQuantities , Phase::InitializeTimeStepperHistory , Phase::LoadBalancing ,
  Phase::PostFailureCleanup , Phase::Register , Phase::RegisterWithElementDataReader , Phase::Solve ,
  Phase::Testing , Phase::WriteCheckpoint
}
 The possible phases of an executable. More...
 

Functions

template<typename Metavariables , typename... Tags, typename... OptionTags>
tuples::TaggedTuple< Tags... > create_from_options (const tuples::TaggedTuple< OptionTags... > &options, tmpl::list< Tags... >)
 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)
 Retrieve the section that the element belongs to, or Parallel::no_section() if SectionIdTag is void. More...
 
template<typename T , typename DistribObject >
number_of_procs (const DistribObject &distributed_object)
 Number of processing elements.
 
template<typename T , typename DistribObject >
my_proc (const DistribObject &distributed_object)
 Index of my processing element.
 
template<typename T , typename DistribObject >
number_of_nodes (const DistribObject &distributed_object)
 Number of nodes.
 
template<typename T , typename DistribObject >
my_node (const DistribObject &distributed_object)
 Index of my node.
 
template<typename T , typename R , typename DistribObject >
procs_on_node (const R node_index, const DistribObject &distributed_object)
 Number of processing elements on the given node.
 
template<typename T , typename DistribObject >
my_local_rank (const DistribObject &distributed_object)
 The local index of my processing element on my node. This is in the interval 0, ..., procs_on_node(my_node()) - 1.
 
template<typename T , typename R , typename DistribObject >
first_proc_on_node (const R node_index, const DistribObject &distributed_object)
 Index of first processing element on the given node.
 
template<typename T , typename R , typename DistribObject >
node_of (const R proc_index, const DistribObject &distributed_object)
 Index of the node for the given processing element.
 
template<typename T , typename R , typename DistribObject >
local_rank_of (const R proc_index, const DistribObject &distributed_object)
 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)
 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)
 Invoke a local synchronous action on proxy
 
template<typename Proxy >
auto * local (Proxy &&proxy)
 Wrapper for calling Charm++'s .ckLocal() on a proxy. More...
 
template<typename Proxy >
auto * local_branch (Proxy &&proxy)
 Wrapper for calling Charm++'s .ckLocalBranch() on a proxy. More...
 
std::vector< Phaseknown_phases ()
 
std::ostreamoperator<< (std::ostream &os, const Phase &phase)
 Output operator for a Phase.
 
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())
 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... >={})
 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 ()
 Register derived classes of the Base class.
 
template<typename Metavariables >
void register_factory_classes_with_charm ()
 Register all classes in Metavariables::factory_classes.
 
template<typename ParallelComponent >
bool operator== (const SingletonInfoHolder< ParallelComponent > &lhs, const SingletonInfoHolder< ParallelComponent > &rhs)
 
template<typename ParallelComponent >
bool operator!= (const SingletonInfoHolder< ParallelComponent > &lhs, const SingletonInfoHolder< ParallelComponent > &rhs)
 
template<typename... Components>
bool operator== (const SingletonPack< tmpl::list< Components... > > &lhs, const SingletonPack< tmpl::list< Components... > > &rhs)
 
template<typename... Components>
bool operator!= (const SingletonPack< tmpl::list< Components... > > &lhs, const SingletonPack< tmpl::list< Components... > > &rhs)
 
template<typename Metavars >
bool operator== (const ResourceInfo< Metavars > &lhs, const ResourceInfo< Metavars > &rhs)
 
template<typename Metavars >
bool operator!= (const ResourceInfo< Metavars > &lhs, const ResourceInfo< Metavars > &rhs)
 
template<typename ParallelComponentTag , typename Metavariables >
auto get_parallel_component (GlobalCache< Metavariables > &cache) -> 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) -> 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) -> 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)
 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)
 Mutates non-const data in the cache, by calling Function::apply() More...
 
template<typename Action , typename Proxy >
void simple_action (Proxy &&proxy)
 Invoke a simple action on proxy
 
template<typename Action , typename Proxy , typename Arg0 , typename... Args>
void simple_action (Proxy &&proxy, Arg0 &&arg0, Args &&... args)
 Invoke a simple action on proxy
 
template<typename Action , typename Proxy >
void threaded_action (Proxy &&proxy)
 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)
 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)
 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)
 Send data from a parallel component to the Main chare for making phase-change decisions. More...
 
NoSectionno_section ()
 

Variables

template<typename Metavariables , typename Tag >
constexpr bool is_in_const_global_cache
 Check whether a tag is retrievable from the const portion of the global cache. More...
 
template<typename Metavariables , typename Tag >
constexpr bool is_in_mutable_global_cache
 Check whether a tag is retrievable from the mutable portion of the global cache. More...
 
template<typename Metavariables , typename Tag >
constexpr bool is_in_global_cache
 Check whether a tag is retrievable from the global cache. More...
 
template<typename T >
constexpr bool is_array_v = is_array<T>::value
 
template<typename T >
constexpr bool is_singleton_v = is_singleton<T>::value
 
template<typename T >
constexpr bool is_group_v = is_group<T>::value
 
template<typename T >
constexpr bool is_nodegroup_v = is_nodegroup<T>::value
 
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/ParallelInfo.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 

Continue executing iterable actions.

Retry 

Temporarily stop executing iterable actions, but try the same action again after receiving data from other distributed objects.

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 
)

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 
)

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)

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.

◆ local()

template<typename Proxy >
auto * Parallel::local ( Proxy &&  proxy)

Wrapper for calling Charm++'s .ckLocal() on a proxy.

The Proxy must be to a Charm++ array chare (implementing a singleton design pattern using a single-element array) or to a Charm++ array element chare (i.e., the proxy obtained by indexing into a Charm++ array chare).

The function returns a pointer to the chare if it exists on the local processor, and NULL if it does not. See the Charm++ documentation. It is the responsibility of the user to check the result pointer is valid.

◆ local_branch()

template<typename Proxy >
auto * Parallel::local_branch ( Proxy &&  proxy)

Wrapper for calling Charm++'s .ckLocalBranch() on a proxy.

The Proxy must be to a Charm++ group chare or nodegroup chare.

The function returns a pointer to the local group/nodegroup chare.

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