Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Put the good Gflops of clusters.
[simgrid.git] / buildtools / Cmake / generate_g5k_platform.pl
1 #!/usr/bin/perl -w
2 use strict;
3 use Switch;
4 my $toversion=3;
5
6 if($#ARGV!=1) {
7     die "Usage: ./generate_g5k_platform.pl g5k_username g5k_password\n";
8 }
9
10 print "<?xml version='1.0'?>\n";
11 print "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid.dtd\">\n";
12 print "<platform version=\"$toversion\">\n";
13 print "\t<AS id=\"AS_grid5000\" routing=\"Floyd\" >\n";
14
15 `rm -rf temp_g5k`;
16 `mkdir -p temp_g5k`;
17 chdir("./temp_g5k");
18 `wget https://api.grid5000.fr/2.0/grid5000/sites --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`;
19
20 open SITES_LIGNE, 'sites' or die "Unable to open sites $!\n";
21 my $line = "";
22 my $site = "";
23 my $cluster = "";
24 my $nodes = "";
25 my @AS_route = ();
26
27 print "\t\t<AS id=\"AS_interne\" routing=\"Floyd\">\n";
28 printf "\t\t\t<router id=\"lille\"/>\n";
29 printf "\t\t\t<router id=\"paris\"/>\n";
30 printf "\t\t\t<router id=\"nancy\"/>\n";
31 printf "\t\t\t<router id=\"rennes\"/>\n";
32 printf "\t\t\t<router id=\"lyon\"/>\n";
33 printf "\t\t\t<router id=\"bordeaux\"/>\n";
34 printf "\t\t\t<router id=\"grenoble\"/>\n";
35 printf "\t\t\t<router id=\"marseille\"/>\n";
36 printf "\t\t\t<router id=\"toulouse\"/>\n";
37 printf "\t\t\t<router id=\"sophia\"/>\n";
38 #printf "\t\t\t<router id=\"luxembourg\">\n";
39 print "\n";
40 printf "\t\t\t<link id=\"Lille_Paris\"        bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
41 printf "\t\t\t<link id=\"Paris_Nancy\"        bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
42 printf "\t\t\t<link id=\"Paris_Rennes\"       bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
43 printf "\t\t\t<link id=\"Paris_Lyon\"         bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
44 printf "\t\t\t<link id=\"Bordeaux_Lyon\"      bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
45 printf "\t\t\t<link id=\"Lyon_Grenoble\"      bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
46 printf "\t\t\t<link id=\"Lyon_Marseille\"     bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
47 printf "\t\t\t<link id=\"Marseille_Sophia\"   bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
48 printf "\t\t\t<link id=\"Marseille_Toulouse\" bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
49 #printf "\t\t<link id=\"Luxemburg_Nancy\"    bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
50 print "\n";
51
52 print "\t\t<route src=\"lille\"     dst=\"paris\"     ><link_ctn id=\"Lille_Paris\"/></route>\n";
53 print "\t\t<route src=\"paris\"     dst=\"nancy\"     ><link_ctn id=\"Paris_Nancy\"/></route>\n";
54 print "\t\t<route src=\"paris\"     dst=\"rennes\"    ><link_ctn id=\"Paris_Rennes\"/></route>\n";
55 print "\t\t<route src=\"paris\"     dst=\"lyon\"      ><link_ctn id=\"Paris_Lyon\"/></route>\n";
56 print "\t\t<route src=\"bordeaux\"  dst=\"lyon\"      ><link_ctn id=\"Bordeaux_Lyon\"/></route>\n";
57 print "\t\t<route src=\"lyon\"      dst=\"grenoble\"  ><link_ctn id=\"Lyon_Grenoble\"/></route>\n";
58 print "\t\t<route src=\"lyon\"      dst=\"marseille\" ><link_ctn id=\"Lyon_Marseille\"/></route>\n";
59 print "\t\t<route src=\"marseille\" dst=\"sophia\"    ><link_ctn id=\"Marseille_Sophia\"/></route>\n";
60 print "\t\t<route src=\"marseille\" dst=\"toulouse\"  ><link_ctn id=\"Marseille_Toulouse\"/></route>\n";
61 #print "\t\t<route src=\"Luxemburg\" dst=\"Nancy\"     ><link_ctn id=\"Luxemburg_Nancy\"/></route>\n";
62 print "\t\t</AS>\n";    
63
64 while(defined($line=<SITES_LIGNE>))
65 {
66         if($line =~ /"uid": "(.*)",/){
67                 $site = $1;
68                 print "\t\t<AS id=\"AS_$site\" routing=\"RuleBased\" >\n";
69                 `wget https://api.grid5000.fr/2.0/grid5000/sites/$site/clusters --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`;
70                 open CLUSTERS_LIGNE, 'clusters' or die "Unable to open clusters $!\n";
71                 while(defined($line=<CLUSTERS_LIGNE>))
72                 {
73                         if($line =~ /"uid": "(.*)",/){
74                                 $cluster = $1;
75                                 print "\t\t\t<cluster id=\"AS_$cluster\" prefix=\"$cluster-\" suffix=\".$cluster.grid5000.fr\"\n";
76                                 `wget https://api.grid5000.fr/2.0/grid5000/sites/$site/clusters/$cluster/nodes --http-user="$ARGV[0]" --http-password="$ARGV[1]" --no-check-certificate --quiet`;
77                                 open NODES_LIGNE, 'nodes' or die "Unable to open nodes $!\n";
78                                 while(defined($line=<NODES_LIGNE>))
79                                 {
80                                         if($line =~ /"total": (.*),/){
81                                                 print "\t\t\t\tradical=\"1-$1\" power=\"";
82                                                 &get_gflops($cluster);
83                                                 print "\" bw=\"1.25E8\" lat=\"1.0E-4\""."\n";
84                                                 print "\t\t\t\tbb_bw=\"1.25E9\" bb_lat=\"1.0E-4\"></cluster>\n";
85                                         }
86                                 }
87                                 print "\t\t\t<link   id=\"link_$cluster\" bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n\n";
88                                 close NODES_LIGNE;
89                                 `rm nodes`;
90                         }
91                 }
92                 close CLUSTERS_LIGNE;
93                 `rm clusters`;
94                 
95                 print "\t\t\t<AS id=\"gw_AS_$site\" routing=\"Full\">\n";
96                 print "\t\t\t\t<router id=\"gw_$site\"/>\n";
97                 print "\t\t\t</AS>\n";
98                 print "\t\t\t<link   id=\"link_gw_$site\" bandwidth=\"1.25E9\" latency=\"1.0E-4\"/>\n";
99                 print "\n";
100                 
101                 print "\t\t\t<ASroute src=\"^AS_(.*)\$\" dst=\"^AS_(.*)\$\"\n";
102                 print "\t\t\t\tgw_src=\"\$1src-AS_\$1src_router.\$1src.grid5000.fr\"\n";
103                 print "\t\t\t\tgw_dst=\"\$1dst-AS_\$1dst_router.\$1dst.grid5000.fr\"\n";
104                 print "\t\t\t\tsymmetrical=\"YES\">\n";
105                 print "\t\t\t\t\t<link_ctn id=\"link_\$1src\"/>\n";
106                 print "\t\t\t\t\t<link_ctn id=\"link_\$1dst\"/>\n";
107                 print "\t\t\t</ASroute>\n\n"; 
108
109                 print "\t\t\t<ASroute src=\"^AS_(.*)\$\" dst=\"^gw_AS_(.*)\$\"\n";
110                 print "\t\t\t\tgw_src=\"\$1src-AS_\$1src_router.\$1src.grid5000.fr\"\n";
111                 print "\t\t\t\tgw_dst=\"gw_\$1dst\"\n";
112                 print "\t\t\t\tsymmetrical=\"NO\">\n";
113                 print "\t\t\t\t\t<link_ctn id=\"link_\$1src\"/>\n";
114                 print "\t\t\t</ASroute>\n\n"; 
115                 
116                 print "\t\t\t<ASroute src=\"^gw_AS_(.*)\$\" dst=\"^AS_(.*)\$\"\n";
117                 print "\t\t\t\tgw_src=\"gw_\$1src\"\n";
118                 print "\t\t\t\tgw_dst=\"\$1dst-AS_\$1dst_router.\$1dst.grid5000.fr\"\n";
119                 print "\t\t\t\tsymmetrical=\"NO\">\n";
120                 print "\t\t\t\t\t<link_ctn id=\"link_\$1dst\"/>\n";
121                 print "\t\t\t</ASroute>\n\n"; 
122                 
123                 print "\t\t</AS>\n";
124                 
125                 push @AS_route, $site;
126         }
127 }
128
129 while(@AS_route)
130 {
131         $site = pop @AS_route;
132         print "\t\t<ASroute src=\"AS_$site\" dst=\"AS_interne\" gw_src=\"gw_$site\"";
133         if( $site =~ /^orsay$/ )
134         {
135                 print " gw_dst=\"paris\"";
136         }
137         else
138         {
139                 print " gw_dst=\"$site\"";
140         }
141         print " symmetrical=\"YES\">\n";
142         print "\t\t\t<link_ctn id=\"link_gw_$site\"/>\n";
143         print "\t\t</ASroute>\n";
144         
145 #       print "\t\t<ASroute src=\"AS_interne\" dst=\"AS_$site\" gw_dst=\"gw_$site\"";
146 #       if( $site =~ /^orsay$/ )
147 #       {
148 #               print " gw_src=\"paris\"";
149 #       }
150 #       else
151 #       {
152 #               print " gw_src=\"$site\"";
153 #       }
154 #       print " symmetrical=\"NO\">\n";
155 #       print "\t\t\t<link_ctn id=\"link_gw_$site\"/>\n";
156 #       print "\t\t</ASroute>\n";
157 }
158
159 print "\t</AS>\n";
160 print "</platform>\n";
161 `rm sites`;
162 close SITES_LIGNE;
163
164
165 sub get_gflops {
166         switch ($_[0]) {
167                 case "bordeplage" { print "5.2297E9" }
168                 case "bordereau"  { print "8.8925E9" }
169                 case "borderline" { print "13.357E9" }
170                 
171                 case "chicon"     { print "8.9618E9" }
172                 case "chimint"    { print "23.531E9" }
173                 case "chinqchint" { print "22.270E9" }
174                 case "chirloute"  { print "24.473E9" }
175                 
176                 case "adonis"     { print "23.681E9" }
177                 case "edel"       { print "23.492E9" }
178                 case "genepi"     { print "21.175E9" }
179                 
180                 case "capricorne" { print "4.7233E9" }
181                 case "sagittaire" { print "5.6693E9" }
182                 
183                 case "graphene"   { print "16.673E9" }
184                 case "griffon"    { print "20.678E9" }
185                 
186                 case "gdx"        { print "4.7153E9" }
187                 case "netgdx"     { print "4.7144E9" }
188                 
189                 case "paradent"   { print "21.496E9" }
190                 case "paramount"  { print "12.910E9" }
191                 case "parapide"   { print "30.130E9" }
192                 case "parapluie"  { print "27.391E9" }
193                 
194                 case "helios"     { print "7.7318E9" }
195                 case "sol"        { print "8.9388E9" }
196                 case "suno"       { print "23.530E9" }
197                 
198                 case "pastel"     { print "9.5674E9" }
199                 case "violette"   { print "5.1143E9" }
200                 
201                 case "default"    {     print "3.542E9" }
202                 else                      {     print "xxxxxxx" }
203         }
204 }