comp_tree 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.rdoc +9 -1
- data/MANIFEST +2 -3
- data/README.rdoc +16 -12
- data/Rakefile +5 -4
- data/devel/{jumpstart.rb → levitate.rb} +236 -273
- data/lib/comp_tree.rb +52 -2
- data/lib/comp_tree/algorithm.rb +23 -26
- data/lib/comp_tree/driver.rb +19 -26
- data/lib/comp_tree/queue/queue_18.rb +1 -3
- data/lib/comp_tree/queue/queue_19.rb +1 -3
- data/lib/comp_tree/version.rb +3 -0
- data/test/basic_test.rb +15 -12
- data/test/circular_test.rb +2 -2
- data/test/comp_tree_test_base.rb +3 -2
- data/test/drain_test.rb +3 -5
- data/test/exception_test.rb +6 -9
- data/test/flood_test.rb +3 -3
- data/test/grind_test.rb +3 -5
- data/test/readme_test.rb +3 -3
- data/test/sequential_test.rb +3 -3
- data/test/throw_test.rb +2 -2
- metadata +13 -42
- data/install.rb +0 -2
- data/lib/comp_tree/comp_tree.rb +0 -55
data/test/grind_test.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/comp_tree_test_base'
|
2
|
-
|
3
|
-
class TestGrind < Test::Unit::TestCase
|
4
|
-
include TestBase
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/comp_tree_test_base'
|
5
2
|
|
3
|
+
class GrindTest < CompTreeTest
|
6
4
|
GENERATOR_DATA = {
|
7
5
|
:level_range => 1..5,
|
8
6
|
:children_range => 1..5,
|
9
|
-
:thread_range =>
|
7
|
+
:thread_range => 0..10,
|
10
8
|
:drain_iterations => 30,
|
11
9
|
}
|
12
10
|
|
data/test/readme_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/comp_tree_test_base'
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "levitate"
|
4
4
|
|
5
|
-
|
5
|
+
Levitate.doc_to_test("README.rdoc", "Synopsis")
|
data/test/sequential_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/comp_tree_test_base'
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/comp_tree_test_base'
|
2
2
|
|
3
|
-
class
|
3
|
+
class SequentialTest < CompTreeTest
|
4
4
|
def test_sequential
|
5
|
-
(
|
5
|
+
(0..50).each { |num_threads|
|
6
6
|
[1, 2, 3, 20, 50].each { |num_nodes|
|
7
7
|
CompTree.build { |driver|
|
8
8
|
driver.define(:root) { true }
|
data/test/throw_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/comp_tree_test_base'
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/comp_tree_test_base'
|
2
2
|
|
3
|
-
class
|
3
|
+
class ThrowTest < CompTreeTest
|
4
4
|
EXPECTED = RUBY_VERSION >= "1.9.0" ? ArgumentError : ThreadError
|
5
5
|
|
6
6
|
def test_throw
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comp_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.0
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- James M. Lawrence
|
@@ -9,7 +10,7 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2011-03-02 00:00:00 -05:00
|
13
14
|
default_executable:
|
14
15
|
dependencies: []
|
15
16
|
|
@@ -22,21 +23,21 @@ extensions: []
|
|
22
23
|
|
23
24
|
extra_rdoc_files:
|
24
25
|
- README.rdoc
|
26
|
+
- CHANGES.rdoc
|
25
27
|
files:
|
26
28
|
- CHANGES.rdoc
|
27
29
|
- README.rdoc
|
28
30
|
- Rakefile
|
29
|
-
- devel/
|
30
|
-
- install.rb
|
31
|
+
- devel/levitate.rb
|
31
32
|
- lib/comp_tree.rb
|
32
33
|
- lib/comp_tree/algorithm.rb
|
33
|
-
- lib/comp_tree/comp_tree.rb
|
34
34
|
- lib/comp_tree/driver.rb
|
35
35
|
- lib/comp_tree/error.rb
|
36
36
|
- lib/comp_tree/node.rb
|
37
37
|
- lib/comp_tree/queue/queue.rb
|
38
38
|
- lib/comp_tree/queue/queue_18.rb
|
39
39
|
- lib/comp_tree/queue/queue_19.rb
|
40
|
+
- lib/comp_tree/version.rb
|
40
41
|
- test/basic_test.rb
|
41
42
|
- test/circular_test.rb
|
42
43
|
- test/comp_tree_test_base.rb
|
@@ -49,7 +50,7 @@ files:
|
|
49
50
|
- test/throw_test.rb
|
50
51
|
- MANIFEST
|
51
52
|
has_rdoc: true
|
52
|
-
homepage: http://
|
53
|
+
homepage: http://quix.github.com/comp_tree
|
53
54
|
licenses: []
|
54
55
|
|
55
56
|
post_install_message:
|
@@ -59,18 +60,6 @@ rdoc_options:
|
|
59
60
|
- --title
|
60
61
|
- "comp_tree: A simple framework for automatic parallelism."
|
61
62
|
- --exclude
|
62
|
-
- CHANGES.rdoc
|
63
|
-
- --exclude
|
64
|
-
- README.rdoc
|
65
|
-
- --exclude
|
66
|
-
- Rakefile
|
67
|
-
- --exclude
|
68
|
-
- devel/jumpstart.rb
|
69
|
-
- --exclude
|
70
|
-
- install.rb
|
71
|
-
- --exclude
|
72
|
-
- lib/comp_tree.rb
|
73
|
-
- --exclude
|
74
63
|
- lib/comp_tree/algorithm.rb
|
75
64
|
- --exclude
|
76
65
|
- lib/comp_tree/node.rb
|
@@ -81,45 +70,27 @@ rdoc_options:
|
|
81
70
|
- --exclude
|
82
71
|
- lib/comp_tree/queue/queue_19.rb
|
83
72
|
- --exclude
|
84
|
-
-
|
85
|
-
- --exclude
|
86
|
-
- test/circular_test.rb
|
87
|
-
- --exclude
|
88
|
-
- test/comp_tree_test_base.rb
|
89
|
-
- --exclude
|
90
|
-
- test/drain_test.rb
|
91
|
-
- --exclude
|
92
|
-
- test/exception_test.rb
|
93
|
-
- --exclude
|
94
|
-
- test/flood_test.rb
|
95
|
-
- --exclude
|
96
|
-
- test/grind_test.rb
|
97
|
-
- --exclude
|
98
|
-
- test/readme_test.rb
|
99
|
-
- --exclude
|
100
|
-
- test/sequential_test.rb
|
101
|
-
- --exclude
|
102
|
-
- test/throw_test.rb
|
73
|
+
- lib/comp_tree/version.rb
|
103
74
|
- --exclude
|
104
|
-
-
|
75
|
+
- lib/comp_tree.rb
|
105
76
|
require_paths:
|
106
77
|
- lib
|
107
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
108
80
|
requirements:
|
109
81
|
- - ">="
|
110
82
|
- !ruby/object:Gem::Version
|
111
83
|
version: "0"
|
112
|
-
version:
|
113
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
114
86
|
requirements:
|
115
87
|
- - ">="
|
116
88
|
- !ruby/object:Gem::Version
|
117
89
|
version: "0"
|
118
|
-
version:
|
119
90
|
requirements: []
|
120
91
|
|
121
|
-
rubyforge_project:
|
122
|
-
rubygems_version: 1.3
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.5.3
|
123
94
|
signing_key:
|
124
95
|
specification_version: 3
|
125
96
|
summary: A simple framework for automatic parallelism.
|
data/install.rb
DELETED
data/lib/comp_tree/comp_tree.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# CompTree -- Parallel Computation Tree.
|
4
|
-
#
|
5
|
-
# See README.rdoc.
|
6
|
-
#
|
7
|
-
module CompTree
|
8
|
-
VERSION = "1.0.1"
|
9
|
-
|
10
|
-
class << self
|
11
|
-
#
|
12
|
-
# :call-seq:
|
13
|
-
# build { |driver| ... }
|
14
|
-
#
|
15
|
-
# Build a new computation tree. A Driver instance is passed to the
|
16
|
-
# given block.
|
17
|
-
#
|
18
|
-
# Example:
|
19
|
-
# CompTree.build do |driver|
|
20
|
-
#
|
21
|
-
# # Define a function named 'area' taking these two arguments.
|
22
|
-
# driver.define(:area, :width, :height) { |width, height|
|
23
|
-
# width*height
|
24
|
-
# }
|
25
|
-
#
|
26
|
-
# # Define a function 'width' which takes a 'border' argument.
|
27
|
-
# driver.define(:width, :border) { |border|
|
28
|
-
# 7 + border
|
29
|
-
# }
|
30
|
-
#
|
31
|
-
# # Ditto for 'height'.
|
32
|
-
# driver.define(:height, :border) { |border|
|
33
|
-
# 5 + border
|
34
|
-
# }
|
35
|
-
#
|
36
|
-
# #
|
37
|
-
# # Define a constant function 'border'.
|
38
|
-
# driver.define(:border) {
|
39
|
-
# 2
|
40
|
-
# }
|
41
|
-
#
|
42
|
-
# # Compute the area using four parallel threads.
|
43
|
-
# puts driver.compute(:area, 4)
|
44
|
-
# # => 63
|
45
|
-
#
|
46
|
-
# # We've done this computation.
|
47
|
-
# puts((7 + 2)*(5 + 2))
|
48
|
-
# # => 63
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
def build(opts = {})
|
52
|
-
yield Driver.new(opts)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|