Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Lua] Renamed host 'power' to 'speed' for hosts
[simgrid.git] / examples / lua / multi_matrix / sender.lua
1 -- Copyright (c) 2011, 2014. The SimGrid Team.
2 -- All rights reserved.
3
4 -- This program is free software; you can redistribute it and/or modify it
5 -- under the terms of the license (GNU LGPL) which comes with this package.
6
7 function Sender(...)
8
9   simgrid.info("Hello From Sender")
10   local receiver = simgrid.host.get_by_name(select(1, ...))
11   local task_comp = select(2, ...)
12   local task_comm = select(3, ...)
13   local rec_alias = select(4, ...)
14
15   local size = 4
16   local m1 = mkmatrix(size, size)
17   local m2 = mkmatrix(size, size)
18
19   if select("#", ...) ~= 4 then
20     error("Argc should be 4")
21   end
22   simgrid.info("Argc=" .. select("#", ...) .. " (should be 4)")
23
24   -- Sending Task
25   local task = simgrid.task.new("matrix_task", task_comp, task_comm)
26   task['matrix_1'] = m1
27   task['matrix_2'] = m2
28   task['size'] = size
29   simgrid.info("Sending " .. simgrid.task.get_name(task) .. " to " .. simgrid.host.name(receiver))
30   simgrid.task.send(task, rec_alias)
31   simgrid.info("Got the Multiplication result ...Bye")
32 end
33