X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3c89e084af54896c9dcd71ab064bbfc08dfffb64..dad398b4437e937d222bafff987814b8f2d80409:/src/surf/surf_routing_cluster_torus.cpp diff --git a/src/surf/surf_routing_cluster_torus.cpp b/src/surf/surf_routing_cluster_torus.cpp index 52d0c35960..e09daf11d1 100644 --- a/src/surf/surf_routing_cluster_torus.cpp +++ b/src/surf/surf_routing_cluster_torus.cpp @@ -1,10 +1,11 @@ -/* Copyright (c) 2014. The SimGrid Team. +/* Copyright (c) 2014-2015. 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. */ -#include "surf_routing_cluster_torus.hpp" +#include "src/surf/surf_routing_private.hpp" +#include "src/surf/surf_routing_cluster_torus.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster_torus, surf_route_cluster, "Torus Routing part of surf"); @@ -25,9 +26,12 @@ inline unsigned int* rankId_to_coords(int rankId, xbt_dynar_t dimensions) { AS_t model_torus_cluster_create(void) { - return new AsClusterTorus(); + return new simgrid::surf::AsClusterTorus(); } +namespace simgrid { +namespace surf { + /* Creation routing model functions */ AsClusterTorus::AsClusterTorus() : AsCluster() { @@ -42,7 +46,7 @@ AsClusterTorus::~AsClusterTorus() 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; + s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER; char* link_id; unsigned int j = 0; /** @@ -59,26 +63,24 @@ void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int memset(&link, 0, sizeof(link)); current_dimension = xbt_dynar_get_as(p_dimensions, j, int); neighbour_rank_id = ( ((int) rank / dim_product) % current_dimension == current_dimension-1) ? rank - (current_dimension-1)*dim_product : rank + dim_product; - //name of neighbour is not right for non contiguous cluster radicals (as id != rank in this case) + //name of neighbor is not right for non contiguous cluster radicals (as id != rank in this case) link_id = bprintf("%s_link_from_%i_to_%i", cluster->id, id, neighbour_rank_id); link.id = link_id; link.bandwidth = cluster->bw; link.latency = cluster->lat; - link.state = SURF_RESOURCE_ON; + link.initiallyOn = 1; link.policy = cluster->sharing_policy; sg_platf_new_link(&link); s_surf_parsing_link_up_down_t info; if (link.policy == SURF_LINK_FULLDUPLEX) { char *tmp_link = bprintf("%s_UP", link_id); - info.link_up = - xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL); + info.link_up = Link::byName(tmp_link); free(tmp_link); tmp_link = bprintf("%s_DOWN", link_id); - info.link_down = - xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL); + info.link_down = Link::byName(tmp_link); free(tmp_link); } else { - info.link_up = xbt_lib_get_or_null(link_lib, link_id, SURF_LINK_LEVEL); + info.link_up = Link::byName(link_id); info.link_down = info.link_up; } /** @@ -120,7 +122,7 @@ void AsClusterTorus::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster){ xbt_dynar_free(&dimensions); } -void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat){ +void AsClusterTorus::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat){ XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]", src->getName(), src->getId(), @@ -133,7 +135,7 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_push_as(route->link_list, void *, info.link_up); if (lat) - *lat += static_cast(info.link_up)->getLatency(); + *lat += static_cast(info.link_up)->getLatency(); return; } @@ -222,12 +224,12 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_push_as(route->link_list,void*,info.link_down); if (lat) - *lat += static_cast(info.link_down)->getLatency(); + *lat += static_cast(info.link_down)->getLatency(); }else{ xbt_dynar_push_as(route->link_list,void*,info.link_up); if (lat) - *lat += static_cast(info.link_up)->getLatency(); + *lat += static_cast(info.link_up)->getLatency(); } current_node = next_node; next_node = 0; @@ -239,3 +241,6 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, return; } + +} +}