Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ruby examples
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 8 Apr 2010 15:33:08 +0000 (15:33 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 8 Apr 2010 15:33:08 +0000 (15:33 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7479 48e7efb5-ca39-0410-a469-dd3cf9ba447f

13 files changed:
examples/ruby/MasterSlave.rb [new file with mode: 0644]
examples/ruby/MasterSlave.tesh [new file with mode: 0644]
examples/ruby/PingPong.rb [new file with mode: 0644]
examples/ruby/PingPong.tesh [new file with mode: 0644]
examples/ruby/Quicksort.rb [new file with mode: 0644]
examples/ruby/Quicksort.tesh [new file with mode: 0644]
examples/ruby/README [new file with mode: 0644]
examples/ruby/deploy.xml [new file with mode: 0644]
examples/ruby/ping_pong_deployment.xml [new file with mode: 0644]
examples/ruby/ping_pong_platform.xml [new file with mode: 0644]
examples/ruby/platform.xml [new file with mode: 0644]
examples/ruby/quicksort_deployment.xml [new file with mode: 0644]
examples/ruby/quicksort_platform.xml [new file with mode: 0644]

diff --git a/examples/ruby/MasterSlave.rb b/examples/ruby/MasterSlave.rb
new file mode 100644 (file)
index 0000000..efc3a9d
--- /dev/null
@@ -0,0 +1,80 @@
+# Debug it with this command:
+# make -C ../.. && valgrind ruby MasterSlave.rb --log=ruby.thres:debug 2>&1 | less
+require 'simgrid'
+include MSG
+#################################################
+# Class Master
+#################################################
+
+
+class Master < MSG::Process  
+  # main : that function that will be executed when running simulation
+
+  def main(args) # args is an array containing arguments for function master
+   size = args.size
+   for i in 0..size-1
+     MSG::info("args["+String(i)+"]="+args[i])
+   end
+  
+   raise "Master needs 3 arguments" if size < 3 
+   numberOfTask = Integer(args[0]) 
+   taskComputeSize = Float(args[1])
+   taskCommunicationSize = Float(args[2])
+   slaveCount = Integer(args[3]) 
+   
+   # Creates and sends the tasks
+    for i in 0..numberOfTask-1
+     task = RTask.new("Task_"+ i.to_s, taskComputeSize , taskCommunicationSize);
+     mailbox = "slave " + (i%slaveCount).to_s
+     MSG::info("Master Sending "+ task.name + " to " + mailbox + " with Comput Size " + 
+           task.compSize.to_s)
+     task.send(mailbox)
+     MSG::info("Master Done Sending " + task.name + " to " + mailbox)
+    end
+  
+   # Sending Finalize MSG::Tasks
+   #MSG::info("Master: All "+numberOfTask+" tasks have been dispatched. Let's tell everybody the computation is over.")
+   MSG::info("Master: All tasks have been dispatched. Let's tell everybody the computation is over.")
+   for i in 0..slaveCount-1
+     mailbox = "slave " + i.to_s
+     finalize_task = RTask.new("finalize",0,0)
+     finalize_task.send(mailbox)
+   end
+   MSG::info("Master : Everything's Done")
+  end    
+end
+#################################################
+# Class Slave
+#################################################
+class Slave < MSG::Process
+
+  def main(args)
+    mailbox = "slave " + args[0]
+    for i in 0..args.size-1
+      MSG::debug("args["+String(i)+"]="+args[i])
+    end
+
+    while true
+       task = Task.receive(mailbox)
+       if (task.name == "finalize")
+              break
+       end
+       task.execute
+       MSG::debug("Slave '" + mailbox + "' done executing task "+ task.name + ".")
+    end
+    MSG::info("I'm done, see you")
+  end
+end
+#################################################
+# main chunck
+#################################################
+if (ARGV.length == 2) 
+       MSG.createEnvironment(ARGV[0])
+       MSG.deployApplication(ARGV[1])
+else 
+       MSG.createEnvironment("platform.xml")
+       MSG.deployApplication("deploy.xml")
+end
+MSG.run
+puts "Simulation time : " + MSG.getClock .to_s
+MSG.exit
\ No newline at end of file
diff --git a/examples/ruby/MasterSlave.tesh b/examples/ruby/MasterSlave.tesh
new file mode 100644 (file)
index 0000000..da92c49
--- /dev/null
@@ -0,0 +1,53 @@
+# MasterSlave Ruby Example
+$ ruby MasterSlave.rb
+> [Tremblay:Master:(1) 0.000000] [ruby/INFO] args[0]=20
+> [Tremblay:Master:(1) 0.000000] [ruby/INFO] args[1]=50000000
+> [Tremblay:Master:(1) 0.000000] [ruby/INFO] args[2]=1000000
+> [Tremblay:Master:(1) 0.000000] [ruby/INFO] args[3]=4
+> [Tremblay:Master:(1) 0.000000] [ruby/INFO] Master Sending Task_0 to slave 0 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 0.215872] [ruby/INFO] Master Done Sending Task_0 to slave 0
+> [Tremblay:Master:(1) 0.215872] [ruby/INFO] Master Sending Task_1 to slave 1 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 0.381834] [ruby/INFO] Master Done Sending Task_1 to slave 1
+> [Tremblay:Master:(1) 0.381834] [ruby/INFO] Master Sending Task_2 to slave 2 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 0.599987] [ruby/INFO] Master Done Sending Task_2 to slave 2
+> [Tremblay:Master:(1) 0.599987] [ruby/INFO] Master Sending Task_3 to slave 3 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 0.740447] [ruby/INFO] Master Done Sending Task_3 to slave 3
+> [Tremblay:Master:(1) 0.740447] [ruby/INFO] Master Sending Task_4 to slave 0 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 1.462843] [ruby/INFO] Master Done Sending Task_4 to slave 0
+> [Tremblay:Master:(1) 1.462843] [ruby/INFO] Master Sending Task_5 to slave 1 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 1.628804] [ruby/INFO] Master Done Sending Task_5 to slave 1
+> [Tremblay:Master:(1) 1.628804] [ruby/INFO] Master Sending Task_6 to slave 2 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 1.846957] [ruby/INFO] Master Done Sending Task_6 to slave 2
+> [Tremblay:Master:(1) 1.846957] [ruby/INFO] Master Sending Task_7 to slave 3 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 1.987417] [ruby/INFO] Master Done Sending Task_7 to slave 3
+> [Tremblay:Master:(1) 1.987417] [ruby/INFO] Master Sending Task_8 to slave 0 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 2.709813] [ruby/INFO] Master Done Sending Task_8 to slave 0
+> [Tremblay:Master:(1) 2.709813] [ruby/INFO] Master Sending Task_9 to slave 1 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 2.875775] [ruby/INFO] Master Done Sending Task_9 to slave 1
+> [Tremblay:Master:(1) 2.875775] [ruby/INFO] Master Sending Task_10 to slave 2 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 3.093928] [ruby/INFO] Master Done Sending Task_10 to slave 2
+> [Tremblay:Master:(1) 3.093928] [ruby/INFO] Master Sending Task_11 to slave 3 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 3.234387] [ruby/INFO] Master Done Sending Task_11 to slave 3
+> [Tremblay:Master:(1) 3.234387] [ruby/INFO] Master Sending Task_12 to slave 0 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 3.956783] [ruby/INFO] Master Done Sending Task_12 to slave 0
+> [Tremblay:Master:(1) 3.956783] [ruby/INFO] Master Sending Task_13 to slave 1 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 4.122745] [ruby/INFO] Master Done Sending Task_13 to slave 1
+> [Tremblay:Master:(1) 4.122745] [ruby/INFO] Master Sending Task_14 to slave 2 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 4.340898] [ruby/INFO] Master Done Sending Task_14 to slave 2
+> [Tremblay:Master:(1) 4.340898] [ruby/INFO] Master Sending Task_15 to slave 3 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 4.481357] [ruby/INFO] Master Done Sending Task_15 to slave 3
+> [Tremblay:Master:(1) 4.481357] [ruby/INFO] Master Sending Task_16 to slave 0 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 5.203753] [ruby/INFO] Master Done Sending Task_16 to slave 0
+> [Tremblay:Master:(1) 5.203753] [ruby/INFO] Master Sending Task_17 to slave 1 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 5.369715] [ruby/INFO] Master Done Sending Task_17 to slave 1
+> [Tremblay:Master:(1) 5.369715] [ruby/INFO] Master Sending Task_18 to slave 2 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 5.587868] [ruby/INFO] Master Done Sending Task_18 to slave 2
+> [Tremblay:Master:(1) 5.587868] [ruby/INFO] Master Sending Task_19 to slave 3 with Comput Size 50000000.0
+> [Tremblay:Master:(1) 5.728328] [ruby/INFO] Master Done Sending Task_19 to slave 3
+> [Tremblay:Master:(1) 5.728328] [ruby/INFO] Master: All tasks have been dispatched. Let's tell everybody the computation is over.
+> [Bourassa:Slave:(2) 6.255187] [ruby/INFO] I'm done, see you
+> [Jupiter:Slave:(3) 6.270387] [ruby/INFO] I'm done, see you
+> [Fafard:Slave:(4) 6.290937] [ruby/INFO] I'm done, see you
+> [Tremblay:Master:(1) 6.772657] [ruby/INFO] Master : Everything's Done
+> [Ginette:Slave:(5) 6.772657] [ruby/INFO] I'm done, see you
+> Simulation time : 6.77265731195289
diff --git a/examples/ruby/PingPong.rb b/examples/ruby/PingPong.rb
new file mode 100644 (file)
index 0000000..73b5153
--- /dev/null
@@ -0,0 +1,88 @@
+require 'simgrid'
+
+include MSG
+
+#####################
+#PingPongTask Class
+#####################
+
+class PingPongTask < MSG::Task
+  
+  # The initialize method has no effect 
+  @time 
+  def setTime(t)
+    @time = t
+  end
+  
+  def getTime()
+    return @time
+  end
+end
+
+####################
+# Sender Class
+####################
+
+class Sender < MSG::Process
+  
+ def main(args)
+   MSG::info("Hello from Sender")
+   hostCount = args.size
+   MSG::info("Host count :" + hostCount.to_s)
+   mailboxes = Array.new
+      
+   for i in 0..hostCount-1
+     mailboxes<< MSG::Host.getByName(args[i]).name
+   end
+   
+   for i in 0..hostCount-1
+     time = MSG.getClock
+     MSG::info("sender time :"+time.to_s)
+     task = PingPongTask.new("PingTask",10000,2000)
+     MSG::info("task created :" + task.name);
+     #task.join(time) -- MSG::task.join(data) is a Native method you can use to attach any data you want to the task
+     task.setTime(time)
+     task.send(mailboxes[i])
+   end
+   MSG::info("Bye!!")     
+   end
+ end
+  
+####################
+# Receiver Class
+####################
+
+class Receiver < MSG::Process
+  
+  def main(args)
+    MSG::info("Hello from Receiver")
+    time = MSG.getClock
+    host = MSG::Host.getHostProcess(self)
+    task = PingPongTask.receive(host.name)
+    timeGot = MSG.getClock
+    MSG::info("Got at time: "+timeGot.to_s)
+    #timeSent = task.data -- 
+    timeSent = task.getTime
+    MSG::info("Was sent at time "+timeSent.to_s)
+    communicationTime = timeGot - time
+    MSG::info("Communication Time: "+communicationTime.to_s)
+    MSG::info("--- bw "+(100000000/communicationTime).to_s+" ----")
+    MSG::info("Bye!!")
+  end
+  
+end
+
+#################################################
+# main chunck
+#################################################
+
+if (ARGV.length == 2) 
+       MSG.createEnvironment(ARGV[0])
+       MSG.deployApplication(ARGV[1])
+else 
+       MSG.createEnvironment("ping_pong_platform.xml")
+       MSG.deployApplication("ping_pong_deployment.xml")
+end
+
+MSG.run
+MSG.exit
\ No newline at end of file
diff --git a/examples/ruby/PingPong.tesh b/examples/ruby/PingPong.tesh
new file mode 100644 (file)
index 0000000..a483667
--- /dev/null
@@ -0,0 +1,13 @@
+#PingPong Example
+$ ruby PingPong.rb
+> [Inmos:Sender:(1) 0.000000] [ruby/INFO] Hello from Sender
+> [Inmos:Sender:(1) 0.000000] [ruby/INFO] Host count :1
+> [Inmos:Sender:(1) 0.000000] [ruby/INFO] sender time :0.0
+> [Inmos:Sender:(1) 0.000000] [ruby/INFO] task created :PingTask
+> [Bellevue:Receiver:(2) 0.000000] [ruby/INFO] Hello from Receiver
+> [Inmos:Sender:(1) 0.015501] [ruby/INFO] Bye!!
+> [Bellevue:Receiver:(2) 0.015501] [ruby/INFO] Got at time: 0.0155013008533275
+> [Bellevue:Receiver:(2) 0.015501] [ruby/INFO] Was sent at time 0.0
+> [Bellevue:Receiver:(2) 0.015501] [ruby/INFO] Communication Time: 0.0155013008533275
+> [Bellevue:Receiver:(2) 0.015501] [ruby/INFO] --- bw 6451071490.46357 ----
+> [Bellevue:Receiver:(2) 0.015501] [ruby/INFO] Bye!!
diff --git a/examples/ruby/Quicksort.rb b/examples/ruby/Quicksort.rb
new file mode 100644 (file)
index 0000000..4a32026
--- /dev/null
@@ -0,0 +1,107 @@
+# Debug it with this command:
+# make -C ../.. && valgrind ruby MasterSlave.rb --log=ruby.thres:debug 2>&1 | less
+
+require 'simgrid'
+
+include MSG
+
+
+#################################################
+# Class Asker
+#################################################
+
+class Sender < MSG::Process  
+  # main : that function that will be executed when running simulation
+  def main(args) # args is an array containing arguments for function master
+  
+   hardworking_friend = MSG::Host.getByName(args[0]).name
+   taskComputeSize = Float(args[1])
+   taskCommunicationSize = Float(args[2])
+   send_mailbox =args[3]
+   
+   myTable = Array.new
+   myTable <<1<<-2<<45<<67<<87<<76<<89<<56<<78<<3<<-4<<99
+   MSG::info("Hello " + hardworking_friend + " !!, Please !! I need you to help me to sort my table , Here it is :")
+   p myTable
+   # Creates and send Task With the Table inside
+   task = MSG::Task.new("quicksort_task",taskComputeSize, taskCommunicationSize);
+   task.join(myTable);
+   MSG::debug("Sending "+ task.name + " to " + send_mailbox + " with Comput Size " + 
+           task.compSize.to_s)
+   task.send(send_mailbox)
+   MSG::debug("Done Sending " + task.name + " to " + send_mailbox)
+    
+   #waiting for results
+   
+   recv_mailbox = self.class
+   res_task = MSG::Task.receive(recv_mailbox.to_s)
+   result = res_task.data
+   MSG::info("Greate !! Thx Dude , you're my Best Friend !!")
+   MSG::info("Here is my table after a quicksort :)")
+   p result
+   MSG::info("Bye !! I finished My HomeWork !! Time to Sleep :)")
+   end
+
+end
+
+
+#################################################
+# Class Clever
+#################################################
+class Receiver < MSG::Process
+
+  def main(args)
+    
+    lazy_friend = MSG::Host.getByName(args[0]).name
+    send_mailbox = args[1]
+    recv_mailbox = self.class
+    MSG::info("Oh Not Again !! Grrr")
+    task = MSG::Task.receive(recv_mailbox.to_s)
+    table = task.data
+    quicksort(table,0,table.size-1)
+    task.join(table)
+    MSG::info("Ok "+lazy_friend+ "I did it, next time try to do it yourself:)")
+    task.send(send_mailbox)
+    MSG::info("Bye lazy Friend !!")
+    
+  end    
+  
+  def quicksort(list, p, r)
+    if p < r then
+        q = partition(list, p, r)
+        quicksort(list, p, q-1)
+        quicksort(list, q+1, r)
+    end
+end
+
+def partition(list, p, r)
+    pivot = list[r]
+    i = p - 1
+    p.upto(r-1) do |j|
+        if list[j] <= pivot
+            i = i+1
+            list[i], list[j] = list[j],list[i]
+        end
+    end
+    list[i+1],list[r] = list[r],list[i+1]
+    return i + 1
+end
+  
+end
+
+#################################################
+# main chunck
+#################################################
+
+if (ARGV.length == 2) 
+       MSG.createEnvironment(ARGV[0])
+       MSG.deployApplication(ARGV[1])
+else 
+       MSG.createEnvironment("quicksort_platform.xml")
+       MSG.deployApplication("quicksort_deployment.xml")
+end
+
+MSG.run
+puts "Simulation time : " + MSG.getClock .to_s
+MSG.exit
diff --git a/examples/ruby/Quicksort.tesh b/examples/ruby/Quicksort.tesh
new file mode 100644 (file)
index 0000000..e11a164
--- /dev/null
@@ -0,0 +1,12 @@
+#QuickSort Ruby Example
+$ ruby Quicksort.rb
+> [Inmos:Sender:(1) 0.000000] [ruby/INFO] Hello Bellevue !!, Please !! I need you to help me to sort my table , Here it is :
+> [1, -2, 45, 67, 87, 76, 89, 56, 78, 3, -4, 99]
+> [Bellevue:Receiver:(2) 0.000000] [ruby/INFO] Receiving Table from Inmos
+> [Bellevue:Receiver:(2) 0.030276] [ruby/INFO] Sort Done ... Sending Back the new table
+> [Inmos:Sender:(1) 0.060552] [ruby/INFO] Greate !! Thx !!
+> [Inmos:Sender:(1) 0.060552] [ruby/INFO] Here is my table after a quicksort :)
+> [-4, -2, 1, 3, 45, 56, 67, 76, 78, 87, 89, 99]
+> [Inmos:Sender:(1) 0.060552] [ruby/INFO] Bye Now :)
+> [Bellevue:Receiver:(2) 0.060552] [ruby/INFO] Bye lazy Boy!!
+> Simulation time : 0.0605519589327544
diff --git a/examples/ruby/README b/examples/ruby/README
new file mode 100644 (file)
index 0000000..7e6c4d9
--- /dev/null
@@ -0,0 +1,58 @@
+
+Examples containing in this directory
+
+===============================================================================
+* MasterSlave.rb           
+===============================================================================
+    - Description:
+    Simple master slave application
+
+    - Platform Files:
+    platform.xml
+       
+    - Deployment Files:
+    deploy.xml
+
+    - Execute: 
+    (WARNING: the current directory must be examples/ruby/)
+    ruby MasterSlave.rb
+
+===============================================================================
+* PingPong.rb
+===============================================================================
+    - Description:
+    This is a stupid ping/pong example. The processes exchange a simple
+    task and time them
+    NB : in this example we inherit MSG::Task to make our PingPongTask with 
+        our own methods 
+    
+    - Platform Files:
+    ping_pong_platform.xml    
+       
+    - Deployment Files:
+    ping_pong_deployment.xml
+
+    - Execute: 
+    (WARNING: the current directory must be examples/ruby/)
+    ruby PingPong.rb
+           
+================================================================================
+* Quicksort.rb
+================================================================================
+    - Description:
+    simple example to show how to exchange data between two process (ruby)
+    in this example :
+       *Process Sender : send a task with a table , receive and print the result
+       *Process Receiver : receiving and sorting the 'Sender' table   
+    NB: in the example we use the methods MSG::Task.join(data) and MSG::Task.data() to exchange data
+
+    - Platform Files:
+    quicksort_platform.xml    
+       
+    - Deployment Files:
+    quicksort_deployment.xml
+
+    - Execute: 
+    (WARNING: the current directory must be examples/ruby/)
+    ruby Quicksort.rb
+       
diff --git a/examples/ruby/deploy.xml b/examples/ruby/deploy.xml
new file mode 100644 (file)
index 0000000..a0c6ec9
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <!-- The master process (with some arguments) -->
+  <process host="Tremblay" function="Master">
+     <argument value="20"/>       <!-- Number of tasks -->
+     <argument value="50000000"/>  <!-- Computation size of tasks -->
+     <argument value="1000000"/>   <!-- Communication size of tasks -->
+     <argument value="4"/>  <!-- Amount of slaves -->
+  </process>
+  <!-- The slave process (argument: slave rank) -->
+  <process host="Bourassa" function="Slave">
+    <argument value="0"/>
+  </process>
+  <process host="Jupiter" function="Slave">
+    <argument value="1"/>
+  </process>
+  <process host="Fafard" function="Slave">
+    <argument value="2"/>
+  </process>
+  <process host="Ginette" function="Slave">
+    <argument value="3"/>
+  </process>
+</platform>
diff --git a/examples/ruby/ping_pong_deployment.xml b/examples/ruby/ping_pong_deployment.xml
new file mode 100644 (file)
index 0000000..b02edda
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <process host="Inmos" function="Sender">
+      <argument value="Bellevue"/>
+  </process>
+<process host="Bellevue" function="Receiver"/>
+</platform>
diff --git a/examples/ruby/ping_pong_platform.xml b/examples/ruby/ping_pong_platform.xml
new file mode 100644 (file)
index 0000000..39eddb2
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <!-- ljlkj -->
+  <host id="Inmos" power="98095000"/>
+  <host id="Bellevue" power="76296000"/>
+  <host id="Fafard" power="76296000"/>
+  <host id="Ginette" power="48492000"/>
+  <host id="Bourassa" power="48492000"/>
+  <link id="6" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="11" bandwidth="252750" latency="0.00570455"/>
+  <link id="3" bandwidth="34285625" latency="0.000514433"/>
+  <link id="7" bandwidth="11618875" latency="0.00018998"/>
+  <link id="9" bandwidth="7209750" latency="0.001461517"/>
+  <link id="12" bandwidth="1792625" latency="0.007877863"/>
+  <link id="2" bandwidth="118682500" latency="0.000136931"/>
+  <link id="8" bandwidth="8158000" latency="0.000270544"/>
+  <link id="1" bandwidth="34285625" latency="0.000514433"/>
+  <link id="4" bandwidth="10099625" latency="0.00047978"/>
+  <link id="0" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="10" bandwidth="4679750" latency="0.000848712"/>
+  <link id="5" bandwidth="27946250" latency="0.000278066"/>
+  <link id="loopback_FATPIPE" bandwidth="10000000" latency="0.1" sharing_policy="FATPIPE"/>
+  <link id="loopback" bandwidth="498000000" latency="0.000015"/>
+  <route src="Inmos" dst="Inmos"><link:ctn id="loopback"/></route>
+  <route src="Bellevue" dst="Bellevue"><link:ctn id="loopback"/></route>
+  <route src="Fafard" dst="Fafard"><link:ctn id="loopback"/></route>
+  <route src="Ginette" dst="Ginette"><link:ctn id="loopback"/></route>
+  <route src="Bourassa" dst="Bourassa"><link:ctn id="loopback"/></route>
+  <route src="Inmos" dst="Bellevue">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Inmos" dst="Fafard">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Inmos" dst="Ginette">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Inmos" dst="Bourassa">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Bellevue" dst="Inmos">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Bellevue" dst="Fafard">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Bellevue" dst="Ginette">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Bellevue" dst="Bourassa">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Fafard" dst="Inmos">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Fafard" dst="Bellevue">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Fafard" dst="Ginette">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+  <route src="Fafard" dst="Bourassa">
+    <link:ctn id="8"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Ginette" dst="Inmos">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Ginette" dst="Bellevue">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Ginette" dst="Fafard">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Ginette" dst="Bourassa">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Bourassa" dst="Inmos">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Bourassa" dst="Bellevue">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Bourassa" dst="Fafard">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="8"/>
+  </route>
+  <route src="Bourassa" dst="Ginette">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+</platform>
diff --git a/examples/ruby/platform.xml b/examples/ruby/platform.xml
new file mode 100644 (file)
index 0000000..38bfa58
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <host id="Tremblay" power="98095000"/>
+  <host id="Jupiter" power="76296000"/>
+  <host id="Fafard" power="76296000"/>
+  <host id="Ginette" power="48492000"/>
+  <host id="Bourassa" power="48492000"/>
+  <link id="6" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="11" bandwidth="252750" latency="0.00570455"/>
+  <link id="3" bandwidth="34285625" latency="0.000514433"/>
+  <link id="7" bandwidth="11618875" latency="0.00018998"/>
+  <link id="9" bandwidth="7209750" latency="0.001461517"/>
+  <link id="12" bandwidth="1792625" latency="0.007877863"/>
+  <link id="2" bandwidth="118682500" latency="0.000136931"/>
+  <link id="8" bandwidth="8158000" latency="0.000270544"/>
+  <link id="1" bandwidth="34285625" latency="0.000514433"/>
+  <link id="4" bandwidth="10099625" latency="0.00047978"/>
+  <link id="0" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="10" bandwidth="4679750" latency="0.000848712"/>
+  <link id="5" bandwidth="27946250" latency="0.000278066"/>
+  <link id="loopback" bandwidth="498000000" latency="0.000015" sharing_policy="FATPIPE"/>
+  <route src="Tremblay" dst="Tremblay"><link:ctn id="loopback"/></route>
+  <route src="Jupiter" dst="Jupiter"><link:ctn id="loopback"/></route>
+  <route src="Fafard" dst="Fafard"><link:ctn id="loopback"/></route>
+  <route src="Ginette" dst="Ginette"><link:ctn id="loopback"/></route>
+  <route src="Bourassa" dst="Bourassa"><link:ctn id="loopback"/></route>
+  <route src="Tremblay" dst="Jupiter">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Tremblay" dst="Fafard">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Tremblay" dst="Ginette">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Tremblay" dst="Bourassa">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Jupiter" dst="Tremblay">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Jupiter" dst="Fafard">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Jupiter" dst="Ginette">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Jupiter" dst="Bourassa">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Fafard" dst="Tremblay">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Fafard" dst="Jupiter">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Fafard" dst="Ginette">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+  <route src="Fafard" dst="Bourassa">
+    <link:ctn id="8"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Ginette" dst="Tremblay">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Ginette" dst="Jupiter">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Ginette" dst="Fafard">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Ginette" dst="Bourassa">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Bourassa" dst="Tremblay">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Bourassa" dst="Jupiter">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Bourassa" dst="Fafard">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="8"/>
+  </route>
+  <route src="Bourassa" dst="Ginette">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+</platform>
diff --git a/examples/ruby/quicksort_deployment.xml b/examples/ruby/quicksort_deployment.xml
new file mode 100644 (file)
index 0000000..2f036f7
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <process host="Inmos" function="Sender">
+      <argument value ="Bellevue"/>
+      <argument value="5000000"/>
+      <argument value="100000"/>
+      <argument value="Receiver"/> <!--will be used as a mailbox alias-->
+  </process>
+  <process host="Bellevue" function="Receiver">
+         <argument value="Inmos"/>
+         <argument value="Sender"/> <!--will be used as a mailbox alias-->
+  </process>
+</platform>
diff --git a/examples/ruby/quicksort_platform.xml b/examples/ruby/quicksort_platform.xml
new file mode 100644 (file)
index 0000000..39eddb2
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <!-- ljlkj -->
+  <host id="Inmos" power="98095000"/>
+  <host id="Bellevue" power="76296000"/>
+  <host id="Fafard" power="76296000"/>
+  <host id="Ginette" power="48492000"/>
+  <host id="Bourassa" power="48492000"/>
+  <link id="6" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="11" bandwidth="252750" latency="0.00570455"/>
+  <link id="3" bandwidth="34285625" latency="0.000514433"/>
+  <link id="7" bandwidth="11618875" latency="0.00018998"/>
+  <link id="9" bandwidth="7209750" latency="0.001461517"/>
+  <link id="12" bandwidth="1792625" latency="0.007877863"/>
+  <link id="2" bandwidth="118682500" latency="0.000136931"/>
+  <link id="8" bandwidth="8158000" latency="0.000270544"/>
+  <link id="1" bandwidth="34285625" latency="0.000514433"/>
+  <link id="4" bandwidth="10099625" latency="0.00047978"/>
+  <link id="0" bandwidth="41279125" latency="5.9904e-05"/>
+  <link id="10" bandwidth="4679750" latency="0.000848712"/>
+  <link id="5" bandwidth="27946250" latency="0.000278066"/>
+  <link id="loopback_FATPIPE" bandwidth="10000000" latency="0.1" sharing_policy="FATPIPE"/>
+  <link id="loopback" bandwidth="498000000" latency="0.000015"/>
+  <route src="Inmos" dst="Inmos"><link:ctn id="loopback"/></route>
+  <route src="Bellevue" dst="Bellevue"><link:ctn id="loopback"/></route>
+  <route src="Fafard" dst="Fafard"><link:ctn id="loopback"/></route>
+  <route src="Ginette" dst="Ginette"><link:ctn id="loopback"/></route>
+  <route src="Bourassa" dst="Bourassa"><link:ctn id="loopback"/></route>
+  <route src="Inmos" dst="Bellevue">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Inmos" dst="Fafard">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Inmos" dst="Ginette">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Inmos" dst="Bourassa">
+    <link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Bellevue" dst="Inmos">
+    <link:ctn id="9"/>
+  </route>
+  <route src="Bellevue" dst="Fafard">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Bellevue" dst="Ginette">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="5"/>
+  </route>
+  <route src="Bellevue" dst="Bourassa">
+    <link:ctn id="9"/><link:ctn id="4"/><link:ctn id="3"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Fafard" dst="Inmos">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Fafard" dst="Bellevue">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Fafard" dst="Ginette">
+    <link:ctn id="8"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+  <route src="Fafard" dst="Bourassa">
+    <link:ctn id="8"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Ginette" dst="Inmos">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Ginette" dst="Bellevue">
+    <link:ctn id="5"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Ginette" dst="Fafard">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="8"/>
+  </route>
+  <route src="Ginette" dst="Bourassa">
+    <link:ctn id="5"/><link:ctn id="2"/><link:ctn id="0"/><link:ctn id="1"/><link:ctn id="6"/><link:ctn id="7"/>
+  </route>
+  <route src="Bourassa" dst="Inmos">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/>
+  </route>
+  <route src="Bourassa" dst="Bellevue">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="3"/><link:ctn id="4"/><link:ctn id="9"/>
+  </route>
+  <route src="Bourassa" dst="Fafard">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="8"/>
+  </route>
+  <route src="Bourassa" dst="Ginette">
+    <link:ctn id="7"/><link:ctn id="6"/><link:ctn id="1"/><link:ctn id="0"/><link:ctn id="2"/><link:ctn id="5"/>
+  </route>
+</platform>