Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix xmls for lua examples
authorPaul Bédaride <paul.bedaride@gmail.com>
Wed, 25 Jun 2014 09:58:51 +0000 (11:58 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Mon, 30 Jun 2014 09:28:14 +0000 (11:28 +0200)
examples/lua/bittorrent/bittorrent.lua
examples/lua/chord/chord.tesh
examples/lua/kademlia/kademlia.lua
examples/lua/masterslave/master_slave.tesh
examples/lua/multi_matrix/mult_matrix.lua
examples/lua/multi_matrix/mult_matrix.tesh
examples/lua/state_cloner/duplicated_globals.lua

index 6631d43..7be4395 100644 (file)
@@ -7,10 +7,10 @@
 -- A SimGrid Lua implementation of the Bittorrent protocol.
 
 require("simgrid")
-       
+
 require("peer")
 require("tracker")
 
-simgrid.platform(arg[1] or  "../../msg/msg_platform.xml")
+simgrid.platform(arg[1] or  "../../platforms/platform.xml")
 simgrid.application(arg[2] or "bittorrent.xml")
-simgrid.run()
\ No newline at end of file
+simgrid.run()
index f6ba517..0d8eb46 100644 (file)
@@ -1,4 +1,4 @@
-$ lua chord.lua ../../msg/msg_platform.xml ../../msg/chord/chord.xml
+$ lua chord.lua ../../platforms/platform.xml ../../msg/chord/chord.xml
 > [Gatien:node:(1) 0.000000] [lua/INFO] Joining the ring with id 48, knowing node 1
 > [Gatien:node:(1) 0.000000] [lua/INFO] Sending a 'find successor' request to 1 for id 48
 > [McGee:node:(2) 0.000000] [lua/INFO] Joining the ring with id 42, knowing node 1
index 3641824..01e5079 100644 (file)
@@ -23,7 +23,7 @@ common = {
        JOIN_BUCKETS_QUERIES = 5
 }
 require("tools")
--- Routing table 
+-- Routing table
 require("routing_table")
 
 data = {
@@ -33,12 +33,12 @@ data = {
        comm = nil,
        find_node_succedded = 0,
        find_node_failed = 0
-       
+
 }
 
-function node(...) 
+function node(...)
        local args = {...}
-       
+
        if #args ~= 2 and #args ~= 3 then
                simgrid.info("Wrong argument count: " .. #args)
                return
@@ -57,22 +57,22 @@ function node(...)
        else
                data.deadline = tonumber(args[2])
                routing_table_update(data.id)
-               data.comm = simgrid.task.irecv(data.mailbox)            
+               data.comm = simgrid.task.irecv(data.mailbox)
                main_loop()
        end
        simgrid.info(data.find_node_succedded .. "/" .. (data.find_node_succedded + data.find_node_failed) .. " FIND_NODE have succedded");
        simgrid.process.sleep(10000)
-end    
+end
 function main_loop()
        local next_lookup_time = simgrid.get_clock() + common.RANDOM_LOOKUP_INTERVAL
-       local now = simgrid.get_clock() 
+       local now = simgrid.get_clock()
        while now < data.deadline do
                task,err = data.comm:test()
                if task then
                        handle_task(task)
-                       data.comm = simgrid.task.irecv(data.mailbox)            
+                       data.comm = simgrid.task.irecv(data.mailbox)
                elseif err then
-                       data.comm = simgrid.task.irecv(data.mailbox)                            
+                       data.comm = simgrid.task.irecv(data.mailbox)
                else
                        if now >= next_lookup_time then
                                random_lookup()
@@ -91,20 +91,20 @@ end
 function join_network(id_known)
        local answer_got = false
        local time_begin = simgrid.get_clock()
-       
+
        simgrid.debug("Joining the network knowing " .. id_known)
-       
+
        routing_table_update(data.id)
        routing_table_update(id_known)
-       
+
        -- Send a FIND_NODE to the node we know
        send_find_node(id_known,data.id)
        -- Wait for the answer
        local trials = 0
-       
+
        data.comm = simgrid.task.irecv(data.mailbox)
-       
-       repeat 
+
+       repeat
                task,err = data.comm:test()
                if task then
                        if task.type == "FIND_NODE_ANSWER" then
@@ -115,10 +115,10 @@ function join_network(id_known)
                                        routing_table_update(v.id)
                                end
                        else
-                               handle_task(task)                               
+                               handle_task(task)
                        end
                        data.comm = simgrid.task.irecv(data.mailbox)
-               elseif err then 
+               elseif err then
                        data.comm = simgrid.task.irecv(data.mailbox)
                else
                        simgrid.process.sleep(1)
@@ -152,7 +152,7 @@ function find_node(destination, counts)
        local global_timeout = simgrid.get_clock() + common.FIND_NODE_GLOBAL_TIMEOUT
        -- Build a list of the closest nodes we already know.
        local node_list = find_closest(destination)
-       
+
        simgrid.debug("Doing a FIND_NODE on " .. destination)
        repeat
                answers = 0
@@ -172,13 +172,13 @@ function find_node(destination, counts)
                                else
                                        handle_task(task)
                                end
-                               data.comm = simgrid.task.irecv(data.mailbox)                    
+                               data.comm = simgrid.task.irecv(data.mailbox)
                        elseif err then
                                data.comm = simgrid.task.irecv(data.mailbox)
                        else
                                simgrid.process.sleep(1)
                        end
-                       
+
                until answers >= queries or simgrid.get_clock() >= timeout
                if (#node_list.nodes > 0) then
                        destination_found = (node_list.nodes[1].distance == 0)
@@ -203,14 +203,14 @@ end
 -- Sends a "FIND_NODE" request (task) to a node we know.
 function send_find_node(id, destination)
        simgrid.debug("Sending a FIND_NODE to " .. id .. " to find " .. destination);
-       
+
        local task = simgrid.task.new("",0, common.COMM_SIZE)
        task.type = "FIND_NODE"
        task.sender_id = data.id
        task.destination = destination
-               
+
        task:dsend(tostring(id))
-       
+
 end
 -- Sends a "FIND_NODE" request to the best "alpha" nodes in a node
 -- list
@@ -242,8 +242,8 @@ function handle_find_node(task)
        task_answer.sender_id = data.id
        task_answer.destination = task.destination
        task_answer.answer = answer
-       task_answer:dsend(tostring(task.sender_id))     
-end    
+       task_answer:dsend(tostring(task.sender_id))
+end
 function handle_ping(task)
        simgrid.info("Received a PING from " .. task.sender_id)
        local task_answer = simgrid.task.new("",0, common.COMM_SIZE)
@@ -260,6 +260,6 @@ function merge_answer(m1, m2)
        end
        return nb_added
 end
-simgrid.platform(arg[1] or  "../../msg/msg_platform.xml")
+simgrid.platform(arg[1] or  "../../platforms/platform.xml")
 simgrid.application(arg[2] or "kademlia.xml")
 simgrid.run()
index b32cfa9..9a140a6 100644 (file)
@@ -2,7 +2,7 @@
 
 # Later modify the commande and specify the platform and deployment path
 
-$ lua master_slave.lua ../../msg/small_platform.xml ../deploy.xml
+$ lua master_slave.lua ../../platforms/small_platform.xml ../deploy.xml
 > [Tremblay:Master:(1) 0.000000] [lua/INFO] Hello from lua, I'm the master
 > [Tremblay:Master:(1) 0.000000] [lua/INFO] Sending  'Task 1' to 'slave 1'
 > [Bourassa:Slave:(2) 0.000000] [lua/INFO] Hello from lua, I'm a poor slave with mailbox: slave 0
index a34a659..eb7d8e8 100644 (file)
@@ -8,7 +8,7 @@ dofile 'sender.lua'
 dofile 'receiver.lua'
 require "simgrid"
 
-simgrid.platform("../../platforms/platform.xml")
+simgrid.platform("../../platforms/small_platform.xml")
 simgrid.application("quicksort_deployment.xml")
 simgrid.run()
 simgrid.info("Simulation's over.See you.")
index bdd9869..1710a8c 100644 (file)
@@ -4,11 +4,11 @@
 
 ! output sort
 $ lua mult_matrix.lua "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:Sender@Inmos) Hello From Sender
-> [  0.000000] (1:Sender@Inmos) Argc=4 (should be 4)
-> [  0.000000] (1:Sender@Inmos) Sending matrix_task to Bellevue
-> [  0.000000] (2:Receiver@Bellevue) Hello From Receiver
-> [  0.000000] (2:Receiver@Bellevue) Receiving Task from Inmos
+> [  0.000000] (1:Sender@Tremblay) Hello From Sender
+> [  0.000000] (1:Sender@Tremblay) Argc=4 (should be 4)
+> [  0.000000] (1:Sender@Tremblay) Sending matrix_task to Jupiter
+> [  0.000000] (2:Receiver@Jupiter) Hello From Receiver
+> [  0.000000] (2:Receiver@Jupiter) Receiving Task from Tremblay
+> [  0.034028] (2:Receiver@Jupiter) Calcul is done ... Bye
+> [  0.034028] (1:Sender@Tremblay) Got the Multiplication result ...Bye
 > [  0.034028] (0:@) Simulation's over.See you.
-> [  0.034028] (1:Sender@Inmos) Got the Multiplication result ...Bye
-> [  0.034028] (2:Receiver@Bellevue) Calcul is done ... Bye
index 5adc010..f4df0ae 100644 (file)
@@ -13,7 +13,7 @@ global_string = "A global string set by maestro"
 
 -- Assigns to the global string the first argument and prints it
 function set_global_string(...)
-  
+
   global_string = arg[1]
   simgrid.info("Changing the global string")
   print_global()
@@ -43,7 +43,7 @@ end
 
 print_global()
 
-simgrid.platform("../../msg/small_platform.xml")
+simgrid.platform("../../platforms/small_platform.xml")
 simgrid.application("deployment_duplicated_globals.xml")
 simgrid.run()