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