Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enforce "Rule-of-Three/Five".
[simgrid.git] / include / simgrid / kernel / routing / DragonflyZone.hpp
1 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
7 #define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
8
9 #include <simgrid/kernel/routing/ClusterZone.hpp>
10 #include <simgrid/s4u/Link.hpp>
11
12 namespace simgrid {
13 namespace kernel {
14 namespace routing {
15
16 class DragonflyRouter {
17 public:
18   unsigned int group_;
19   unsigned int chassis_;
20   unsigned int blade_;
21   resource::LinkImpl** blue_links_  = nullptr;
22   resource::LinkImpl** black_links_ = nullptr;
23   resource::LinkImpl** green_links_ = nullptr;
24   resource::LinkImpl** my_nodes_    = nullptr;
25   DragonflyRouter(int i, int j, int k);
26   DragonflyRouter(const DragonflyRouter&) = delete;
27   DragonflyRouter& operator=(const DragonflyRouter&) = delete;
28   ~DragonflyRouter();
29 };
30
31 /** @ingroup ROUTING_API
32  * @brief NetZone using a Dragonfly topology
33  *
34  * Generate dragonfly according to the topology asked for, according to:
35  * Cray Cascade: a Scalable HPC System based on a Dragonfly Network
36  * Greg Faanes, Abdulla Bataineh, Duncan Roweth, Tom Court, Edwin Froese,
37  * Bob Alverson, Tim Johnson, Joe Kopnick, Mike Higgins and James Reinhard
38  * Cray Inc, Chippewa Falls, Wisconsin, USA
39  * or http://www.cray.com/sites/default/files/resources/CrayXCNetwork.pdf
40  *
41  * We use the same denomination for the different levels, with a Green,
42  * Black and Blue color scheme for the three different levels.
43  *
44  * Description of the topology has to be given with a string of type :
45  * "3,4;4,3;5,1;2"
46  *
47  * Last part  : "2"   : 2 nodes per blade
48  * Third part : "5,1" : five blades/routers per chassis, with one link between each (green network)
49  * Second part : "4,3" = four chassis per group, with three links between each nth router of each chassis (black
50  * network)
51  * First part : "3,4" = three electrical groups, linked in an alltoall
52  * pattern by 4 links each (blue network)
53  *
54  * LIMITATIONS (for now):
55  *  - Routing is only static and uses minimal routes.
56  *  - When n links are used between two routers/groups, we consider only one link with n times the bandwidth (needs to
57  *    be validated on a real system)
58  *  - All links have the same characteristics for now
59  *  - Blue links are all attached to routers in the chassis n°0. This limits
60  *    the number of groups possible to the number of blades in a chassis. This
61  *    is also not realistic, as blue level can use more links than a single
62  *    Aries can handle, thus it should use several routers.
63  */
64 class XBT_PUBLIC DragonflyZone : public ClusterZone {
65 public:
66   explicit DragonflyZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel);
67   DragonflyZone(const DragonflyZone&) = delete;
68   DragonflyZone& operator=(const DragonflyZone&) = delete;
69   ~DragonflyZone() override;
70   //      void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
71   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
72   void parse_specific_arguments(ClusterCreationArgs* cluster) override;
73   void seal() override;
74
75   void rankId_to_coords(int rank_id, unsigned int coords[4]);
76
77 private:
78   void generate_routers();
79   void generate_links();
80   void create_link(std::string id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
81
82   simgrid::s4u::Link::SharingPolicy sharing_policy_;
83   double bw_  = 0;
84   double lat_ = 0;
85
86   unsigned int num_nodes_per_blade_    = 0;
87   unsigned int num_blades_per_chassis_ = 0;
88   unsigned int num_chassis_per_group_  = 0;
89   unsigned int num_groups_             = 0;
90   unsigned int num_links_green_        = 0;
91   unsigned int num_links_black_        = 0;
92   unsigned int num_links_blue_         = 0;
93   unsigned int num_links_per_link_     = 1; // splitduplex -> 2, only for local link
94   DragonflyRouter** routers_        = nullptr;
95 };
96 } // namespace routing
97 } // namespace kernel
98 } // namespace simgrid
99 #endif