SpECTRE  v2024.05.11
ActionTesting::MockDistributedObject< Component > Class Template Reference

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

#include <MockDistributedObject.hpp>

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 all_cache_tags = Parallel::get_const_global_cache_tags< metavariables >
using simple_tags_from_options = typename detail::get_simple_tags_from_options_from_component< Component >::type
using initial_tags = tmpl::flatten< tmpl::list< Parallel::Tags::MetavariablesImpl< metavariables >, Parallel::Tags::ArrayIndexImpl< array_index >, Parallel::Tags::GlobalCacheImpl< metavariables >, simple_tags_from_options, db::wrap_tags_in< Parallel::Tags::FromGlobalCache, all_cache_tags >, Parallel::Algorithm_detail::action_list_simple_tags< Component >, Parallel::Algorithm_detail::action_list_compute_tags< Component > > >
using databox_type = db::compute_databox_type< initial_tags >

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 (Parallel::Phase phase)
Parallel::Phase get_phase () const
void set_terminate (bool t)
bool get_terminate () const
std::unordered_map< Parallel::Phase, size_t > phase_bookmarks ()
void perform_algorithm ()
size_t number_of_actions_in_phase (const Parallel::Phase phase) const
template<typename Tag >
const auto & get_databox_tag () const
template<typename Tag >
bool box_contains () const
 Returns true if Tag was used to insert an item into the DataBox.
template<typename Tag >
bool tag_is_retrievable () const
 Returns true if Tag can be retrieved (via db::get) from the DataBox. More...
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)
template<typename InboxTag , typename MessageType >
void receive_data (MessageType *message)
Parallel::GlobalCache< typename Component::metavariables > & cache ()
void pup (PUP::er &p)
databox_type & get_databox ()
 Returns the DataBox.
const databox_type & get_databox () const
 Returns the DataBox.
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 DistributedObject 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 DistributedObject 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

◆ tag_is_retrievable()

template<typename Component >
template<typename Tag >
bool ActionTesting::MockDistributedObject< Component >::tag_is_retrievable ( ) const

Returns true if Tag can be retrieved (via db::get) from the DataBox.

compute and reference tags can be retrieved via the simple tag they are derived from.

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