From: Martin Quinson Date: Mon, 29 Feb 2016 09:42:23 +0000 (+0100) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3_13~632 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/22c24872823416f2c55eb40d1216e4c5601332d3?hp=085e04235ab064182e828e2d25f389b64d81dc12 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c2cd7594ff..fd5fe393de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -740,6 +740,8 @@ else() message(FATAL_ERROR "Could not figure out the stack direction. Test prog returned: ${stack}; CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}.") endif() endif() +# If the test ran well, remove the test binary +execute_process(COMMAND ${CMAKE_COMMAND} -E remove test_stackgrowth) ############### ## System checks diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 1ef547b3c5..10e404db81 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -342,8 +342,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) if (current_routing->hierarchy_ == SURF_ROUTING_NULL) current_routing->hierarchy_ = SURF_ROUTING_RECURSIVE; /* add to the sons dictionary */ - xbt_dict_set(current_routing->sons_, AS->id, - (void *) new_as, NULL); + xbt_dict_set(current_routing->sons_, AS->id, (void *) new_as, NULL); /* add to the father element list */ netcard->setId(current_routing->addComponent(netcard)); } else { @@ -366,11 +365,6 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) * * Once you've declared all the content of your AS, you have to close * it with this call. Your AS is not usable until you call this function. - * - * @fixme: this call is not as robust as wanted: bad things WILL happen - * if you call it twice for the same AS, or if you forget calling it, or - * even if you add stuff to a closed AS - * */ void routing_AS_end() { @@ -379,8 +373,6 @@ void routing_AS_end() current_routing = current_routing->father_; } -/* Aux Business methods */ - /** * \brief Get the AS father and the first elements of the chain * @@ -391,9 +383,7 @@ void routing_AS_end() * father in the chain */ static void elements_father(sg_netcard_t src, sg_netcard_t dst, - AS_t * res_father, - AS_t * res_src, - AS_t * res_dst) + AS_t * res_father, AS_t * res_src, AS_t * res_dst) { xbt_assert(src && dst, "bad parameters for \"elements_father\" method"); #define ROUTING_HIERARCHY_MAXDEPTH 16 /* increase if it is not enough */ @@ -727,126 +717,6 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) free(link_down); } -// static void routing_parse_Srandom(void) -// { -// double mean, std, min, max, seed; -// char *random_id = A_surfxml_random_id; -// char *random_radical = A_surfxml_random_radical; -// char *rd_name = NULL; -// char *rd_value; -// mean = surf_parse_get_double(A_surfxml_random_mean); -// std = surf_parse_get_double(A_surfxml_random_std___deviation); -// min = surf_parse_get_double(A_surfxml_random_min); -// max = surf_parse_get_double(A_surfxml_random_max); -// seed = surf_parse_get_double(A_surfxml_random_seed); - -// double res = 0; -// int i = 0; -// random_data_t random = xbt_new0(s_random_data_t, 1); -// char *tmpbuf; - -// xbt_dynar_t radical_elements; -// unsigned int iter; -// char *groups; -// int start, end; -// xbt_dynar_t radical_ends; - -// switch (A_surfxml_random_generator) { -// case AU_surfxml_random_generator: -// case A_surfxml_random_generator_NONE: -// random->generator = NONE; -// break; -// case A_surfxml_random_generator_DRAND48: -// random->generator = DRAND48; -// break; -// case A_surfxml_random_generator_RAND: -// random->generator = RAND; -// break; -// case A_surfxml_random_generator_RNGSTREAM: -// random->generator = RNGSTREAM; -// break; -// default: -// surf_parse_error("Invalid random generator"); -// break; -// } -// random->seed = seed; -// random->min = min; -// random->max = max; - -// /* Check user stupidities */ -// if (max < min) -// THROWF(arg_error, 0, "random->max < random->min (%f < %f)", max, min); -// if (mean < min) -// THROWF(arg_error, 0, "random->mean < random->min (%f < %f)", mean, min); -// if (mean > max) -// THROWF(arg_error, 0, "random->mean > random->max (%f > %f)", mean, max); - -// /* normalize the mean and standard deviation before storing */ -// random->mean = (mean - min) / (max - min); -// random->std = std / (max - min); - -// if (random->mean * (1 - random->mean) < random->std * random->std) -// THROWF(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", -// random->mean, random->std); - -// XBT_DEBUG -// ("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'", -// random_id, random->min, random->max, random->mean, random->std, -// (int)random->generator, random->seed, random_radical); - -// if (!random_value) -// random_value = xbt_dict_new_homogeneous(free); - -// if (!strcmp(random_radical, "")) { -// res = random_generate(random); -// rd_value = bprintf("%f", res); -// xbt_dict_set(random_value, random_id, rd_value, NULL); -// } else { -// radical_elements = xbt_str_split(random_radical, ","); -// xbt_dynar_foreach(radical_elements, iter, groups) { -// radical_ends = xbt_str_split(groups, "-"); -// switch (xbt_dynar_length(radical_ends)) { -// case 1: -// xbt_assert(!xbt_dict_get_or_null(random_value, random_id), -// "Custom Random '%s' already exists !", random_id); -// res = random_generate(random); -// tmpbuf = -// bprintf("%s%d", random_id, -// atoi(xbt_dynar_getfirst_as(radical_ends, char *))); -// xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL); -// xbt_free(tmpbuf); -// break; - -// case 2: -// start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *)); -// end = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 1, char *)); -// for (i = start; i <= end; i++) { -// xbt_assert(!xbt_dict_get_or_null(random_value, random_id), -// "Custom Random '%s' already exists !", bprintf("%s%d", -// random_id, -// i)); -// res = random_generate(random); -// tmpbuf = bprintf("%s%d", random_id, i); -// xbt_dict_set(random_value, tmpbuf, bprintf("%f", res), NULL); -// xbt_free(tmpbuf); -// } -// break; -// default: -// XBT_CRITICAL("Malformed radical"); -// break; -// } -// res = random_generate(random); -// rd_name = bprintf("%s_router", random_id); -// rd_value = bprintf("%f", res); -// xbt_dict_set(random_value, rd_name, rd_value, NULL); - -// xbt_dynar_free(&radical_ends); -// } -// free(rd_name); -// xbt_dynar_free(&radical_elements); -// } -// } - static void check_disk_attachment() { xbt_lib_cursor_t cursor; @@ -904,7 +774,6 @@ namespace surf { } RoutingPlatf::~RoutingPlatf() { - xbt_dynar_free(&lastRoute_); finalize_rec(root_); } @@ -919,8 +788,7 @@ const char *surf_AS_get_name(simgrid::surf::As *as) { return as->name_; } -static simgrid::surf::As *surf_AS_recursive_get_by_name( - simgrid::surf::As *current, const char * name) +static simgrid::surf::As *surf_AS_recursive_get_by_name(simgrid::surf::As *current, const char * name) { xbt_dict_cursor_t cursor = NULL; char *key; diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 07afc8d76e..c64d677cb2 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -140,7 +140,7 @@ private: }; /** @ingroup SURF_routing_interface - * @brief Link of lenght 1, alongside with its source and destination. This is mainly usefull in the ns3 bindings + * @brief Link of length 1, alongside with its source and destination. This is mainly useful in the ns3 bindings */ class Onelink { public: @@ -160,7 +160,6 @@ public: ~RoutingPlatf(); As *root_ = nullptr; Link *loopback_; - xbt_dynar_t lastRoute_ = xbt_dynar_new(sizeof(Link*),NULL); xbt_dynar_t getOneLinkRoutes(void); void getRouteAndLatency(NetCard *src, NetCard *dst, std::vector * links, double *latency); }; diff --git a/src/surf/surf_routing_RoutedGraph.cpp b/src/surf/surf_routing_RoutedGraph.cpp index 5c00da327b..cd85779534 100644 --- a/src/surf/surf_routing_RoutedGraph.cpp +++ b/src/surf/surf_routing_RoutedGraph.cpp @@ -91,6 +91,36 @@ xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt namespace simgrid { namespace surf { + xbt_dynar_t AsRoutedGraph::getOneLinkRoutes() + { + xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f); + sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1); + route->link_list = new std::vector(); + + int table_size = (int)xbt_dynar_length(vertices_); + for(int src=0; src < table_size; src++) { + for(int dst=0; dst< table_size; dst++) { + route->link_list->clear(); + NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*); + NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*); + this->getRouteAndLatency(src_elm, dst_elm,route, NULL); + + if (route->link_list->size() == 1) { + Link *link = route->link_list->at(0); + Onelink *onelink; + if (hierarchy_ == SURF_ROUTING_BASE) + onelink = new Onelink(link, src_elm, dst_elm); + else if (hierarchy_ == SURF_ROUTING_RECURSIVE) + onelink = new Onelink(link, route->gw_src, route->gw_dst); + else + onelink = new Onelink(link, NULL, NULL); + xbt_dynar_push(ret, &onelink); + } + } + } + return ret; + } + void AsRoutedGraph::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) { int src, dst; diff --git a/src/surf/surf_routing_RoutedGraph.hpp b/src/surf/surf_routing_RoutedGraph.hpp index 9d5c7db726..5a2feac181 100644 --- a/src/surf/surf_routing_RoutedGraph.hpp +++ b/src/surf/surf_routing_RoutedGraph.hpp @@ -21,6 +21,8 @@ public: AsRoutedGraph(const char*name); ~AsRoutedGraph(); + xbt_dynar_t getOneLinkRoutes() override; + virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order); protected: diff --git a/src/surf/surf_routing_dijkstra.cpp b/src/surf/surf_routing_dijkstra.cpp index fcaac996a2..1c5c486962 100644 --- a/src/surf/surf_routing_dijkstra.cpp +++ b/src/surf/surf_routing_dijkstra.cpp @@ -138,36 +138,6 @@ void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route xbt_graph_new_edge(routeGraph_, src, dst, e_route); } -xbt_dynar_t AsDijkstra::getOneLinkRoutes() -{ - xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f); - sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1); - route->link_list = new std::vector(); - - int table_size = (int)xbt_dynar_length(vertices_); - for(int src=0; src < table_size; src++) { - for(int dst=0; dst< table_size; dst++) { - route->link_list->clear(); - NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*); - NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*); - this->getRouteAndLatency(src_elm, dst_elm,route, NULL); - - if (route->link_list->size() == 1) { - Link *link = route->link_list->at(0); - Onelink *onelink; - if (hierarchy_ == SURF_ROUTING_BASE) - onelink = new Onelink(link, src_elm, dst_elm); - else if (hierarchy_ == SURF_ROUTING_RECURSIVE) - onelink = new Onelink(link, route->gw_src, route->gw_dst); - else - onelink = new Onelink(link, NULL, NULL); - xbt_dynar_push(ret, &onelink); - } - } - } - return ret; -} - void AsDijkstra::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) { getRouteCheckParams(src, dst); diff --git a/src/surf/surf_routing_dijkstra.hpp b/src/surf/surf_routing_dijkstra.hpp index ae5e000bfc..849c682382 100644 --- a/src/surf/surf_routing_dijkstra.hpp +++ b/src/surf/surf_routing_dijkstra.hpp @@ -57,8 +57,6 @@ public: * will have a loopback attached to it. */ void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) override; - void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat); // FIXME: this function is dangerously not overriding because of diverging prototype - xbt_dynar_t getOneLinkRoutes() override; void addRoute(sg_platf_route_cbarg_t route) override; xbt_graph_t routeGraph_ = nullptr; /* xbt_graph */ diff --git a/src/surf/surf_routing_floyd.cpp b/src/surf/surf_routing_floyd.cpp index c902ac3844..5bfe3df28c 100644 --- a/src/surf/surf_routing_floyd.cpp +++ b/src/surf/surf_routing_floyd.cpp @@ -39,41 +39,8 @@ AsFloyd::~AsFloyd(){ xbt_free(costTable_); } -/* Business methods */ -xbt_dynar_t AsFloyd::getOneLinkRoutes() -{ - xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f); - sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1); - route->link_list = new std::vector(); - - int table_size = xbt_dynar_length(vertices_); - for(int src=0; src < table_size; src++) { - for(int dst=0; dst< table_size; dst++) { - route->link_list->clear(); - NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*); - NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*); - this->getRouteAndLatency(src_elm, dst_elm, route, NULL); - - if (route->link_list->size() == 1) { - void *link = route->link_list->at(0); - Onelink *onelink; - if (hierarchy_ == SURF_ROUTING_BASE) - onelink = new Onelink(link, src_elm, dst_elm); - else if (hierarchy_ == SURF_ROUTING_RECURSIVE) - onelink = new Onelink(link, route->gw_src, route->gw_dst); - else - onelink = new Onelink(link, NULL, NULL); - xbt_dynar_push(ret, &onelink); - } - } - } - - return ret; -} - void AsFloyd::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) { - size_t table_size = xbt_dynar_length(vertices_); getRouteCheckParams(src, dst); diff --git a/src/surf/surf_routing_floyd.hpp b/src/surf/surf_routing_floyd.hpp index 67f1f6da96..e5258f83bd 100644 --- a/src/surf/surf_routing_floyd.hpp +++ b/src/surf/surf_routing_floyd.hpp @@ -27,7 +27,6 @@ public: ~AsFloyd(); void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; - xbt_dynar_t getOneLinkRoutes() override; void addRoute(sg_platf_route_cbarg_t route) override; void Seal() override; diff --git a/src/surf/surf_routing_full.cpp b/src/surf/surf_routing_full.cpp index 7d52469d64..1180fe0e79 100644 --- a/src/surf/surf_routing_full.cpp +++ b/src/surf/surf_routing_full.cpp @@ -61,48 +61,10 @@ AsFull::~AsFull(){ } } -xbt_dynar_t AsFull::getOneLinkRoutes() -{ - xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f); - - int src, dst; - int table_size = xbt_dynar_length(vertices_); - - for(src=0; src < table_size; src++) { - for(dst=0; dst< table_size; dst++) { - sg_platf_route_cbarg_t route = TO_ROUTE_FULL(src,dst); - if (route) { - if (route->link_list->size() == 1) { - Link *link = route->link_list->at(0); - Onelink *onelink; - if (hierarchy_ == SURF_ROUTING_BASE) { - NetCard *tmp_src = xbt_dynar_get_as(vertices_, src, sg_netcard_t); - tmp_src->setId(src); - NetCard *tmp_dst = xbt_dynar_get_as(vertices_, dst, sg_netcard_t); - tmp_dst->setId(dst); - onelink = new Onelink(link, tmp_src, tmp_dst); - } else if (hierarchy_ == SURF_ROUTING_RECURSIVE) - onelink = new Onelink(link, route->gw_src, route->gw_dst); - else - onelink = new Onelink(link, NULL, NULL); - xbt_dynar_push(ret, &onelink); - XBT_DEBUG("Push route from '%d' to '%d'", - src, - dst); - } - } - } - } - return ret; -} - void AsFull::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t res, double *lat) { XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]", - src->name(), - src->id(), - dst->name(), - dst->id()); + src->name(), src->id(), dst->name(), dst->id()); /* set utils vars */ size_t table_size = xbt_dynar_length(vertices_); diff --git a/src/surf/surf_routing_full.hpp b/src/surf/surf_routing_full.hpp index 30dd1cbefd..0abbae3fa7 100644 --- a/src/surf/surf_routing_full.hpp +++ b/src/surf/surf_routing_full.hpp @@ -28,7 +28,6 @@ public: ~AsFull(); void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; - xbt_dynar_t getOneLinkRoutes() override; void addRoute(sg_platf_route_cbarg_t route) override; sg_platf_route_cbarg_t *routingTable_ = nullptr; diff --git a/src/surf/surf_routing_vivaldi.hpp b/src/surf/surf_routing_vivaldi.hpp index 3ab9c59658..3795d69681 100644 --- a/src/surf/surf_routing_vivaldi.hpp +++ b/src/surf/surf_routing_vivaldi.hpp @@ -28,6 +28,7 @@ public: AsVivaldi(const char *name); ~AsVivaldi() {}; + xbt_dynar_t getOneLinkRoutes() override {return NULL;}; void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; };