signal(SIGINT, inthandler);
#ifndef WIN32
- /* Install SEGV handler */
- install_segvhandler();
+ //install_segvhandler();
#endif
/* register a function to be called by SURF after the environment creation */
sg_platf_init();
xbt_dict_set(patterns, "suffix", xbt_strdup(cluster->suffix), NULL);
}
- /* parse the topology attribute. If we are not in a flat cluster,
- * switch to the right mode and initialize the routing with
- * the parameters in topo_parameters attribute
- */
+ /* Parse the topology attributes.
+ * Nothing to do in a vanilla cluster, but that's another story for torus and flat_trees */
s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER;
AS.id = cluster->id;
- if(cluster->topology == SURF_CLUSTER_TORUS){
+ switch (cluster->topology) {
+ case SURF_CLUSTER_TORUS:
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Torus_Cluster\">", cluster->id);
AS.routing = A_surfxml_AS_routing_Cluster___torus;
- sg_platf_new_AS_begin(&AS);
- ((AsClusterTorus*)current_routing)->parse_specific_arguments(cluster);
- }
- else if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
+ break;
+ case SURF_CLUSTER_FAT_TREE:
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Fat_Tree_Cluster\">", cluster->id);
AS.routing = A_surfxml_AS_routing_Cluster___fat___tree;
- sg_platf_new_AS_begin(&AS);
- ((AsClusterFatTree*)current_routing)->parse_specific_arguments(cluster);
- }
-
- else{
+ break;
+ default:
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Cluster\">", cluster->id);
AS.routing = A_surfxml_AS_routing_Cluster;
- sg_platf_new_AS_begin(&AS);
+ break;
}
+ sg_platf_new_AS_begin(&AS);
+ static_cast<AsCluster*>(current_routing)->parse_specific_arguments(cluster);
+
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
((AsCluster*)current_routing)->p_nb_links_per_node++;
((AsCluster*)current_routing)->p_has_loopback=1;
}
-
current_routing->p_linkUpDownList
= xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
int parsePU(NetCard *elm) override; /* A host or a router, whatever */
int parseAS(NetCard *elm) override;
virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
+ virtual void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) {}
Link* p_backbone = nullptr;
void *p_loopback = nullptr;
*
* It will also store the cluster for future use.
*/
- void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
+ void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
void addProcessingNode(int id);
void generateDotFile(const std::string& filename = "fatTree.dot") const;
namespace simgrid {
namespace surf {
-
- /* Creation routing model functions */
AsClusterTorus::AsClusterTorus():AsCluster() {
- p_dimensions = NULL;
+ }
+ AsClusterTorus::~AsClusterTorus() {
+ xbt_dynar_free(&p_dimensions);
}
- /* Creation routing model functions */ AsClusterTorus::~AsClusterTorus() {
- if (p_dimensions)
- xbt_dynar_free(&p_dimensions);
- } void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) {
+ void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) {
s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
char *link_id;
unsigned int j = 0;
class XBT_PRIVATE AsClusterTorus:public simgrid::surf::AsCluster {
public:
AsClusterTorus();
- virtual ~ AsClusterTorus();
- virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
- virtual void getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double *latency);
- void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
+ virtual ~AsClusterTorus();
+ void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
+ void getRouteAndLatency(NetCard * src, NetCard * dst, sg_platf_route_cbarg_t into, double *latency) override;
+ void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster) override;
xbt_dynar_t p_dimensions = NULL;
};
-}}
+ }}
#endif
As *AsGeneric::asExist(As *to_find)
{
- //return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
xbt_dict_cursor_t cursor = NULL;
char *key;
- int found = 0;
AsGeneric *elem;
- xbt_dict_foreach(p_routingSons, cursor, key, elem) {
- if (to_find == elem || elem->asExist(to_find)) {
- found = 1;
- break;
- }
- }
- if (found)
- return to_find;
+
+ xbt_dict_foreach(p_routingSons, cursor, key, elem)
+ if (to_find == elem || elem->asExist(to_find))
+ return to_find;
+
return NULL;
}
As *AsGeneric::autonomousSystemExist(char *element)
{
- //return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
As *element_as, *result, *elem;
xbt_dict_cursor_t cursor = NULL;
char *key;