Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
32215a9ef787cee6079caba4a85cd1cb87f5247f
[simgrid.git] / examples / msg / masterslave / platform_script.lua
1 -- Copyright (c) 2010-2012. The SimGrid Team. All rights reserved.
2
3 -- This program is free software; you can redistribute it and/or modify it
4 --under the terms of the license (GNU LGPL) which comes with this package.
5
6
7 -- This file describes a platform very similar to the small_platform.xml, but in lua
8 -- It is naturally to be used with the MSG_load_platform_script function
9
10 -- Of course, such a flat file is maybe not very interesting wrt xml.
11 -- The full power of lua reveals when you describe your platform programatically. 
12
13 require "simgrid"
14
15   simgrid.AS.new{id="AS0",mode="Full"}; 
16
17   simgrid.AS.addHost{AS="AS0",id="Tremblay",power=98095000};
18   simgrid.AS.addHost{AS="AS0",id="Jupiter",power=76296000};
19   simgrid.AS.addHost{AS="AS0",id="Fafard",power=76296000};
20   simgrid.AS.addHost{AS="AS0",id="Ginette",power=48492000};
21   simgrid.AS.addHost{AS="AS0",id="Bourassa",power=48492000};
22
23     -- create Links
24   for i=10,0,-1 do
25     simgrid.AS.addLink{AS="AS0",id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087};   
26   end
27   -- simgrid.route.new(src_id,des_id,links_nb,links_list)
28    simgrid.AS.addRoute("AS0","Tremblay","Jupiter",{"1"});
29    simgrid.AS.addRoute("AS0","Tremblay","Fafard",{"0","1","2","3","4","8"});
30    simgrid.AS.addRoute("AS0","Tremblay","Ginette",{"3","4","5"});
31    simgrid.AS.addRoute("AS0","Tremblay","Bourassa",{"0","1","3","2","4","6","7"});
32
33    simgrid.AS.addRoute("AS0","Jupiter","Tremblay",{"1"});
34    simgrid.AS.addRoute("AS0","Jupiter","Fafard",{"0","1","2","3","4","8","9"});
35    simgrid.AS.addRoute("AS0","Jupiter","Ginette",{"3","4","5","9"});
36    simgrid.AS.addRoute("AS0","Jupiter","Bourassa",{"0","1","2","3","4","6","7","9"});
37  
38    simgrid.AS.addRoute("AS0","Fafard","Tremblay",{"0","1","2","3","4","8"});
39    simgrid.AS.addRoute("AS0","Fafard","Jupiter",{"0","1","2","3","4","8","9"});
40    simgrid.AS.addRoute("AS0","Fafard","Ginette",{"0","1","2","5","8"});
41    simgrid.AS.addRoute("AS0","Fafard","Bourassa",{"6","7","8"});
42   
43    simgrid.AS.addRoute("AS0","Ginette","Tremblay",{"3","4","5"});
44    simgrid.AS.addRoute("AS0","Ginette","Jupiter",{"3","4","5","9"});
45    simgrid.AS.addRoute("AS0","Ginette","Fafard",{"0","1","2","5","8"});
46    simgrid.AS.addRoute("AS0","Ginette","Bourassa",{"0","1","2","5","6","7"});
47
48    simgrid.AS.addRoute("AS0","Bourassa","Tremblay",{"0","1","3","2","4","6","7"});
49    simgrid.AS.addRoute("AS0","Bourassa","Jupiter",{"0","1","2","3","4","6","7","9"});
50    simgrid.AS.addRoute("AS0","Bourassa","Fafard",{"6","7","8"});
51    simgrid.AS.addRoute("AS0","Bourassa","Ginette",{"0","1","2","5","6","7"});
52   
53    --Save Platform
54    simgrid.msg_register_platform();
55
56   --Set Application
57    simgrid.host.set_function{host="Tremblay",fct="master",args="20,550000000,1000000,4"};
58    simgrid.host.set_function{host="Bourassa",fct="slave",args="0"};
59    simgrid.host.set_function{host="Jupiter",fct="slave",args="1"};
60    simgrid.host.set_function{host="Fafard",fct="slave",args="2"};
61    simgrid.host.set_function{host="Ginette",fct="slave",args="3"};
62    
63   --Save Application 
64    simgrid.msg_register_application(); 
65
66