From: Jean-Baptiste Hervé Date: Wed, 1 Aug 2012 12:16:06 +0000 (+0200) Subject: Platform generation : Add the Waxman topology algorithm X-Git-Tag: v3_8~231 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/95c9a282f17afba4b5a16f247981c2edaa604ccb Platform generation : Add the Waxman topology algorithm With this commit, all the topology algorithm found in Simulacrum are implemented. --- diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index b98a1e0e04..b1ce6c8cde 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -51,6 +51,7 @@ XBT_PUBLIC(void) platf_graph_interconnect_clique(void); XBT_PUBLIC(void) platf_graph_interconnect_uniform(double alpha); XBT_PUBLIC(void) platf_graph_interconnect_exponential(double alpha); XBT_PUBLIC(void) platf_graph_interconnect_zegura(double alpha, double beta, double r); +XBT_PUBLIC(void) platf_graph_interconnect_waxman(double alpha, double beta); XBT_PUBLIC(void) platf_graph_interconnect_barabasi(void); XBT_PUBLIC(void) platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters); diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index f4f933472d..0c98a6cbad 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -224,6 +224,31 @@ void platf_graph_interconnect_exponential(double alpha) { } } +void platf_graph_interconnect_waxman(double alpha, double beta) { + /* Create a topology where the probability follows the model of Waxman + * (see Waxman, Routing of Multipoint Connections, IEEE J. on Selected Areas in Comm., 1988) + * + * Number of edges increases with alpha + * edge length heterogeneity increases with beta + */ + xbt_dynar_t dynar_nodes = NULL; + xbt_node_t first_node = NULL; + xbt_node_t second_node = NULL; + unsigned int i,j; + double L = sqrt(2.0); /* L = c*sqrt(2); c=side of placement square */ + dynar_nodes = xbt_graph_get_nodes(platform_graph); + xbt_dynar_foreach(dynar_nodes, i, first_node) { + xbt_dynar_foreach(dynar_nodes, j, second_node) { + if(j>=i) + break; + double d = platf_node_distance(first_node, second_node); + if(RngStream_RandU01(rng_stream) < alpha*exp(-d/(L*beta))) { + platf_node_connect(first_node, second_node); + } + } + } +} + void platf_graph_interconnect_zegura(double alpha, double beta, double r) { /* Create a topology where the probability follows the model of Zegura * (see Zegura, Calvert, Donahoo, A quantitative comparison of graph-based models