[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:390

From: ko1 atdot.net
Date: 7 Sep 2006 20:00:41 +0900
Subject: [yarv-diff:390] r557 - in branches/parallel: . benchmark

Author: ko1
Date: 2006-09-07 20:00:41 +0900 (Thu, 07 Sep 2006)
New Revision: 557

Added:
   branches/parallel/benchmark/bm_para_concat.rb
   branches/parallel/benchmark/bm_para_fib.rb
   branches/parallel/benchmark/bm_para_hetero.rb
   branches/parallel/benchmark/bm_para_mandelbrot.rb
   branches/parallel/benchmark/bm_para_tak.rb
Modified:
   branches/parallel/ChangeLog
Log:
	* benchmark/bm_para_concat.rb : added

	* benchmark/bm_para_fib.rb : ditto

	* benchmark/bm_para_hetero.rb : ditto

	* benchmark/bm_para_mandelbrot.rb : ditto

	* benchmark/bm_para_tak.rb : ditto



Modified: branches/parallel/ChangeLog
===================================================================
--- branches/parallel/ChangeLog	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/ChangeLog	2006-09-07 11:00:41 UTC (rev 557)
@@ -4,6 +4,19 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-09-07(Thu) 19:59:40 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* benchmark/bm_para_concat.rb : added
+
+	* benchmark/bm_para_fib.rb : ditto
+
+	* benchmark/bm_para_hetero.rb : ditto
+
+	* benchmark/bm_para_mandelbrot.rb : ditto
+
+	* benchmark/bm_para_tak.rb : ditto
+
+
 2006-09-06(Wed) 22:43:04 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* thread.c : add CPU control feature for multi-CPU/Core

Added: branches/parallel/benchmark/bm_para_concat.rb
===================================================================
--- branches/parallel/benchmark/bm_para_concat.rb	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/benchmark/bm_para_concat.rb	2006-09-07 11:00:41 UTC (rev 557)
@@ -0,0 +1,18 @@
+def work n=8
+  (1..n).map{
+    Thread.new{
+      yield
+    }
+  }.each{|t|
+    t.join
+  }
+end
+
+str = ''
+
+work{
+  1000000.times{
+    str.concat '.'
+  }
+}
+


Property changes on: branches/parallel/benchmark/bm_para_concat.rb
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/parallel/benchmark/bm_para_fib.rb
===================================================================
--- branches/parallel/benchmark/bm_para_fib.rb	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/benchmark/bm_para_fib.rb	2006-09-07 11:00:41 UTC (rev 557)
@@ -0,0 +1,23 @@
+def work n=8
+  (1..n).map{
+    Thread.new{
+      yield
+    }
+  }.each{|t|
+    t.join
+  }
+end
+
+def fib x
+  if x < 2
+    1
+  else
+    fib(x-1)+fib(x-2)
+  end
+end
+
+work{
+  fib(32)
+}
+
+


Property changes on: branches/parallel/benchmark/bm_para_fib.rb
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/parallel/benchmark/bm_para_hetero.rb
===================================================================
--- branches/parallel/benchmark/bm_para_hetero.rb	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/benchmark/bm_para_hetero.rb	2006-09-07 11:00:41 UTC (rev 557)
@@ -0,0 +1,33 @@
+def work n=8
+  (1..n).map{|i|
+    Thread.new(i){|ti|
+      yield ti
+    }
+  }.each{|t|
+    STDERR.puts t.to_s
+    t.join
+  }
+end
+
+def fib x
+  if x < 2
+    1
+  else
+    fib(x-1)+fib(x-2)
+  end
+end
+
+str = ''
+
+work 4 do |i|
+  if i<2
+    2000000.times{
+      str.concat '.'
+    }
+  else
+    fib 34
+  end
+end
+
+
+


Property changes on: branches/parallel/benchmark/bm_para_hetero.rb
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/parallel/benchmark/bm_para_mandelbrot.rb
===================================================================
--- branches/parallel/benchmark/bm_para_mandelbrot.rb	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/benchmark/bm_para_mandelbrot.rb	2006-09-07 11:00:41 UTC (rev 557)
@@ -0,0 +1,35 @@
+def work n=8
+  (1..n).map{
+    Thread.new{
+      yield
+    }
+  }.each{|t|
+    t.join
+  }
+end
+
+require 'complex'
+
+def mandelbrot? z
+  i = 0
+  while i<100
+    i+=1
+    z = z * z
+    return false if z.abs > 2
+  end
+  true
+end
+
+work{
+  ary = []
+  (0..100).each{|dx|
+    (0..100).each{|dy|
+      x = dx / 50.0
+      y = dy / 50.0
+      c = Complex(x, y)
+      #mandelbrot?(c)
+      ary << c if mandelbrot?(c)
+    }
+  }
+}
+


Property changes on: branches/parallel/benchmark/bm_para_mandelbrot.rb
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/parallel/benchmark/bm_para_tak.rb
===================================================================
--- branches/parallel/benchmark/bm_para_tak.rb	2006-09-06 13:44:33 UTC (rev 556)
+++ branches/parallel/benchmark/bm_para_tak.rb	2006-09-07 11:00:41 UTC (rev 557)
@@ -0,0 +1,24 @@
+
+def work n=8
+  (1..n).map{
+    Thread.new{
+      yield
+    }
+  }.each{|t|
+    t.join
+  }
+end
+
+def tak x, y, z
+  unless y < x
+    z
+  else
+    tak( tak(x-1, y, z),
+         tak(y-1, z, x),
+         tak(z-1, x, y))
+  end
+end
+
+work{
+  tak(16, 8, 0)
+}


Property changes on: branches/parallel/benchmark/bm_para_tak.rb
___________________________________________________________________
Name: svn:executable
   + *


--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]