drake 0.8.4.1.0.17 → 0.8.4.1.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.drake CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  = Drake Changelog
3
3
 
4
- == Version 0.8.4.1.0.16
4
+ == Version 0.8.4.1.0.16-18
5
5
 
6
6
  * Merge with latest comp_tree.
7
7
 
data/lib/rake.rb CHANGED
@@ -29,7 +29,7 @@
29
29
  # as a library via a require statement, but it can be distributed
30
30
  # independently as an application.
31
31
 
32
- RAKEVERSION = '0.8.4.1.0.17'
32
+ RAKEVERSION = '0.8.4.1.0.18'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'fileutils'
@@ -1,11 +1,7 @@
1
1
 
2
- require 'rake/comp_tree/diagnostic'
3
-
4
2
  module Rake end
5
3
  module Rake::CompTree
6
4
  module Algorithm
7
- include Diagnostic
8
-
9
5
  module_function
10
6
 
11
7
  def loop_with(leave, again)
@@ -19,7 +15,7 @@ module Rake::CompTree
19
15
  end
20
16
 
21
17
  def compute_multithreaded(root, num_threads)
22
- trace "Computing #{root.name} with #{num_threads} threads"
18
+ #trace "Computing #{root.name} with #{num_threads} threads"
23
19
 
24
20
  result = nil
25
21
 
@@ -34,16 +30,16 @@ module Rake::CompTree
34
30
  # wait for main thread
35
31
  #
36
32
  tree_mutex.synchronize {
37
- trace "Thread #{thread_index} waiting to start"
33
+ #trace "Thread #{thread_index} waiting to start"
38
34
  num_threads_in_use += 1
39
35
  thread_wake_condition.wait(tree_mutex)
40
36
  }
41
37
 
42
38
  loop_with(:leave, :again) {
43
39
  node = tree_mutex.synchronize {
44
- trace "Thread #{thread_index} aquired tree lock; begin node search"
40
+ #trace "Thread #{thread_index} aquired tree lock; begin node search"
45
41
  if result
46
- trace "Thread #{thread_index} detected finish"
42
+ #trace "Thread #{thread_index} detected finish"
47
43
  num_threads_in_use -= 1
48
44
  throw :leave
49
45
  else
@@ -51,29 +47,29 @@ module Rake::CompTree
51
47
  # Find a node. The node we obtain, if any, will be locked.
52
48
  #
53
49
  if node = find_node(root)
54
- trace "Thread #{thread_index} found node #{node.name}"
50
+ #trace "Thread #{thread_index} found node #{node.name}"
55
51
  node
56
52
  else
57
- trace "Thread #{thread_index}: no node found; sleeping."
53
+ #trace "Thread #{thread_index}: no node found; sleeping."
58
54
  thread_wake_condition.wait(tree_mutex)
59
55
  throw :again
60
56
  end
61
57
  end
62
58
  }
63
59
 
64
- trace "Thread #{thread_index} computing node"
60
+ #trace "Thread #{thread_index} computing node"
65
61
  node_result = compute_node(node)
66
- trace "Thread #{thread_index} node computed; waiting for tree lock"
62
+ #trace "Thread #{thread_index} node computed; waiting for tree lock"
67
63
 
68
64
  tree_mutex.synchronize {
69
- trace "Thread #{thread_index} acquired tree lock"
70
- debug {
71
- name = "#{node.name}" + ((node == root) ? " (ROOT NODE)" : "")
72
- initial = "Thread #{thread_index} compute result for #{name}: "
73
- status = node_result.is_a?(Exception) ? "error" : "success"
74
- trace initial + status
75
- trace "Thread #{thread_index} node result: #{node_result}"
76
- }
65
+ #trace "Thread #{thread_index} acquired tree lock"
66
+ #debug {
67
+ # name = "#{node.name}" + ((node == root) ? " (ROOT NODE)" : "")
68
+ # initial = "Thread #{thread_index} compute result for #{name}: "
69
+ # status = node_result.is_a?(Exception) ? "error" : "success"
70
+ # trace initial + status
71
+ # trace "Thread #{thread_index} node result: #{node_result}"
72
+ #}
77
73
 
78
74
  node.result = node_result
79
75
 
@@ -95,33 +91,33 @@ module Rake::CompTree
95
91
  node_finished_condition.signal
96
92
  }
97
93
  }
98
- trace "Thread #{thread_index} exiting"
94
+ #trace "Thread #{thread_index} exiting"
99
95
  }
100
96
  }
101
97
 
102
- trace "Main: waiting for threads to launch and block."
98
+ #trace "Main: waiting for threads to launch and block."
103
99
  until tree_mutex.synchronize { num_threads_in_use == num_threads }
104
100
  Thread.pass
105
101
  end
106
102
 
107
103
  tree_mutex.synchronize {
108
- trace "Main: entering main loop"
104
+ #trace "Main: entering main loop"
109
105
  until num_threads_in_use == 0
110
- trace "Main: waking threads"
106
+ #trace "Main: waking threads"
111
107
  thread_wake_condition.broadcast
112
108
 
113
109
  if result
114
- trace "Main: detected finish."
110
+ #trace "Main: detected finish."
115
111
  break
116
112
  end
117
113
 
118
- trace "Main: waiting for a node"
114
+ #trace "Main: waiting for a node"
119
115
  node_finished_condition.wait(tree_mutex)
120
- trace "Main: got a node"
116
+ #trace "Main: got a node"
121
117
  end
122
118
  }
123
119
 
124
- trace "Main: waiting for threads to finish."
120
+ #trace "Main: waiting for threads to finish."
125
121
  loop_with(:leave, :again) {
126
122
  tree_mutex.synchronize {
127
123
  if threads.all? { |thread| thread.status == false }
@@ -132,7 +128,7 @@ module Rake::CompTree
132
128
  Thread.pass
133
129
  }
134
130
 
135
- trace "Main: computation done."
131
+ #trace "Main: computation done."
136
132
  if result.is_a? Exception
137
133
  raise result
138
134
  else
@@ -142,12 +138,12 @@ module Rake::CompTree
142
138
 
143
139
  def find_node(node)
144
140
  # --- only called inside shared tree mutex
145
- trace "Looking for a node, starting with #{node.name}"
141
+ #trace "Looking for a node, starting with #{node.name}"
146
142
  if node.result
147
143
  #
148
144
  # already computed
149
145
  #
150
- trace "#{node.name} has been computed"
146
+ #trace "#{node.name} has been computed"
151
147
  nil
152
148
  elsif (children_results = node.find_children_results) and node.try_lock
153
149
  #
@@ -160,7 +156,7 @@ module Rake::CompTree
160
156
  #
161
157
  # locked or children not computed; recurse to children
162
158
  #
163
- trace "Checking #{node.name}'s children"
159
+ #trace "Checking #{node.name}'s children"
164
160
  node.each_child { |child|
165
161
  if next_node = find_node(child)
166
162
  return next_node
@@ -172,7 +168,6 @@ module Rake::CompTree
172
168
 
173
169
  def compute_node(node)
174
170
  begin
175
- node.trace_compute
176
171
  node.compute
177
172
  rescue Exception => e
178
173
  e
@@ -1,5 +1,4 @@
1
1
 
2
- require 'rake/comp_tree/diagnostic'
3
2
  require 'rake/comp_tree/algorithm'
4
3
  require 'rake/comp_tree/node'
5
4
  require 'rake/comp_tree/error'
@@ -13,7 +12,6 @@ module Rake::CompTree
13
12
  # responsible for defining nodes and running computations.
14
13
  #
15
14
  class Driver
16
- include Diagnostic
17
15
  include Algorithm
18
16
 
19
17
  #
@@ -1,5 +1,4 @@
1
1
 
2
- require 'rake/comp_tree/diagnostic'
3
2
  require 'thread'
4
3
 
5
4
  module Rake end
@@ -8,8 +7,6 @@ module Rake::CompTree
8
7
  # Base class for nodes in the computation tree.
9
8
  #
10
9
  class Node
11
- include Diagnostic
12
-
13
10
  attr_reader :name #:nodoc:
14
11
 
15
12
  attr_accessor :parents #:nodoc:
@@ -98,15 +95,15 @@ module Rake::CompTree
98
95
  @children_results = value
99
96
  end
100
97
 
101
- def trace_compute #:nodoc:
102
- debug {
103
- # --- own mutex
104
- trace "Computing #{@name}"
105
- raise Error::AssertionFailed if @result
106
- raise Error::AssertionFailed unless @mutex.locked?
107
- raise Error::AssertionFailed unless @children_results
108
- }
109
- end
98
+ #def trace_compute #:nodoc:
99
+ # debug {
100
+ # # --- own mutex
101
+ # trace "Computing #{@name}"
102
+ # raise Error::AssertionFailed if @result
103
+ # raise Error::AssertionFailed unless @mutex.locked?
104
+ # raise Error::AssertionFailed unless @children_results
105
+ # }
106
+ #end
110
107
 
111
108
  #
112
109
  # Compute this node; children must be computed and lock must be
@@ -123,10 +120,10 @@ module Rake::CompTree
123
120
  def try_lock #:nodoc:
124
121
  # --- shared tree mutex and own mutex
125
122
  if @shared_lock == 0 and @mutex.try_lock
126
- trace "Locking #{@name}"
123
+ #trace "Locking #{@name}"
127
124
  each_upward { |node|
128
125
  node.shared_lock += 1
129
- trace "#{node.name} locked by #{@name}: level: #{node.shared_lock}"
126
+ #trace "#{node.name} locked by #{@name}: level: #{node.shared_lock}"
130
127
  }
131
128
  true
132
129
  else
@@ -136,17 +133,17 @@ module Rake::CompTree
136
133
 
137
134
  def unlock #:nodoc:
138
135
  # --- shared tree mutex and own mutex
139
- debug {
140
- raise Error::AssertionFailed unless @mutex.locked?
141
- trace "Unlocking #{@name}"
142
- }
136
+ #debug {
137
+ # raise Error::AssertionFailed unless @mutex.locked?
138
+ # trace "Unlocking #{@name}"
139
+ #}
143
140
  each_upward { |node|
144
141
  node.shared_lock -= 1
145
- debug {
146
- if node.shared_lock == 0
147
- trace "#{node.name} unlocked by #{@name}"
148
- end
149
- }
142
+ #debug {
143
+ # if node.shared_lock == 0
144
+ # trace "#{node.name} unlocked by #{@name}"
145
+ # end
146
+ #}
150
147
  }
151
148
  @mutex.unlock
152
149
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4.1.0.17
4
+ version: 0.8.4.1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-01 00:00:00 -04:00
12
+ date: 2009-04-02 00:00:00 -04:00
13
13
  default_executable: drake
14
14
  dependencies: []
15
15