Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various small cleanups. Not quite there yet
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 9 Feb 2010 17:21:37 +0000 (17:21 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 9 Feb 2010 17:21:37 +0000 (17:21 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7072 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/bindings/ruby/Makefile
src/bindings/ruby/MasterSlave.rb
src/bindings/ruby/RubyProcess.rb
src/bindings/ruby/client.rb
src/bindings/ruby/rb_msg.c

index 23389e4..15e55fa 100644 (file)
@@ -40,12 +40,12 @@ sitelibdir = $(sitedir)/$(ruby_version)
 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) 
index 419f513..1040e42 100644 (file)
@@ -1,79 +1,11 @@
 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()
index ed92544..b2b981d 100644 (file)
@@ -2,7 +2,7 @@ require 'msg'
 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
@@ -64,29 +64,25 @@ 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
       
       
index af5fad9..623e145 100644 (file)
@@ -41,6 +41,7 @@ size = array2.size
 
 
 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")
@@ -55,7 +56,8 @@ task = Task.new('ninou',12,23)
 # 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?
index 4a9a8f6..8776728 100644 (file)
@@ -175,7 +175,7 @@ static void msg_registerFunction(VALUE class,VALUE function_name,VALUE code)
 {
   
  char * fct_name = RSTRING(function_name)->ptr;
- xbt_main_func_t fct_code 
+// xbt_main_func_t fct_code
   
 }
 // INFO