Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix lua deploy
authorPaul Bédaride <paul.bedaride@gmail.com>
Tue, 8 Jan 2013 16:06:36 +0000 (17:06 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Tue, 8 Jan 2013 16:08:03 +0000 (17:08 +0100)
examples/lua/console/deploy.lua
examples/lua/console/master_slave_bypass.lua
examples/lua/console/platform.lua
examples/lua/console/slave.lua
examples/lua/masterslave/master_slave.lua
include/simgrid/simix.h
src/bindings/lua/lua_platf.c
src/bindings/lua/simgrid_lua.c
src/simix/smx_deployment.c

index 26e34fc..5d46da3 100644 (file)
@@ -1,11 +1,10 @@
  dofile 'master.lua'
  dofile 'slave.lua' 
+
+  simgrid.init_application();
   --Set Application
    simgrid.host.set_function{host="Tremblay",fct="Master",args="20,550000000,1000000,4"};
-   simgrid.host.set_function{host="Bourassa",fct="Slave",args="0"};
    simgrid.host.set_function{host="Jupiter",fct="Slave",args="1"};
    simgrid.host.set_function{host="Fafard",fct="Slave",args="2"};
    simgrid.host.set_function{host="Ginette",fct="Slave",args="3"};
-   
-  --Save Application 
-   simgrid.msg_register_application();
+   simgrid.host.set_function{host="Bourassa",fct="Slave",args="0"};   
index 3f3fd9c..55a79d5 100644 (file)
@@ -1,10 +1,8 @@
 require "simgrid"
 dofile 'platform.lua'
---dofile 'deploy.lua'
+dofile 'deploy.lua'
 --Rutform.lua'
 dofile 'master.lua'
 dofile 'slave.lua'
-   --dofile 'deploy.lua'
-   simgrid.application("deployb.xml")
    simgrid.run()
    simgrid.info("Simulation's over.See you.")
index 60e66b9..6e0f88b 100644 (file)
@@ -15,31 +15,31 @@ for i=10,0,-1 do
     simgrid.platf.link_new{id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087};  
 end
 
-simgrid.platf.route_new{src="Tremblay",dest="Jupiter",links="1",symmetrical=0};
-simgrid.platf.route_new{src="Tremblay",dest="Fafard",links="0,1,2,3,4,8",symmetrical=0};
-simgrid.platf.route_new{src="Tremblay",dest="Ginette",links="3,4,5",symmetrical=0};
-simgrid.platf.route_new{src="Tremblay",dest="Bourassa",links="0,1,3,2,4,6,7",symmetrical=0};
-
-simgrid.platf.route_new{src="Jupiter",dest="Tremblay",links="1",symmetrical=0};
-simgrid.platf.route_new{src="Jupiter",dest="Fafard",links="0,1,2,3,4,8,9",symmetrical=0};
-simgrid.platf.route_new{src="Jupiter",dest="Ginette",links="3,4,5,9",symmetrical=0};
-simgrid.platf.route_new{src="Jupiter",dest="Bourassa",links="0,1,2,3,4,6,7,9",symmetrical=0};
+simgrid.platf.route_new{src="Tremblay",dest="Jupiter",links="1"};
+simgrid.platf.route_new{src="Tremblay",dest="Fafard",links="0,1,2,3,4,8"};
+simgrid.platf.route_new{src="Tremblay",dest="Ginette",links="3,4,5"};
+simgrid.platf.route_new{src="Tremblay",dest="Bourassa",links="0,1,3,2,4,6,7"};
+
+simgrid.platf.route_new{src="Jupiter",dest="Tremblay",links="1"};
+simgrid.platf.route_new{src="Jupiter",dest="Fafard",links="0,1,2,3,4,8,9"};
+simgrid.platf.route_new{src="Jupiter",dest="Ginette",links="3,4,5,9"};
+simgrid.platf.route_new{src="Jupiter",dest="Bourassa",links="0,1,2,3,4,6,7,9"};
  
-simgrid.platf.route_new{src="Fafard",dest="Tremblay",links="0,1,2,3,4,8",symmetrical=0};
-simgrid.platf.route_new{src="Fafard",dest="Jupiter",links="0,1,2,3,4,8,9",symmetrical=0};
-simgrid.platf.route_new{src="Fafard",dest="Ginette",links="0,1,2,5,8",symmetrical=0};
-simgrid.platf.route_new{src="Fafard",dest="Bourassa",links="6,7,8",symmetrical=0};
+simgrid.platf.route_new{src="Fafard",dest="Tremblay",links="0,1,2,3,4,8"};
+simgrid.platf.route_new{src="Fafard",dest="Jupiter",links="0,1,2,3,4,8,9"};
+simgrid.platf.route_new{src="Fafard",dest="Ginette",links="0,1,2,5,8"};
+simgrid.platf.route_new{src="Fafard",dest="Bourassa",links="6,7,8"};
   
-simgrid.platf.route_new{src="Ginette",dest="Tremblay",links="3,4,5",symmetrical=0};
-simgrid.platf.route_new{src="Ginette",dest="Jupiter",links="3,4,5,9",symmetrical=0};
-simgrid.platf.route_new{src="Ginette",dest="Fafard",links="0,1,2,5,8",symmetrical=0};
-simgrid.platf.route_new{src="Ginette",dest="Bourassa",links="0,1,2,5,6,7",symmetrical=0};
-
-simgrid.platf.route_new{src="Bourassa",dest="Tremblay",links="0,1,3,2,4,6,7",symmetrical=0};
-simgrid.platf.route_new{src="Bourassa",dest="Jupiter",links="0,1,2,3,4,6,7,9",symmetrical=0};
-simgrid.platf.route_new{src="Bourassa",dest="Fafard",links="6,7,8",symmetrical=0};
-simgrid.platf.route_new{src="Bourassa",dest="Ginette",links="0,1,2,5,6,7",symmetrical=0};
+simgrid.platf.route_new{src="Ginette",dest="Tremblay",links="3,4,5"};
+simgrid.platf.route_new{src="Ginette",dest="Jupiter",links="3,4,5,9"};
+simgrid.platf.route_new{src="Ginette",dest="Fafard",links="0,1,2,5,8"};
+simgrid.platf.route_new{src="Ginette",dest="Bourassa",links="0,1,2,5,6,7"};
+
+simgrid.platf.route_new{src="Bourassa",dest="Tremblay",links="0,1,3,2,4,6,7"};
+simgrid.platf.route_new{src="Bourassa",dest="Jupiter",links="0,1,2,3,4,6,7,9"};
+simgrid.platf.route_new{src="Bourassa",dest="Fafard",links="6,7,8"};
+simgrid.platf.route_new{src="Bourassa",dest="Ginette",links="0,1,2,5,6,7"};
 simgrid.platf.AS_close();
-   
+
 simgrid.platf.close();
   
index 2073530..816fbda 100644 (file)
@@ -15,14 +15,14 @@ function Slave(...)
     local task = simgrid.task.recv(my_mailbox);
     --print(task)
     local task_name = task:get_name()
-    if (task_name == "finalize") then
+    if (task:get_name() == "finalize") then
       simgrid.info("Slave '" .. my_mailbox .. "' got finalize msg");
       break
     end
     --local tk_name = simgrid.task.get_name(tk) 
-    simgrid.info("Slave '" .. my_mailbox .. "' processing " .. task_name)
+    simgrid.info("Slave '" .. my_mailbox .. "' processing " .. task:get_name())
     simgrid.task.execute(task)
-    simgrid.info("Slave '"  .. my_mailbox .. "': task " .. task_name .. " done")
+    simgrid.info("Slave '"  .. my_mailbox .. "': task " .. task:get_name() .. " done")
   end -- while
 
   simgrid.info("Slave '" .. my_mailbox .. "': I'm Done . See You !!");
index 984dba7..0e74608 100644 (file)
@@ -1,11 +1,11 @@
-dofile 'master.lua'
-dofile 'slave.lua'
+dofile '../console/master.lua'
+dofile '../console/slave.lua'
 -- Simulation Code ----------------------------------------------------------
 
 require "simgrid"
 
-simgrid.platform(arg[1] or "../../msg/small_platform.xml")
-simgrid.application(arg[2] or "../deploy.xml")
+simgrid.platform(arg[1])
+simgrid.application(arg[2])
 simgrid.run()
 simgrid.info("Simulation's over. See you.")
 -- end-of-master-slave
index 1faa39c..cdb0a2a 100644 (file)
@@ -246,7 +246,9 @@ XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
 XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
 XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC(xbt_main_func_t) SIMIX_get_registered_function(const char *name);
+XBT_PUBLIC(void) SIMIX_init_application(void);
 XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
+
 XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
                                             const char *process_function,
                                             xbt_dynar_t arguments,
index 7514c71..777a664 100644 (file)
@@ -41,9 +41,8 @@ static const luaL_reg platf_functions[] = {
 int console_open(lua_State *L) {
   sg_platf_init();
   sg_platf_begin();
-  surf_parse_init_callbacks();
-  
-  storage_register_callbacks();  
+
+  storage_register_callbacks();
   routing_register_callbacks();
 
   gpu_register_callbacks();
@@ -365,7 +364,7 @@ int console_set_function(lua_State *L) {
   //get args
   lua_pushstring(L,"args");
   lua_gettable(L, -2);
-  args = xbt_str_split_quoted( lua_tostring(L,-1) );
+  args = xbt_str_split_str( lua_tostring(L,-1) , ",");
   lua_pop(L, 1);
 
   // FIXME: hackish to go under MSG that way
@@ -375,6 +374,7 @@ int console_set_function(lua_State *L) {
     return -1;
   }
 
+  // FIXME: use sg_platf_new_process directly (warning: find a way to check hostname)
   MSG_set_function(host_id, function_id, args);
 
   return 0;
index 748a9bf..8c44001 100644 (file)
@@ -158,6 +158,13 @@ static int msg_register_application(lua_State * L)
   return 0;
 }
 
+static int console_init_application(lua_State *L) {
+  MSG_function_register_default(run_lua_code);
+  SIMIX_init_application();
+  return 0;
+}
+
+
 static const luaL_Reg simgrid_functions[] = {
   {"create_environment", create_environment},
   {"launch_application", launch_application},
@@ -172,6 +179,7 @@ static const luaL_Reg simgrid_functions[] = {
   {"msg_register_platform", msg_register_platform},
   {"sd_register_platform", sd_register_platform},
   {"msg_register_application", msg_register_application},
+  {"init_application", console_init_application},
   {NULL, NULL}
 };
 
index 5cb246b..766658e 100644 (file)
@@ -76,6 +76,11 @@ static void parse_process(sg_platf_process_cbarg_t process)
   current_property_set = NULL;
 }
 
+void SIMIX_init_application(void){
+  surf_parse_reset_callbacks();
+  sg_platf_process_add_cb(parse_process);
+}
+
 /**
  * \brief An application deployer.
  *
@@ -98,9 +103,7 @@ void SIMIX_launch_application(const char *file)
   xbt_assert(simix_global,
               "SIMIX_global_init has to be called before SIMIX_launch_application.");
 
-  surf_parse_reset_callbacks();
-
-  sg_platf_process_add_cb(parse_process);
+  SIMIX_init_application();
 
   surf_parse_open(file);
   TRY {