SpECTRE
v2024.12.16
|
Functions, classes and documentation related to parallelization and Charm++. More...
Namespaces | |
namespace | Parallel::InboxInserters |
Structs that have insert_into_inbox methods for commonly used cases. | |
namespace | mem_monitor |
Classes | |
class | AlgorithmArray< ParallelComponent, SpectreArrayIndex > |
A Spectre algorithm object that wraps a charm++ array chare. More... | |
struct | Parallel::Algorithms::Array |
A struct that stores the charm++ types relevant for a particular array component. More... | |
class | AlgorithmGroup< ParallelComponent, SpectreArrayIndex > |
A Spectre algorithm object that wraps a charm++ group chare. More... | |
struct | Parallel::Algorithms::Group |
A struct that stores the charm++ types relevant for a particular group component. More... | |
class | AlgorithmNodegroup< ParallelComponent, SpectreArrayIndex > |
A Spectre algorithm object that wraps a charm++ nodegroup chare. More... | |
struct | Parallel::Algorithms::Nodegroup |
A struct that stores the charm++ types relevant for a particular nodegroup component. More... | |
class | AlgorithmSingleton< ParallelComponent, SpectreArrayIndex > |
A Spectre algorithm object that wraps a single element charm++ array chare. More... | |
struct | Parallel::Algorithms::Singleton |
A struct that stores the charm++ types relevant for a particular singleton component. More... | |
struct | Parallel::ArrayIndex< Index > |
The array index used for indexing Chare Arrays, mostly an implementation detail. More... | |
class | Parallel::DistributedObject< 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... | |
class | Parallel::GlobalCache< Metavariables > |
A Charm++ chare that caches global data once per Charm++ node. More... | |
struct | Parallel::Tags::GlobalCache |
Tag to retrieve the Parallel::GlobalCache from the DataBox. More... | |
struct | Parallel::Tags::FromGlobalCache< CacheTag > |
Tag used to retrieve data from the Parallel::GlobalCache . This is the recommended way for compute tags to retrieve data out of the global cache. More... | |
class | Parallel::Main< Metavariables > |
The main function of a Charm++ executable. See the Parallelization documentation for an overview of Metavariables, Phases, and parallel components. More... | |
class | Parallel::NodeLock |
A typesafe wrapper for a lock for synchronization of shared resources on a given node, with safe creation, destruction, and serialization. More... | |
struct | Parallel::PhaseActions< Phase, ActionsList > |
List of all the actions to be executed in the specified phase. More... | |
struct | Parallel::get_action_list_from_phase_dep_action_list< PhaseDepActionList > |
(Lazy) metafunction to get the action list from a PhaseActions More... | |
struct | Parallel::ReductionDatum< T, InvokeCombine, InvokeFinal, InvokeFinalExtraArgsIndices > |
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 | Parallel::ReductionData< ReductionDatum< Ts, InvokeCombines, InvokeFinals, InvokeFinalExtraArgsIndices >... > |
Used for reducing a possibly heterogeneous collection of types in a single reduction call. More... | |
struct | Parallel::SingletonInfoHolder< Component > |
Holds resource info for a single singleton component. More... | |
struct | Parallel::SingletonPack< tmpl::list< ParallelComponents... > > |
Holds options for a group of singleton components. More... | |
struct | Parallel::ResourceInfo< Metavariables > |
Holds resource info for all singletons and for avoiding placing array elements/singletons on the global proc 0. More... | |
struct | Parallel::Tags::ArrayIndex |
Tag to retrieve the ArrayIndex from the DataBox. More... | |
struct | Parallel::Tags::Metavariables |
Tag to retrieve the Metavariables from the DataBox. More... | |
struct | Parallel::OptionTags::ResourceInfo< Metavariables > |
Options group for resource allocation. More... | |
struct | Parallel::Tags::ResourceInfo< Metavariables > |
Tag to retrieve the ResourceInfo. More... | |
struct | Parallel::is_array_proxy< T > |
Check if T is a Charm++ proxy for an array chare (the entire array) More... | |
struct | Parallel::is_array_element_proxy< T > |
Check if T is a Charm++ proxy for an array chare element (from indexing into the array chare) More... | |
struct | Parallel::is_group_proxy< T > |
Check if T is a Charm++ proxy for a group chare. More... | |
struct | Parallel::is_node_group_proxy< T > |
Check if T is a Charm++ proxy for a node group chare. More... | |
struct | Parallel::is_bound_array< T> |
Check if T is a ParallelComponent for a Charm++ bound array. More... | |
struct | Parallel::is_array< T > |
Check if T is a SpECTRE Array. More... | |
struct | Parallel::is_singleton< T > |
Check if T is a SpECTRE Singleton. More... | |
struct | Parallel::is_group< T > |
Check if T is a SpECTRE Group. More... | |
struct | Parallel::is_nodegroup< T > |
Check if T is a SpECTRE Nodegroup. More... | |
struct | Parallel::get_parallel_component_from_proxy< Proxy > |
Retrieve a parallel component from its proxy. More... | |
struct | Parallel::has_pup_member< T> |
Check if T has a pup member function. More... | |
struct | Parallel::is_pupable< T, U > |
Check if type T has operator| defined for Charm++ serialization. More... | |
Macros | |
#define | WRAPPED_PUPable_decl_template(className) PUPable_decl_template(SINGLE_ARG(className)) |
Mark derived classes as serializable. More... | |
#define | WRAPPED_PUPable_decl_base_template(baseClassName, className) |
Mark derived template classes as serializable. More... | |
Typedefs | |
template<class ActionsList > | |
using | Parallel::get_inbox_tags = implementation defined |
Given a list of Actions, get a list of the unique inbox tags. | |
template<class ActionsList > | |
using | Parallel::get_const_global_cache_tags_from_actions = implementation defined |
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 | Parallel::get_mutable_global_cache_tags_from_actions = implementation defined |
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 | Parallel::get_const_global_cache_tags = implementation defined |
Given the metavariables, get a list of the unique tags that will specify the items in the GlobalCache. | |
template<typename Metavariables > | |
using | Parallel::get_mutable_global_cache_tags = implementation defined |
Given the metavariables, get a list of the unique tags that will specify the mutable items in the GlobalCache. | |
template<typename PhaseDepActionList > | |
using | Parallel::get_initialization_actions_list = implementation defined |
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 > | |
using | Parallel::get_simple_tags_from_options = implementation defined |
Given a list of initialization actions, returns a list of the unique simple_tags_from_options for all the actions. | |
template<typename SimpleTagsList , typename Metavariables > | |
using | Parallel::get_option_tags = implementation defined |
Given a list of simple tags, returns a list of the unique option tags required to construct them. | |
Functions | |
template<typename Metavariables , typename... Tags, typename... OptionTags> | |
tuples::TaggedTuple< Tags... > | Parallel::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 T , typename DistribObject > | |
T | Parallel::number_of_procs (const DistribObject &distributed_object) |
Number of processing elements. | |
template<typename T , typename DistribObject > | |
T | Parallel::my_proc (const DistribObject &distributed_object) |
Index of my processing element. | |
template<typename T , typename DistribObject > | |
T | Parallel::number_of_nodes (const DistribObject &distributed_object) |
Number of nodes. | |
template<typename T , typename DistribObject > | |
T | Parallel::my_node (const DistribObject &distributed_object) |
Index of my node. | |
template<typename T , typename R , typename DistribObject > | |
T | Parallel::procs_on_node (const R node_index, const DistribObject &distributed_object) |
Number of processing elements on the given node. | |
template<typename T , typename DistribObject > | |
T | Parallel::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 > | |
T | Parallel::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 > | |
T | Parallel::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 > | |
T | Parallel::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 | Parallel::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 ReceiveTag , typename Proxy , typename MessageType > | |
void | Parallel::receive_data (Proxy &&proxy, MessageType *message) |
Send a pointer message to the algorithm running on proxy . More... | |
template<typename Action , typename Proxy , typename... Args> | |
decltype(auto) | Parallel::local_synchronous_action (Proxy &&proxy, Args &&... args) |
Invoke a local synchronous action on proxy | |
template<typename... Args> | |
void | Parallel::printf (const std::string &format, Args &&... args) |
Print an atomic message to stdout with C printf usage. More... | |
template<typename... Args> | |
void | Parallel::printf_error (const std::string &format, Args &&... args) |
Print an atomic message to stderr with C printf usage. More... | |
template<typename... Args> | |
void | Parallel::fprintf (const std::string &file, const std::string &format, Args &&... args) |
Print an atomic message to a file with C printf usage. More... | |
template<class Action , class SenderProxy , class TargetProxy , class... Ts, class SectionType = NoSection> | |
void | Parallel::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 K , typename T , typename C > | |
void | pup_override (PUP::er &p, std::map< K, T, C > &m) |
Temporary serialization function for a std::map with a comparator to circumvent a charm bug. | |
template<typename T > | |
std::vector< char > | serialize (const T &obj) |
Serialize an object using PUP. More... | |
template<typename T > | |
T | deserialize (const void *const data) |
Deserialize an object using PUP. More... | |
template<typename T > | |
void | deserialize (const gsl::not_null< T * > result, const void *const data) |
Deserialize an object using PUP. More... | |
template<typename T > | |
size_t | size_of_object_in_bytes (const T &obj) |
Returns the size of an object in bytes. | |
Variables | |
template<typename Metavariables , typename Tag > | |
constexpr bool | Parallel::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 | Parallel::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 | Parallel::is_in_global_cache |
Check whether a tag is retrievable from the global cache. More... | |
template<typename ParallelComponentTag , typename Metavariables > | |
auto | Parallel::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 | Parallel::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 | Parallel::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 | Parallel::mutable_cache_item_is_ready (GlobalCache< Metavariables > &cache, const Parallel::ArrayComponentId &array_component_id, 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 | Parallel::mutate (GlobalCache< Metavariables > &cache, Args &&... args) |
Mutates non-const data in the cache, by calling Function::apply() More... | |
template<typename Action , typename Proxy > | |
void | Parallel::simple_action (Proxy &&proxy) |
Invoke a simple action on proxy | |
template<typename Action , typename Proxy , typename Arg0 , typename... Args> | |
void | Parallel::simple_action (Proxy &&proxy, Arg0 &&arg0, Args &&... args) |
Invoke a simple action on proxy | |
template<typename Action , typename Proxy > | |
void | Parallel::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 | Parallel::threaded_action (Proxy &&proxy, Arg0 &&arg0, Args &&... args) |
Invoke a threaded action on proxy , where the proxy must be a nodegroup. | |
Functions, classes and documentation related to parallelization and Charm++.
See Parallelization infrastructure for details.
#define WRAPPED_PUPable_decl_base_template | ( | baseClassName, | |
className | |||
) |
Mark derived template classes as serializable.
Any class that inherits from an abstract base class where the base class is a template class must contain this macro if it is to be serialized.
#define WRAPPED_PUPable_decl_template | ( | className | ) | PUPable_decl_template(SINGLE_ARG(className)) |
Mark derived classes as serializable.
Any class that inherits from an abstract base class where the base class is not a template class must contain this macro if it is to be serialized.
|
strong |
The possible phases of an executable.
Spectre executables are split into distinct phases separated by global synchronizations. Each executable will start with phase Initialization
and end with phase Exit
. The metavariables of each executable must define default_phase_order
, an array of Parallel::Phase that must contain at least Initialization
as the first element and Exit
as the last element. Usually the next phase is determined from the default_phase_order
provided by the metavariables. If more complex decision making is desired, use the PhaseControl infrastructure.
void Parallel::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.
Parallel::Section
). Pass the Parallel::Section
as the section
argument, or pass Parallel::no_section()
to perform a reduction over the entire parallel component (default). Here's an example of a section reduction:CkGetSectionInfo
within the message. void deserialize | ( | const gsl::not_null< T * > | result, |
const void *const | data | ||
) |
Deserialize an object using PUP.
T | the type to deserialize to. |
T deserialize | ( | const void *const | data | ) |
Deserialize an object using PUP.
T | the type to deserialize to |
|
inline |
Print an atomic message to a file with C printf usage.
See Parallel::printf for details.
auto Parallel::get | ( | const GlobalCache< Metavariables > & | cache | ) | -> const GlobalCache_detail::type_for_get<GlobalCacheTag, Metavariables>& |
Access data in the cache.
Requires: GlobalCacheTag is a tag in the mutable_global_cache_tags
or const_global_cache_tags
defined by the Metavariables and in Actions.
Returns: a constant reference to an object in the cache
auto Parallel::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.
Requires: ParallelComponentTag is a tag in component_list
Returns: a Charm++ proxy that can be used to call an entry method on the chare(s)
auto Parallel::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.
Requires: ParallelComponentTag is a tag in component_list
Returns: a Charm++ proxy that can be used to call an entry method on the chare(s)
bool Parallel::mutable_cache_item_is_ready | ( | GlobalCache< Metavariables > & | cache, |
const Parallel::ArrayComponentId & | array_component_id, | ||
const Function & | function | ||
) |
Returns whether the object identified by GlobalCacheTag
is ready to be accessed by get
.
Requires: GlobalCacheTag
is a tag in mutable_global_cache_tags
defined by the Metavariables and in Actions.
Requires: function
is a user-defined invokable that takes one argument: a const reference to the object referred to by the GlobalCacheTag
. function
returns a std::unique_ptr<CallBack>
that determines the readiness. To indicate that the item is ready, the std::unique_ptr
returned by function
must be nullptr; in this case mutable_cache_item_is_ready
returns true. To indicate that the item is not ready, the std::unique_ptr
returned by function
must be valid; in this case, mutable_cache_item_is_ready
appends the std::unique_ptr<Callback>
to an internal list of callbacks to be called on mutate
, and then returns false.
function
is returning a valid callback, it should only return a Parallel::PerformAlgorithmCallback
. Other types of callbacks are not supported at this time. void Parallel::mutate | ( | GlobalCache< Metavariables > & | cache, |
Args &&... | args | ||
) |
Mutates non-const data in the cache, by calling Function::apply()
Requires: GlobalCacheTag
is a tag in tag_list.
Requires: Function
is a struct with a static void apply()
function that mutates the object. Function::apply()
takes as its first argument a gsl::not_null
pointer to the object named by the GlobalCacheTag
, and takes args
as subsequent arguments.
|
inline |
Print an atomic message to stdout with C printf usage.
Similar to Python, you can print any object that's streamable by passing it in as an argument and using the formatter "%s". For example,
|
inline |
Print an atomic message to stderr with C printf usage.
See Parallel::printf for details.
void Parallel::receive_data | ( | Proxy && | proxy, |
MessageType * | message | ||
) |
Send a pointer message
to the algorithm running on proxy
.
Here, message
should hold all the information you need as member variables of the object. This includes, temporal ID identifiers, the data itself, and any auxilary information that needs to be communicated. The ReceiveTag
associated with this message
should be able unpack the information that was sent.
If the component associated with the proxy
you are calling this on is running on the same charm-node, the exact pointer message
is sent to the receiving component. No copies of data are done. If the receiving component is on a different charm-node, then the data pointed to by message
is copied, sent through charm, and unpacked on the receiving component. The pointer that is passed to the algorithm on the receiving component then points to the copied data on the receiving component.
message
pointer after you call this function. Doing so will result in undefined behavior because something else may be controlling the pointer. void Parallel::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
.
If the algorithm was previously disabled, set enable_if_disabled
to true to enable the algorithm on the parallel component.
std::vector< char > serialize | ( | const T & | obj | ) |
Serialize an object using PUP.
The type to serialize as must be explicitly specified. We require this because a mismatch between the serialize and deserialize calls causes undefined behavior and we do not want this to depend on inferred types for safety.
T | type to serialize |
|
constexpr |
Check whether a tag is retrievable from the const portion of the global cache.
|
constexpr |
Check whether a tag is retrievable from the global cache.
|
constexpr |
Check whether a tag is retrievable from the mutable portion of the global cache.