CC = gcc
LIBRUBY = $(LIBRUBY_SO)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
-LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) -lsimgrid
+LIBRUBYARG_SHARED = -L../../.libs -l$(RUBY_SO_NAME) -lsimgrid
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
RUBY_EXTCONF_H =
CFLAGS = -fPIC -fno-strict-aliasing -g -g -O2 -fPIC $(cflags)
-INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
+INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) -I../../../include -I../../include -I../..
DEFS = -D_FILE_OFFSET_BITS=64
CPPFLAGS = $(DEFS) $(cppflags)
CXXFLAGS = $(CFLAGS)
require 'msg'
require 'RubyProcess'
-def Master(*args)
-
- puts "Hey ..from Master"#info("Hey")
-
- slaves = Array.new()
-
- size = args.size
-
- puts "Args = " + size
-
- for i in 0..size-1
- puts "argv :" + args[1]
- end
-
- raise "Master needs 3 arguments" if size < 3
-
- numberOfTask = args[0] #convert to int
- taskComputeSize = args[1] #convert to double
- taskCommunicationSize = args[2] #convert to double
- slaveCount = args[3] #convert to int
-
-
-# todo = Array.new(numberOfTask)
-
- #Creating & Sending Task
- for i in 0..numberOfTask
-
- 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
- RbTask.send(task,s_alias)
- puts "Master Done Sending " +RbTask.name(task) + " to " + s_alias
-
- end
-
- # Sending Finalize Tasks
- puts "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
- RbTask.send(RbTask.new("finalize",0,0),s_alias)
- end
-
- puts "Master : Everything's Done"
-
-
-
-end
+require 'Master'
+require 'Slave'
-
-def Slave(*args)
-
- puts "Hello From Slave"
- s_mailbox = "slave" + args[0]
-
-
- while true
-
- task = RbTask.recieve(s_mailbox)
-
- task_name = RbTask.name(task)
-
- if ( task_name == "finalize" )
- puts "Slave" + s_mailbox + "got finalize msg"
- break
- end
-
- puts "Slave " + s_mailbox + "Processing" + RbTask.name(task)
- RbTask.execute(task)
-
- end
-
- puts "Slave " + s_mailbox + "I'm Done , See You !!"
-
-
-end
\ No newline at end of file
+Msg.init()
+Msg.createEnvironment("../../../examples/msg/msg_platform.xml")
+Msg.deployApplication("MasterSlave_deploy.xml")
+Msg.run()
+Msg.exit()
require 'Semaphore'
include MSG
-$debug = true # This is a Gloabl Variable Useful for Debbuging
+$debug = true # This is a Global Variable Useful for Debugging
class RbProcess < Thread
type = args[0].type()
if ( type.to_s == "String")
-
- host = Host.getByName(args[0])
-
+ host = Host.getByName(args[0])
end
if ( type.to_s == "MSG::Host")
- host = args[0]
+ host = args[0]
end
if $debug
- puts host
+ puts host
end
-
-
raise "Process Name Cannot Be Null" if args[1].empty?
@name = args[1] # First Arg
if $debug
- puts @name
+ puts @name
end
task = Task.new('ninou',12,23)
+puts "Created task :"+task.to_s+" ; name: "+Task.name(task)
#task2 =RbTask.new('task2')
# task = RbTask.new()
# host = Host.new("Brad")
# task.bind
number = 56
-# process = RbProcess.new()
+process = RbProcess.new("mon nom")
+puts "Created process :"+process.to_s+" ; name: "+RbProcess.name(task)
# name = process.name
puts name
# puts process.alive?