drake 0.8.2.1.0.6 → 0.8.2.1.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.drake CHANGED
@@ -1,6 +1,11 @@
1
1
 
2
2
  = Drake Changelog
3
3
 
4
+ == Version 0.8.2.1.0.7
5
+
6
+ * new --rand option, suggested by Thomas Sawyer.
7
+ * merged latest cleaned-up comp_tree
8
+
4
9
  == Version 0.8.2.1.0.6
5
10
 
6
11
  * Restored original 'multitask' behavior when -j1 (default)
data/README CHANGED
@@ -75,6 +75,43 @@ other tasks is rather contrary to this notion, throwing a monkey
75
75
  wrench into the system. An exception will be raised when this is
76
76
  attempted in multi-threaded mode.
77
77
 
78
+ === Migrating to -j
79
+
80
+ First of all, do you want to bother with <tt>-j</tt>? If you are
81
+ satisfied with your build time, then there is really no reason to use
82
+ it.
83
+
84
+ If on the other hand your build takes twenty minutes to complete, you
85
+ may be interested in investing some time getting the full dependency
86
+ tree correct in order to take advantage of multiple CPUs or cores.
87
+
88
+ Though there is no way for Drake to fathom what <em>you</em> mean by a
89
+ correct dependency, there is a tool available which helps you get
90
+ closer to saying what you mean.
91
+
92
+ % drake --rand[=SEED]
93
+
94
+ This will randomize the order of sibling prerequisites for each task.
95
+ When given the optional SEED integer, it will call
96
+ <tt>srand(SEED)</tt> to produce the same permutation each time. The
97
+ randomize option also disables +multitask+.
98
+
99
+ Though this option may produce an error due to an unspecified
100
+ dependency, at least it will be an error which is exactly the same on
101
+ each run (with SEED). In addition, you'll have the major debugging
102
+ advantage of using a single thread.
103
+
104
+ This option will also work in multi-threaded mode. After all, once
105
+ <tt>-jN</tt> is running smoothly there is <em>still</em> no guarantee
106
+ that you have it right. However with each successful execution of
107
+ <tt>drake -jN --rand</tt>, the probability of correctness approaches 1
108
+ (though asymptotically so).
109
+
110
+ (The only way to <em>prove</em> correctness is to test <em>all</em>
111
+ such permutations, which for any non-trivial project would be
112
+ prohibitively large, especially those which meaningfully benefit from
113
+ <tt>-j</tt>.)
114
+
78
115
  == Links
79
116
 
80
117
  * Download: http://rubyforge.org/frs/?group_id=6530
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.2.1.0.6'
32
+ RAKEVERSION = '0.8.2.1.0.7'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'getoptlong'
@@ -595,6 +595,11 @@ module Rake
595
595
  end
596
596
  return if @already_invoked
597
597
  @already_invoked = true
598
+
599
+ if application.options.randomize
600
+ @prerequisites = @prerequisites.sort_by { rand }
601
+ end
602
+
598
603
  prereqs =
599
604
  if application.num_threads == 1
600
605
  invoke_prerequisites(task_args, new_chain)
@@ -602,6 +607,7 @@ module Rake
602
607
  else
603
608
  invoke_prerequisites_parallel(task_args, new_chain)
604
609
  end
610
+
605
611
  if needed?
606
612
  if application.num_threads == 1
607
613
  execute(task_args)
@@ -2276,9 +2282,15 @@ module Rake
2276
2282
  ['--threads', '-j N', "Specifies the number of threads to run simultaneously.",
2277
2283
  lambda { |value| self.num_threads = value.to_i }
2278
2284
  ],
2279
- #['--fork', '-k', "When --threads=N given, run each thread in a separate process.",
2280
- # lambda { options.fork = true }
2281
- #],
2285
+ ['--rand[=SEED]', "Randomize task prerequisite orders",
2286
+ lambda { |value|
2287
+ MultiTask.class_eval { remove_method(:invoke_prerequisites) }
2288
+ options.randomize = true
2289
+ if value
2290
+ srand(value.to_i)
2291
+ end
2292
+ }
2293
+ ],
2282
2294
  ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
2283
2295
  lambda { |value| $:.push(value) }
2284
2296
  ],
@@ -1,10 +1,10 @@
1
1
 
2
- require 'rake/comp_tree/quix/diagnostic'
2
+ require 'rake/comp_tree/diagnostic'
3
3
  require 'rake/comp_tree/retriable_fork'
4
4
 
5
5
  module Rake::CompTree
6
6
  module Algorithm
7
- include Quix::Diagnostic
7
+ include Diagnostic
8
8
 
9
9
  def compute_multithreaded(root, num_threads, use_fork, buckets)
10
10
  trace "Computing #{root.name} with #{num_threads} threads"
@@ -3,13 +3,13 @@ require 'drb'
3
3
  require 'thread'
4
4
 
5
5
  require 'rake/comp_tree/retriable_fork'
6
- require 'rake/comp_tree/quix/diagnostic'
7
- require 'rake/comp_tree/quix/builtin/kernel/tap'
6
+ require 'rake/comp_tree/diagnostic'
7
+ require 'rake/comp_tree/tap'
8
8
 
9
9
  module Rake::CompTree
10
10
  module BucketIPC
11
11
  class Bucket
12
- include Quix::Diagnostic
12
+ include Diagnostic
13
13
  include RetriableFork
14
14
 
15
15
  def initialize(address, timeout, wait_interval)
@@ -1,7 +1,7 @@
1
1
 
2
- require 'rake/comp_tree/quix/builtin/kernel/tap'
2
+ require 'rake/comp_tree/tap'
3
3
 
4
- module Rake::CompTree::Quix
4
+ module Rake::CompTree
5
5
  module Diagnostic
6
6
  def show(desc = nil, stream = STDOUT, &block)
7
7
  if desc
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'rake/comp_tree/bucket_ipc'
3
- require 'rake/comp_tree/quix/diagnostic'
4
- require 'rake/comp_tree/quix/kernel'
3
+ require 'rake/comp_tree/diagnostic'
4
+ require 'rake/comp_tree/misc'
5
5
  require 'rake/comp_tree/algorithm'
6
6
  require 'rake/comp_tree/node'
7
7
  require 'rake/comp_tree/task_node'
@@ -22,8 +22,8 @@ module Rake::CompTree
22
22
  :wait_interval => 0.02,
23
23
  }
24
24
 
25
- include Quix::Diagnostic #:nodoc:
26
- include Quix::Kernel #:nodoc:
25
+ include Diagnostic
26
+ include Misc
27
27
 
28
28
  #
29
29
  # Begin a new computation tree.
@@ -1,8 +1,8 @@
1
1
 
2
2
  require 'thread'
3
3
 
4
- module Rake::CompTree::Quix
5
- module Kernel
4
+ module Rake::CompTree
5
+ module Misc
6
6
  def let
7
7
  yield self
8
8
  end
@@ -1,5 +1,5 @@
1
1
 
2
- require 'rake/comp_tree/quix/diagnostic'
2
+ require 'rake/comp_tree/diagnostic'
3
3
  require 'thread'
4
4
 
5
5
  module Rake::CompTree
@@ -7,7 +7,7 @@ module Rake::CompTree
7
7
  # Base class for nodes in the computation tree.
8
8
  #
9
9
  class Node
10
- include Quix::Diagnostic #:nodoc:
10
+ include Diagnostic
11
11
 
12
12
  attr_reader :name #:nodoc:
13
13
 
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.2.1.0.6
4
+ version: 0.8.2.1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -71,13 +71,13 @@ files:
71
71
  - lib/rake.rb
72
72
  - lib/rake/comp_tree/algorithm.rb
73
73
  - lib/rake/comp_tree/bucket_ipc.rb
74
+ - lib/rake/comp_tree/diagnostic.rb
74
75
  - lib/rake/comp_tree/driver.rb
75
76
  - lib/rake/comp_tree/error.rb
77
+ - lib/rake/comp_tree/misc.rb
76
78
  - lib/rake/comp_tree/node.rb
77
- - lib/rake/comp_tree/quix/builtin/kernel/tap.rb
78
- - lib/rake/comp_tree/quix/diagnostic.rb
79
- - lib/rake/comp_tree/quix/kernel.rb
80
79
  - lib/rake/comp_tree/retriable_fork.rb
80
+ - lib/rake/comp_tree/tap.rb
81
81
  - lib/rake/comp_tree/task_node.rb
82
82
  - test/capture_stdout.rb
83
83
  - test/check_expansion.rb