X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f23b0fb864cb60978c1fcfd48d50f62dd054fe31..HEAD:/include/simgrid/kernel/routing/DragonflyZone.hpp diff --git a/include/simgrid/kernel/routing/DragonflyZone.hpp b/include/simgrid/kernel/routing/DragonflyZone.hpp index c300f7a295..acb1122ae5 100644 --- a/include/simgrid/kernel/routing/DragonflyZone.hpp +++ b/include/simgrid/kernel/routing/DragonflyZone.hpp @@ -1,29 +1,30 @@ -/* Copyright (c) 2014-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2014-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_ -#define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_ +#ifndef SIMGRID_ROUTING_CLUSTER_DRAGONFLY_HPP_ +#define SIMGRID_ROUTING_CLUSTER_DRAGONFLY_HPP_ #include #include -namespace simgrid { -namespace kernel { -namespace routing { +namespace simgrid::kernel::routing { class DragonflyRouter { public: unsigned int group_; unsigned int chassis_; unsigned int blade_; - resource::LinkImpl** blue_links_ = nullptr; - resource::LinkImpl** black_links_ = nullptr; - resource::LinkImpl** green_links_ = nullptr; - resource::LinkImpl** my_nodes_ = nullptr; - DragonflyRouter(int i, int j, int k); - ~DragonflyRouter(); + resource::StandardLinkImpl* blue_link_ = nullptr; + resource::StandardLinkImpl* limiter_ = nullptr; + std::vector black_links_; + std::vector green_links_; + std::vector my_nodes_; + DragonflyRouter(unsigned group, unsigned chassis, unsigned blade, resource::StandardLinkImpl* limiter) + : group_(group), chassis_(chassis), blade_(blade), limiter_(limiter) + { + } }; /** @ingroup ROUTING_API @@ -59,25 +60,42 @@ public: * is also not realistic, as blue level can use more links than a single * Aries can handle, thus it should use several routers. */ -class XBT_PUBLIC DragonflyZone : public ClusterZone { +class XBT_PUBLIC DragonflyZone : public ClusterBase { public: - explicit DragonflyZone(NetZoneImpl* father, std::string name); - ~DragonflyZone() override; - // void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override; - void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; - void parse_specific_arguments(ClusterCreationArgs* cluster) override; - void seal() override; + struct Coords { + unsigned long group; + unsigned long chassis; + unsigned long blade; + unsigned long node; + }; - void rankId_to_coords(int rank_id, unsigned int coords[4]); + explicit DragonflyZone(const std::string& name); + void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override; + /** + * @brief Parse topology parameters from string format + * + * @param topo_parameters Topology parameters, e.g. "3,4 ; 3,2 ; 3,1 ; 2" + */ + static s4u::DragonflyParams parse_topo_parameters(const std::string& topo_parameters); + + /** @brief Checks topology parameters */ + static void check_topology(unsigned int n_groups, unsigned int groups_links, unsigned int n_chassis, + unsigned int chassis_links, unsigned int n_routers, unsigned int routers_links, + unsigned int nodes); + /** @brief Set Dragonfly topology */ + void set_topology(unsigned int n_groups, unsigned int groups_links, unsigned int n_chassis, + unsigned int chassis_links, unsigned int n_routers, unsigned int routers_links, unsigned int nodes); + /** @brief Build upper levels (routers) in Dragonfly */ + void build_upper_levels(const s4u::ClusterCallbacks& set_callbacks); + /** @brief Set the characteristics of links inside the Dragonfly zone */ + void set_link_characteristics(double bw, double lat, s4u::Link::SharingPolicy sharing_policy) override; + Coords rankId_to_coords(unsigned long rank_id) const; private: - void generate_routers(); + void generate_routers(const s4u::ClusterCallbacks& set_callbacks); void generate_links(); - void create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown); - - simgrid::s4u::Link::SharingPolicy sharing_policy_; - double bw_ = 0; - double lat_ = 0; + void generate_link(const std::string& id, int numlinks, resource::StandardLinkImpl** linkup, + resource::StandardLinkImpl** linkdown); unsigned int num_nodes_per_blade_ = 0; unsigned int num_blades_per_chassis_ = 0; @@ -87,9 +105,7 @@ private: unsigned int num_links_black_ = 0; unsigned int num_links_blue_ = 0; unsigned int num_links_per_link_ = 1; // splitduplex -> 2, only for local link - DragonflyRouter** routers_ = nullptr; + std::vector routers_; }; -} // namespace routing -} // namespace kernel -} // namespace simgrid +} // namespace simgrid::kernel::routing #endif