SpECTRE  v2021.11.01
ActionTesting::MockDistributedObject< Component > Class Template Reference

MockDistributedObject mocks the AlgorithmImpl class. It should not be considered as part of the user interface. More...

#include <MockDistributedObject.hpp>

Classes

struct  get_databox_types
 

Public Types

using phase_dependent_action_lists = typename Component::phase_dependent_action_list
 
using all_actions_list = tmpl::flatten< tmpl::transform< phase_dependent_action_lists, Parallel::get_action_list_from_phase_dep_action_list< tmpl::_1 > > >
 
using metavariables = typename Component::metavariables
 
using inbox_tags_list = Parallel::get_inbox_tags< tmpl::push_front< all_actions_list, Component > >
 
using array_index = typename Parallel::get_array_index< typename Component::chare_type >::template f< Component >
 
using parallel_component = Component
 
using PhaseType = typename tmpl::front< phase_dependent_action_lists >::phase_type
 
using all_cache_tags = Parallel::get_const_global_cache_tags< metavariables >
 
using initialization_tags = typename detail::get_initialization_tags_from_component< Component >::type
 
using initial_tags = tmpl::flatten< tmpl::list< Parallel::Tags::MetavariablesImpl< metavariables >, Parallel::Tags::GlobalCacheImpl< metavariables >, initialization_tags, db::wrap_tags_in< Parallel::Tags::FromGlobalCache, all_cache_tags > > >
 
using initial_databox = db::compute_databox_type< initial_tags >
 
using databox_phase_types = typename Parallel::Algorithm_detail::build_databox_types< tmpl::list<>, phase_dependent_action_lists, initial_databox, inbox_tags_list, metavariables, typename Component::array_index, Component >::type
 
using databox_types = tmpl::flatten< tmpl::transform< databox_phase_types, get_databox_types< tmpl::_1 > > >
 
using variant_boxes = tmpl::remove_duplicates< tmpl::push_front< databox_types, db::DataBox< tmpl::list<> > > >
 

Public Member Functions

template<typename... Options>
 MockDistributedObject (const NodeId node_id, const LocalCoreId local_core_id, std::unordered_map< NodeId, std::unordered_map< LocalCoreId, GlobalCoreId > > mock_global_cores, std::unordered_map< GlobalCoreId, std::pair< NodeId, LocalCoreId > > mock_nodes_and_local_cores, const array_index &index, Parallel::GlobalCache< typename Component::metavariables > *cache, tuples::tagged_tuple_from_typelist< inbox_tags_list > *inboxes, Options &&... opts)
 
void set_phase (PhaseType phase)
 
PhaseType get_phase () const
 
void set_terminate (bool t)
 
bool get_terminate () const
 
void perform_algorithm ()
 
size_t number_of_actions_in_phase (const PhaseType phase) const
 
template<typename Tag >
const auto & get_databox_tag () const
 Walks through the variant of DataBoxes and retrieves the tag from the current one, if the current DataBox has the tag. If the current DataBox does not have the requested tag it is an error.
 
template<typename Tag >
bool box_contains () const
 
template<typename Tag >
bool tag_is_retrievable () const
 
void force_next_action_to_be (const size_t next_action_id)
 Force the next action invoked to be the next_action_idth action in the current phase.
 
size_t get_next_action_index () const
 Returns which action (by integer) will be invoked next in the current phase.
 
void next_action ()
 Invoke the next action in the action list for the current phase, failing if it was not ready.
 
bool next_action_if_ready ()
 Invoke the next action in the action list for the current phase, returning whether the action was ready.
 
template<typename Action , typename... Args>
Action::return_type local_synchronous_action (Args &&... args)
 
bool is_simple_action_queue_empty () const
 
size_t simple_action_queue_size () const
 
void invoke_queued_simple_action ()
 
bool is_threaded_action_queue_empty () const
 
size_t threaded_action_queue_size () const
 
void invoke_queued_threaded_action ()
 
template<typename InboxTag , typename Data >
void receive_data (const typename InboxTag::temporal_id &id, Data &&data, const bool enable_if_disabled=false)
 
Parallel::GlobalCache< typename Component::metavariables > & cache ()
 
template<typename AdditionalTagsList >
auto & get_databox ()
 Returns the DataBox with the tags set from the GlobalCache and the tags in AdditionalTagsList. If the DataBox type is incorrect std::terminate is called.
 
template<typename AdditionalTagsList >
const auto & get_databox () const
 Returns the DataBox with the tags set from the GlobalCache and the tags in AdditionalTagsList. If the DataBox type is incorrect std::terminate is called.
 
auto & get_variant_box ()
 Returns the boost::variant of DataBoxes.
 
const auto & get_variant_box () const
 Returns the boost::variant of DataBoxes.
 
int number_of_procs () const
 Wrappers for charm++ informational functions. More...
 
int my_proc () const
 Global Index of my processing element.
 
int number_of_nodes () const
 Number of nodes.
 
int my_node () const
 Index of my node.
 
int procs_on_node (int node_index) const
 Number of processing elements on the given node.
 
int my_local_rank () const
 The local index of my processing element on my node. This is in the interval 0, ..., procs_on_node(my_node()) - 1.
 
int first_proc_on_node (int node_index) const
 Index of first processing element on the given node.
 
int node_of (int proc_index) const
 Index of the node for the given processing element.
 
int local_rank_of (int proc_index) const
 The local index for the given processing element on its node.
 

Detailed Description

template<typename Component>
class ActionTesting::MockDistributedObject< Component >

MockDistributedObject mocks the AlgorithmImpl class. It should not be considered as part of the user interface.

MockDistributedObject represents an object on a supercomputer that can have methods invoked on it (possibly) remotely; this is standard nomenclature in the HPC community, based on the idea that such objects get distributed among the cores/nodes on an HPC (even though each object typically lives on only one core). For example, an element of an array chare in charm++ is a mock distributed object, whereas the entire array chare is a collection of mock distributed objects, each with its own array index. MockDistributedObject is a modified implementation of AlgorithmImpl and so some of the code is shared between the two. The main difference is that MockDistributedObject has support for introspection. For example, it is possible to check how many simple actions are queued, to look at the inboxes, etc. Another key difference is that MockDistributedObject runs only one action in the action list at a time. This is done in order to provide opportunity for introspection and checking statements before and after actions are invoked.

Member Function Documentation

◆ number_of_procs()

template<typename Component >
int ActionTesting::MockDistributedObject< Component >::number_of_procs

Wrappers for charm++ informational functions.

Number of processing elements


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