1 /* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
7 #define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
9 #include <simgrid/kernel/routing/ClusterZone.hpp>
10 #include <simgrid/s4u/Link.hpp>
16 class DragonflyRouter {
19 unsigned int chassis_;
21 resource::StandardLinkImpl* blue_link_ = nullptr;
22 resource::StandardLinkImpl* limiter_ = nullptr;
23 std::vector<resource::StandardLinkImpl*> black_links_;
24 std::vector<resource::StandardLinkImpl*> green_links_;
25 std::vector<resource::StandardLinkImpl*> my_nodes_;
26 DragonflyRouter(unsigned group, unsigned chassis, unsigned blade, resource::StandardLinkImpl* limiter)
27 : group_(group), chassis_(chassis), blade_(blade), limiter_(limiter)
32 /** @ingroup ROUTING_API
33 * @brief NetZone using a Dragonfly topology
35 * Generate dragonfly according to the topology asked for, according to:
36 * Cray Cascade: a Scalable HPC System based on a Dragonfly Network
37 * Greg Faanes, Abdulla Bataineh, Duncan Roweth, Tom Court, Edwin Froese,
38 * Bob Alverson, Tim Johnson, Joe Kopnick, Mike Higgins and James Reinhard
39 * Cray Inc, Chippewa Falls, Wisconsin, USA
40 * or http://www.cray.com/sites/default/files/resources/CrayXCNetwork.pdf
42 * We use the same denomination for the different levels, with a Green,
43 * Black and Blue color scheme for the three different levels.
45 * Description of the topology has to be given with a string of type :
48 * Last part : "2" : 2 nodes per blade
49 * Third part : "5,1" : five blades/routers per chassis, with one link between each (green network)
50 * Second part : "4,3" = four chassis per group, with three links between each nth router of each chassis (black
52 * First part : "3,4" = three electrical groups, linked in an alltoall
53 * pattern by 4 links each (blue network)
55 * LIMITATIONS (for now):
56 * - Routing is only static and uses minimal routes.
57 * - When n links are used between two routers/groups, we consider only one link with n times the bandwidth (needs to
58 * be validated on a real system)
59 * - All links have the same characteristics for now
60 * - Blue links are all attached to routers in the chassis n°0. This limits
61 * the number of groups possible to the number of blades in a chassis. This
62 * is also not realistic, as blue level can use more links than a single
63 * Aries can handle, thus it should use several routers.
65 class XBT_PUBLIC DragonflyZone : public ClusterBase {
69 unsigned long chassis;
74 explicit DragonflyZone(const std::string& name);
75 void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
77 * @brief Parse topology parameters from string format
79 * @param topo_parameters Topology parameters, e.g. "3,4 ; 3,2 ; 3,1 ; 2"
81 static s4u::DragonflyParams parse_topo_parameters(const std::string& topo_parameters);
83 /** @brief Checks topology parameters */
84 static void check_topology(unsigned int n_groups, unsigned int groups_links, unsigned int n_chassis,
85 unsigned int chassis_links, unsigned int n_routers, unsigned int routers_links,
87 /** @brief Set Dragonfly topology */
88 void set_topology(unsigned int n_groups, unsigned int groups_links, unsigned int n_chassis,
89 unsigned int chassis_links, unsigned int n_routers, unsigned int routers_links, unsigned int nodes);
90 /** @brief Build upper levels (routers) in Dragonfly */
91 void build_upper_levels(const s4u::ClusterCallbacks& set_callbacks);
92 /** @brief Set the characteristics of links inside the Dragonfly zone */
93 void set_link_characteristics(double bw, double lat, s4u::Link::SharingPolicy sharing_policy) override;
94 Coords rankId_to_coords(unsigned long rank_id) const;
97 void generate_routers(const s4u::ClusterCallbacks& set_callbacks);
98 void generate_links();
99 void generate_link(const std::string& id, int numlinks, resource::StandardLinkImpl** linkup,
100 resource::StandardLinkImpl** linkdown);
102 unsigned int num_nodes_per_blade_ = 0;
103 unsigned int num_blades_per_chassis_ = 0;
104 unsigned int num_chassis_per_group_ = 0;
105 unsigned int num_groups_ = 0;
106 unsigned int num_links_green_ = 0;
107 unsigned int num_links_black_ = 0;
108 unsigned int num_links_blue_ = 0;
109 unsigned int num_links_per_link_ = 1; // splitduplex -> 2, only for local link
110 std::vector<DragonflyRouter> routers_;
112 } // namespace routing
113 } // namespace kernel
114 } // namespace simgrid