comp_tree 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_grind.rb CHANGED
@@ -4,10 +4,10 @@ class TestGrind < Test::Unit::TestCase
4
4
  include TestCommon
5
5
 
6
6
  GENERATOR_DATA = {
7
- :level_range => 1..4,
8
- :children_range => 1..6,
9
- :thread_range => 1..6,
10
- :drain_iterations => 0,
7
+ :level_range => 1..10,
8
+ :children_range => 1..10,
9
+ :thread_range => 1..10,
10
+ :drain_iterations => 30,
11
11
  }
12
12
 
13
13
  ROOT = 'a'
@@ -53,21 +53,22 @@ class TestGrind < Test::Unit::TestCase
53
53
  args[:level_range].each { |num_levels|
54
54
  args[:children_range].each { |num_children|
55
55
  separator
56
- bench_output {%{num_levels}}
57
- bench_output {%{num_children}}
56
+ #bench_output {%{num_levels}}
57
+ #bench_output {%{num_children}}
58
58
  driver = generate_comp_tree(
59
59
  num_levels,
60
60
  num_children,
61
61
  args[:drain_iterations])
62
62
  args[:thread_range].each { |threads|
63
- bench_output {%{threads}}
63
+ #bench_output {%{threads}}
64
64
  2.times {
65
65
  driver.reset(ROOT)
66
- result = nil
67
- bench = Benchmark.measure {
68
- result = driver.compute(ROOT, threads)
69
- }
70
- bench_output bench
66
+ #result = nil
67
+ #bench = Benchmark.measure {
68
+ # result = driver.compute(ROOT, threads)
69
+ #}
70
+ result = driver.compute(ROOT, threads)
71
+ #bench_output bench
71
72
  assert_equal(result, args[:drain_iterations])
72
73
  }
73
74
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comp_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -9,12 +9,13 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-12 00:00:00 -04:00
12
+ date: 2009-04-20 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: Build a computation tree and execute it with N parallel threads.
17
- email: quixoticsycophant@gmail.com
16
+ description: A computation tree for pure functional programming in Ruby.
17
+ email:
18
+ - quixoticsycophant@gmail.com
18
19
  executables: []
19
20
 
20
21
  extensions: []
@@ -22,19 +23,19 @@ extensions: []
22
23
  extra_rdoc_files:
23
24
  - README.rdoc
24
25
  files:
25
- - CHANGES
26
+ - CHANGES.rdoc
26
27
  - README.rdoc
27
28
  - Rakefile
28
- - comp_tree.gemspec
29
+ - devel/jumpstart.rb
30
+ - devel/jumpstart/lazy_attribute.rb
31
+ - devel/jumpstart/ruby.rb
32
+ - devel/jumpstart/simple_installer.rb
29
33
  - install.rb
34
+ - lib/comp_tree.rb
30
35
  - lib/comp_tree/algorithm.rb
31
36
  - lib/comp_tree/driver.rb
32
37
  - lib/comp_tree/error.rb
33
38
  - lib/comp_tree/node.rb
34
- - lib/comp_tree.rb
35
- - rakelib/jumpstart.rake
36
- - rakelib/jumpstart/ruby.rb
37
- - rakelib/jumpstart/simple_installer.rb
38
39
  - test/common.rb
39
40
  - test/test_basic.rb
40
41
  - test/test_circular.rb
@@ -44,29 +45,29 @@ files:
44
45
  - test/test_grind.rb
45
46
  - test/test_sequential.rb
46
47
  has_rdoc: true
47
- homepage: comptree.rubyforge.org
48
+ homepage: http://comptree.rubyforge.org
48
49
  post_install_message:
49
50
  rdoc_options:
50
51
  - --main
51
52
  - README.rdoc
52
53
  - --title
53
- - "comp_tree: Parallel Computation Tree"
54
+ - "comp_tree: Automatic parallelism and lazy evaluation."
54
55
  - --exclude
55
- - CHANGES
56
+ - CHANGES.rdoc
56
57
  - --exclude
57
- - Rakefile
58
+ - README.rdoc
58
59
  - --exclude
59
- - comp_tree.gemspec
60
+ - Rakefile
60
61
  - --exclude
61
- - install.rb
62
+ - devel/jumpstart.rb
62
63
  - --exclude
63
- - lib/comp_tree/algorithm.rb
64
+ - devel/jumpstart/lazy_attribute.rb
64
65
  - --exclude
65
- - rakelib/jumpstart.rake
66
+ - devel/jumpstart/ruby.rb
66
67
  - --exclude
67
- - rakelib/jumpstart/ruby.rb
68
+ - devel/jumpstart/simple_installer.rb
68
69
  - --exclude
69
- - rakelib/jumpstart/simple_installer.rb
70
+ - install.rb
70
71
  - --exclude
71
72
  - test/common.rb
72
73
  - --exclude
@@ -103,6 +104,6 @@ rubyforge_project: comptree
103
104
  rubygems_version: 1.3.1
104
105
  signing_key:
105
106
  specification_version: 2
106
- summary: Parallel Computation Tree
107
+ summary: Automatic parallelism and lazy evaluation.
107
108
  test_files: []
108
109
 
data/comp_tree.gemspec DELETED
@@ -1,42 +0,0 @@
1
-
2
- Gem::Specification.new { |g|
3
- g.author = "James M. Lawrence"
4
- g.email = "quixoticsycophant@gmail.com"
5
- g.summary = "Parallel Computation Tree"
6
- g.name = "comp_tree"
7
- g.rubyforge_project = "comptree"
8
- g.homepage = "comptree.rubyforge.org"
9
- g.version = "0.7.1"
10
- g.description =
11
- "Build a computation tree and execute it with N parallel threads."
12
-
13
- readme = "README.rdoc"
14
-
15
- g.files = %W[
16
- CHANGES
17
- #{readme}
18
- Rakefile
19
- #{g.name}.gemspec
20
- install.rb
21
- ] + %w[lib rakelib test].inject(Array.new) { |acc, dir|
22
- acc + Dir[dir + "/**/*.{rake,rb}"]
23
- }
24
- g.has_rdoc = true
25
- rdoc_files = [
26
- readme,
27
- "lib/comp_tree.rb",
28
- "lib/comp_tree/driver.rb",
29
- "lib/comp_tree/error.rb",
30
- "lib/comp_tree/node.rb",
31
- ]
32
- g.extra_rdoc_files += [readme]
33
-
34
- g.rdoc_options += [
35
- "--main",
36
- readme,
37
- "--title",
38
- "#{g.name}: #{g.summary}"
39
- ] + (g.files - rdoc_files).inject(Array.new) { |acc, file|
40
- acc + ["--exclude", file]
41
- }
42
- }
@@ -1,365 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
-
3
- require 'rake/gempackagetask'
4
- require 'rake/contrib/sshpublisher'
5
- require 'rake/clean'
6
- require 'rdoc/rdoc'
7
-
8
- require "jumpstart/simple_installer"
9
- require "jumpstart/ruby"
10
-
11
- ######################################################################
12
- # constants
13
-
14
- unless defined?(RUBYFORGE_USER)
15
- RUBYFORGE_USER = "quix"
16
- end
17
-
18
- GEMSPEC = eval(File.read(Dir["*.gemspec"].last))
19
-
20
- DOC_DIR = "documentation"
21
- SPEC_FILES = Dir['spec/*_spec.rb'] + Dir['examples/*_example.rb']
22
- TEST_FILES = Dir['test/test_*.rb']
23
- RCOV_DIR = "coverage"
24
- SPEC_OUTPUT = "spec.html"
25
-
26
- RCOV_OPTIONS = Dir["*"].select { |file|
27
- File.directory?(file) and file != "lib"
28
- }.inject(Array.new) { |acc, file|
29
- acc + ["--exclude", file + "/"]
30
- }
31
-
32
- ######################################################################
33
- # spec
34
-
35
- unless SPEC_FILES.empty?
36
- require 'spec/rake/spectask'
37
-
38
- desc "run specs"
39
- Spec::Rake::SpecTask.new('spec') do |t|
40
- t.spec_files = SPEC_FILES
41
- end
42
-
43
- desc "run specs with text output"
44
- Spec::Rake::SpecTask.new('text_spec') do |t|
45
- t.spec_files = SPEC_FILES
46
- t.spec_opts = ['-fs']
47
- end
48
-
49
- desc "run specs with html output"
50
- Spec::Rake::SpecTask.new('full_spec') do |t|
51
- t.spec_files = SPEC_FILES
52
- t.rcov = true
53
- t.rcov_opts = RCOV_OPTIONS
54
- t.spec_opts = ["-fh:#{SPEC_OUTPUT}"]
55
- end
56
-
57
- desc "run full_spec then open browser"
58
- task :show_spec => :full_spec do
59
- open_browser(SPEC_OUTPUT, RCOV_DIR + "/index.html")
60
- end
61
-
62
- desc "run specs individually"
63
- task :spec_deps do
64
- run_ruby_on_each(*SPEC_FILES)
65
- end
66
-
67
- task :prerelease => :spec_deps
68
-
69
- task :default => :spec
70
-
71
- CLEAN.include(SPEC_OUTPUT)
72
- end
73
-
74
- ######################################################################
75
- # test
76
-
77
- unless TEST_FILES.empty?
78
- desc "run tests"
79
- task :test do
80
- TEST_FILES.each { |file|
81
- require file
82
- }
83
- end
84
-
85
- desc "run tests with rcov"
86
- task :full_test do
87
- previous = RakeFileUtils.verbose_flag
88
- begin
89
- sh("rcov", "-o", RCOV_DIR, *(TEST_FILES + RCOV_OPTIONS))
90
- ensure
91
- RakeFileUtils.verbose_flag = previous
92
- end
93
- end
94
-
95
- desc "run full_test then open browser"
96
- task :show_test => :full_test do
97
- open_browser(RCOV_DIR + "/index.html")
98
- end
99
-
100
- desc "run tests individually"
101
- task :test_deps do
102
- run_ruby_on_each(*TEST_FILES)
103
- end
104
-
105
- task :prerelease => :test_deps
106
- task :default => :test
107
-
108
- CLEAN.include RCOV_DIR
109
- end
110
-
111
- ######################################################################
112
- # clean
113
-
114
- task :clean do
115
- Rake::Task[:clobber].invoke
116
- end
117
-
118
- ######################################################################
119
- # package
120
-
121
- task :package => :clean
122
- task :gem => :clean
123
-
124
- Rake::GemPackageTask.new(GEMSPEC) { |t|
125
- t.need_tar = true
126
- }
127
-
128
- ######################################################################
129
- # doc
130
-
131
- #
132
- # Try to mimic the gem documentation
133
- #
134
- desc "run rdoc"
135
- task :doc => :clean_doc do
136
- args = (
137
- GEMSPEC.rdoc_options +
138
- GEMSPEC.require_paths.clone +
139
- GEMSPEC.extra_rdoc_files +
140
- ["-o", DOC_DIR]
141
- ).flatten.map { |t| t.to_s }
142
- RDoc::RDoc.new.document args
143
- end
144
-
145
- task :clean_doc do
146
- # normally rm_rf, but mimic rake/clean
147
- rm_r(DOC_DIR) rescue nil
148
- end
149
-
150
- desc "run rdoc then open browser"
151
- task :show_doc => :doc do
152
- open_browser(DOC_DIR + "/index.html")
153
- end
154
-
155
- task :rdoc => :doc
156
- task :clean => :clean_doc
157
-
158
- ######################################################################
159
- # publisher
160
-
161
- desc "upload docs"
162
- task :publish => [:clean_doc, :doc] do
163
- Rake::SshDirPublisher.new(
164
- "#{RUBYFORGE_USER}@rubyforge.org",
165
- "/var/www/gforge-projects/#{GEMSPEC.rubyforge_project}",
166
- DOC_DIR
167
- ).upload
168
- end
169
-
170
- ######################################################################
171
- # install/uninstall
172
-
173
- desc "direct install (no gem)"
174
- task :install do
175
- Jumpstart::SimpleInstaller.new.run([])
176
- end
177
-
178
- desc "direct uninstall (no gem)"
179
- task :uninstall do
180
- Jumpstart::SimpleInstaller.new.run(["--uninstall"])
181
- end
182
-
183
- ######################################################################
184
- # debug
185
-
186
- def comment_src_dst(on)
187
- on ? ["", "#"] : ["#", ""]
188
- end
189
-
190
- def comment_regions(on, contents, start)
191
- src, dst = comment_src_dst(on)
192
- contents.gsub(%r!^(\s+)#{src}#{start}.*?^\1#{src}(\}|end)!m) { |chunk|
193
- indent = $1
194
- chunk.gsub(%r!^#{indent}#{src}!, "#{indent}#{dst}")
195
- }
196
- end
197
-
198
- def comment_lines(on, contents, start)
199
- src, dst = comment_src_dst(on)
200
- contents.gsub(%r!^(\s*)#{src}#{start}!) {
201
- $1 + dst + start
202
- }
203
- end
204
-
205
- def debug_info(enable)
206
- Find.find("lib", "test") { |path|
207
- if path =~ %r!\.rb\Z!
208
- replace_file(path) { |contents|
209
- result1 = comment_regions(!enable, contents, "def trace_")
210
- result2 = comment_regions(!enable, result1, "debug")
211
- comment_lines(!enable, result2, "trace")
212
- }
213
- end
214
- }
215
- end
216
-
217
- desc "enable debug and trace calls"
218
- task :debug_on do
219
- debug_info(true)
220
- end
221
-
222
- desc "disable debug and trace calls"
223
- task :debug_off do
224
- debug_info(false)
225
- end
226
-
227
- ######################################################################
228
- # check columns
229
-
230
- desc "check for columns > 80"
231
- task :check_columns do
232
- Dir["**/*.rb"].each { |file|
233
- File.read(file).scan(%r!^.{81}!) { |match|
234
- unless match =~ %r!http://!
235
- raise "#{file} greater than 80 columns"
236
- end
237
- }
238
- }
239
- end
240
-
241
- task :prerelease => :check_columns
242
-
243
- ######################################################################
244
- # comments
245
-
246
- task :comments do
247
- write_file("comments") {
248
- Array.new.tap { |result|
249
- (["Rakefile"] + Dir["**/*.{rb,rake}"]).each { |file|
250
- File.read(file).scan(%r!\#[^\{].*$!) { |match|
251
- result << match
252
- }
253
- }
254
- }.join("\n")
255
- }
256
- end
257
-
258
- ######################################################################
259
- # release
260
-
261
- def git(*args)
262
- sh("git", *args)
263
- end
264
-
265
- task :prerelease => :clean do
266
- unless `git status` =~ %r!nothing to commit \(working directory clean\)!
267
- raise "Directory not clean"
268
- end
269
- %w[github.com rubyforge.org].each { |server|
270
- cmd = "ping " + (
271
- if Config::CONFIG["host"] =~ %r!darwin!
272
- "-c2 #{server}"
273
- else
274
- "#{server} 2 2"
275
- end
276
- )
277
- unless `#{cmd}` =~ %r!0% packet loss!
278
- raise "No ping for #{server}"
279
- end
280
- }
281
- end
282
-
283
- def rubyforge(command, file)
284
- sh(
285
- "rubyforge",
286
- command,
287
- GEMSPEC.rubyforge_project,
288
- GEMSPEC.rubyforge_project,
289
- GEMSPEC.version.to_s,
290
- file
291
- )
292
- end
293
-
294
- task :finish_release do
295
- gem, tgz = %w(gem tgz).map { |ext|
296
- "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.#{ext}"
297
- }
298
-
299
- gem_md5, tgz_md5 = [gem, tgz].map { |file|
300
- "#{file}.md5".tap { |md5|
301
- sh("md5sum #{file} > #{md5}")
302
- }
303
- }
304
-
305
- rubyforge("add_release", gem)
306
- [gem_md5, tgz, tgz_md5].each { |file|
307
- rubyforge("add_file", file)
308
- }
309
-
310
- git("tag", "#{GEMSPEC.name}-" + GEMSPEC.version.to_s)
311
- git(*%w(push --tags origin master))
312
- end
313
-
314
- task :release =>
315
- [
316
- :prerelease,
317
- :package,
318
- :publish,
319
- :finish_release,
320
- ]
321
-
322
- ######################################################################
323
- # util
324
-
325
- def open_browser(*files)
326
- if Config::CONFIG["host"] =~ %r!darwin!
327
- sh("open", "/Applications/Firefox.app", *files)
328
- else
329
- sh("firefox", *files)
330
- end
331
- end
332
-
333
- unless respond_to? :tap
334
- class Object
335
- def tap
336
- yield self
337
- self
338
- end
339
- end
340
- end
341
-
342
- def replace_file(file)
343
- old_contents = File.read(file)
344
- yield(old_contents).tap { |new_contents|
345
- if old_contents != new_contents
346
- File.open(file, "wb") { |output|
347
- output.print(new_contents)
348
- }
349
- end
350
- }
351
- end
352
-
353
- def write_file(file)
354
- yield.tap { |contents|
355
- File.open(file, "wb") { |out|
356
- out.print(contents)
357
- }
358
- }
359
- end
360
-
361
- def run_ruby_on_each(*files)
362
- files.each { |file|
363
- Jumpstart::Ruby.run_or_raise("-w", file)
364
- }
365
- end