Derecho  0.9
Distributed systems toolkit for RDMA
Classes | Namespaces | Functions | Variables
subgroup_functions.hpp File Reference
#include <memory>
#include <variant>
#include "derecho_modes.hpp"
#include "detail/derecho_internal.hpp"
#include "subgroup_info.hpp"
Include dependency graph for subgroup_functions.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  derecho::ShardAllocationPolicy
 A data structure defining the parameters of the default subgroup allocation function for a single subgroup; it specifies how one subgroup is divided into shards. More...
 
struct  derecho::SubgroupAllocationPolicy
 A data structure defining the parameters of the default subgroup allocation function for a single subgroup type. More...
 
struct  derecho::CrossProductPolicy
 An alternate type of subgroup allocation policy for subgroup types whose membership will be defined as a cross-product of other subgroups. More...
 
class  derecho::DefaultSubgroupAllocator
 Functor of type shard_view_generator_t that implements the default subgroup allocation algorithm, parameterized based on a policy for each subgroup type (i.e. More...
 

Namespaces

 derecho
 

Functions

template<typename T >
std::unique_ptr< T > derecho::deep_pointer_copy (const std::unique_ptr< T > &to_copy)
 A copy constructor for objects owned by unique_ptr. More...
 
subgroup_allocation_map_t derecho::one_subgroup_entire_view (const std::vector< std::type_index > &subgroup_type_order, const std::unique_ptr< View > &prev_view, View &curr_view)
 A simple implementation of shard_view_generator_t that creates a single, un-sharded subgroup containing all the members of curr_view for every subgroup type in the list. More...
 
subgroup_allocation_map_t derecho::one_subgroup_entire_view_raw (const std::vector< std::type_index > &subgroup_type_order, const std::unique_ptr< View > &prev_view, View &curr_view)
 A simple implementation of shard_view_generator_t that returns a single, un-sharded subgroup in Unordered (Raw) mode containing all the members of curr_view for every type in the list. More...
 
ShardAllocationPolicy derecho::flexible_even_shards (int num_shards, int min_nodes_per_shard, int max_nodes_per_shard, const std::string &profile="default")
 Returns a ShardAllocationPolicy that specifies num_shards "flexible" or fault-tolerant shards, each of which has the same minimum number of nodes and maximum number of nodes. More...
 
ShardAllocationPolicy derecho::flexible_even_shards (const std::string &profile)
 Returns a ShardAllocationPolicy that specifies a set number of "flexible" shards, each of which has the same minimum and maximum number of nodes, using the values of the constants num_shards, min_nodes, and max_nodes in the section of the configuration file identified by the profile string. More...
 
ShardAllocationPolicy derecho::fixed_even_shards (int num_shards, int nodes_per_shard, const std::string &profile="default")
 Returns a ShardAllocationPolicy that specifies num_shards shards with the same fixed number of nodes in each shard; each shard must have exactly nodes_per_shard members. More...
 
ShardAllocationPolicy derecho::raw_fixed_even_shards (int num_shards, int nodes_per_shard, const std::string &profile="default")
 Returns a ShardAllocationPolicy that specifies num_shards shards with the same fixed number of nodes in each shard, and every shard running in "raw" delivery mode. More...
 
ShardAllocationPolicy derecho::custom_shards_policy (const std::vector< int > &min_nodes_by_shard, const std::vector< int > &max_nodes_by_shard, const std::vector< Mode > &delivery_modes_by_shard, const std::vector< std::string > &profiles_by_shard)
 Returns a ShardAllocationPolicy for a subgroup that has a different number of members in each shard, and possibly has each shard in a different delivery mode. More...
 
ShardAllocationPolicy derecho::custom_shard_policy (const std::vector< Mode > &delivery_modes_by_shard, const std::vector< std::string > &profiles_by_shard)
 Returns a ShardAllocationPolicy for a subgroup that has a different number of members in each shard, and possibly has each shard in a different delivery mode. More...
 
SubgroupAllocationPolicy derecho::one_subgroup_policy (const ShardAllocationPolicy &policy)
 Returns a SubgroupAllocationPolicy for a replicated type that only has a single subgroup. More...
 
SubgroupAllocationPolicy derecho::identical_subgroups_policy (int num_subgroups, const ShardAllocationPolicy &subgroup_policy)
 Returns a SubgroupAllocationPolicy for a replicated type that needs n subgroups with identical sharding policies. More...
 

Variables

constexpr char derecho::num_shards_profile_field [] = "num_shards"
 
constexpr char derecho::min_nodes_profile_field [] = "min_nodes"
 
constexpr char derecho::max_nodes_profile_field [] = "max_nodes"
 

Class Documentation

◆ derecho::ShardAllocationPolicy

struct derecho::ShardAllocationPolicy

A data structure defining the parameters of the default subgroup allocation function for a single subgroup; it specifies how one subgroup is divided into shards.

Definition at line 65 of file subgroup_functions.hpp.

Collaboration diagram for derecho::ShardAllocationPolicy:
Class Members
bool even_shards Whether all shards should contain the same number of members.
int max_nodes_per_shard If even_shards is true, this is the maximum number of nodes per shard.
vector< int > max_num_nodes_by_shard If even_shards is false, this will contain an entry for each shard indicating the maximum number of members it should have.
int min_nodes_per_shard If even_shards is true, this is the minimum number of nodes per shard.

(Ignored if even_shards is false).

vector< int > min_num_nodes_by_shard If even_shards is false, this will contain an entry for each shard indicating the minimum number of members it should have.

(Ignored if even_shards is true).

vector< Mode > modes_by_shard If even_shards is false, this will contain an entry for each shard indicating which delivery mode it should use.

(Ignored if even_shards is true).

int num_shards The number of shards; set to 1 for a non-sharded subgroup.
vector< string > profiles_by_shard If even_shards is false, this will contain an entry for each shard indicating which profile it should use.

(Ignored if even_shards is true).

Mode shards_mode If even_shards is true, this is the delivery mode that will be used for every shard.

(Ignored if even_shards is false).

string shards_profile If even_shards is true, this is the profile that will be used for every shard.

(Ignore if even_shards is false).

◆ derecho::SubgroupAllocationPolicy

struct derecho::SubgroupAllocationPolicy

A data structure defining the parameters of the default subgroup allocation function for a single subgroup type.

Definition at line 102 of file subgroup_functions.hpp.

Collaboration diagram for derecho::SubgroupAllocationPolicy:
Class Members
bool identical_subgroups Whether all subgroups of this type will have an identical shard layout.
int num_subgroups The number of subgroups of the same Replicated type to create.
vector< ShardAllocationPolicy > shard_policy_by_subgroup If identical_subgroups is true, contains a single entry with the allocation policy for all subgroups of this type.

If identical_subgroups is false, contains an entry for each subgroup describing that subgroup's shards.

◆ derecho::CrossProductPolicy

struct derecho::CrossProductPolicy

An alternate type of subgroup allocation policy for subgroup types whose membership will be defined as a cross-product of other subgroups.

Each node in the source subgroup will be placed in T subgroups, one for each shard in the target subgroup (the target subgroup has T shards). Thus, if there are S members in the source subgroup, and T shards in the target subgroup, S * T subgroups of a single type will be created. The nodes in the source subgroup will be marked as the only senders in these subgroups. A node that has rank i within the source subgroup can send a multicast to shard j of the target subgroup by selecting the cross-product subgroup at index (i * T + j).

Definition at line 124 of file subgroup_functions.hpp.

Class Members
pair< type_index, uint32_t > source_subgroup The (type, index) pair identifying the "source" subgroup of the cross-product.

Each member of this subgroup will be a sender in T subgroups, where T is the number of shards in the target subgroup.

pair< type_index, uint32_t > target_subgroup The (type, index) pair identifying the "target" subgroup of the cross-product.

Each shard in this subgroup will have all of its members assigned to S subgroups as receivers, where S is the number of members in the source subgroup.