X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d4c8ec334d02aea22b90114034f2b8b02e976c5d..05a2819a1d62a4ebe2af6d0a60654bf8e629d042:/src/bindings/ruby/Master.rb diff --git a/src/bindings/ruby/Master.rb b/src/bindings/ruby/Master.rb index f2f1913fa3..eafe15d406 100644 --- a/src/bindings/ruby/Master.rb +++ b/src/bindings/ruby/Master.rb @@ -4,18 +4,24 @@ require 'RubyProcess' include MSG class Master < RbProcess - def initialize() + def initialize2() super() end - + + #for Testing + def msg_main2(args) + info("Hello From Master") + end + + # msg_main : that function that will be executed when Running Simulation def msg_main(args) # args is an array Containin' arguments for function master - puts "Hey From Ruby...I'm The Master" + info("Hello From Master") size = args.size - puts "Number of Args for Master = " + size.to_s + info ("Number of Args for Master = " + size.to_s) for i in 0..size-1 - puts args[i] + info(args[i]) end raise "Master needs 3 arguments" if size < 3 @@ -25,24 +31,26 @@ class Master < RbProcess slaveCount = Integer(args[3]) #Creating & Sending Task - for i in 0..numberOfTask + for i in 0..numberOfTask-1 - task = RbTask.new("Task_" + i.to_s, taskComputeSize , taskCommunicationSize ); + + task = RbTask.new("Task_"+ i.to_s, taskComputeSize , taskCommunicationSize ); s_alias = "slave>>" + (i%slaveCount).to_s - puts "Master Sending "+ RbTask.name(task) + " to " + s_alias + " with Comput Size " + RbTask.compSize(task).to_s + info("Master Sending "+ RbTask.name(task) + " to " + s_alias + " with Comput Size " + RbTask.compSize(task).to_s) RbTask.send(task,s_alias) - puts "Master Done Sending " +RbTask.name(task) + " to " + s_alias - + info("Master Done Sending " +RbTask.name(task) + " to " + s_alias) +# sameTask = RbTask.receive(s_alias) +# puts "Master Receiving its Own Task" end # Sending Finalize Tasks - puts "Master: All tasks have been dispatched. Let's tell everybody the computation is over." + info ("Master: All tasks have been dispatched. Let's tell everybody the computation is over.") for i in 0..slaveCount-1 s_alias = "slave " + i.to_s - puts "Master Sending Finalize to " + s_alias + info ("Master Sending Finalize to " + s_alias) RbTask.send(RbTask.new("finalize",0,0),s_alias) end - puts "Master : Everything's Done" + info("Master : Everything's Done") end end \ No newline at end of file