-/* Copyright (c) 2014-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2020. 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. */
#define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
#include <simgrid/kernel/routing/ClusterZone.hpp>
+#include <simgrid/s4u/Link.hpp>
namespace simgrid {
namespace kernel {
unsigned int group_;
unsigned int chassis_;
unsigned int blade_;
- surf::LinkImpl** blueLinks_ = nullptr;
- surf::LinkImpl** blackLinks_ = nullptr;
- surf::LinkImpl** greenLinks_ = nullptr;
- surf::LinkImpl** myNodes_ = nullptr;
- DragonflyRouter(int i, int j, int k);
- ~DragonflyRouter();
+ resource::LinkImpl* blue_link_ = nullptr;
+ std::vector<resource::LinkImpl*> black_links_;
+ std::vector<resource::LinkImpl*> green_links_;
+ std::vector<resource::LinkImpl*> my_nodes_;
+ DragonflyRouter(unsigned group, unsigned chassis, unsigned blade) : group_(group), chassis_(chassis), blade_(blade) {}
};
/** @ingroup ROUTING_API
*/
class XBT_PUBLIC DragonflyZone : public ClusterZone {
public:
- explicit DragonflyZone(NetZone* 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 getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
+ explicit DragonflyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
+ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
void parse_specific_arguments(ClusterCreationArgs* cluster) override;
void seal() override;
- void generateRouters();
- void generateLinks();
- void createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
- void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
+ void rankId_to_coords(int rank_id, unsigned int coords[4]);
private:
- ClusterCreationArgs* cluster_ = nullptr;
- unsigned int numNodesPerBlade_ = 0;
- unsigned int numBladesPerChassis_ = 0;
- unsigned int numChassisPerGroup_ = 0;
- unsigned int numGroups_ = 0;
- unsigned int numLinksGreen_ = 0;
- unsigned int numLinksBlack_ = 0;
- unsigned int numLinksBlue_ = 0;
- unsigned int numLinksperLink_ = 1; // splitduplex -> 2, only for local link
- DragonflyRouter** routers_ = nullptr;
+ void generate_routers();
+ 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;
+
+ unsigned int num_nodes_per_blade_ = 0;
+ unsigned int num_blades_per_chassis_ = 0;
+ unsigned int num_chassis_per_group_ = 0;
+ unsigned int num_groups_ = 0;
+ unsigned int num_links_green_ = 0;
+ 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
+ std::vector<DragonflyRouter> routers_;
};
} // namespace routing
} // namespace kernel