comp_tree 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.rdoc CHANGED
@@ -1,6 +1,10 @@
1
1
 
2
2
  = CompTree ChangeLog
3
3
 
4
+ == Version 1.0.1
5
+
6
+ * minor optimization to the main algorithm
7
+
4
8
  == Version 1.0.0
5
9
 
6
10
  * better errors and error handling
data/README.rdoc CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  == Summary
5
5
 
6
- A simple framework for parallelizing computations.
6
+ A simple framework for automatic parallelism.
7
7
 
8
8
  == Synopsis
9
9
 
@@ -50,15 +50,14 @@ Or for the (non-gem) .tgz package,
50
50
 
51
51
  == Description
52
52
 
53
- CompTree is parallel computation tree structure based upon concepts
53
+ CompTree is a parallel computation tree structure based upon concepts
54
54
  from pure functional programming.
55
55
 
56
56
  The user should have a basic understanding of functional programming
57
57
  (see for example http://en.wikipedia.org/wiki/Functional_programming)
58
58
  and the meaning of <em>side effects</em>.
59
59
 
60
- Every pure function you define must explicitly depend on the data it
61
- uses.
60
+ Every function you define must explicitly depend on the data it uses.
62
61
 
63
62
  #
64
63
  # BAD example: depending on state -- offset not listed as a parameter
data/devel/jumpstart.rb CHANGED
@@ -470,9 +470,10 @@ class Jumpstart
470
470
  end
471
471
 
472
472
  attribute :sections do
473
+ require 'enumerator'
473
474
  begin
474
- pairs = Hash[*readme_contents.split(%r!^== (\w+).*?$!)[1..-1]].map {
475
- |section, contents|
475
+ data = readme_contents.split(%r!^==\s*(.*?)\s*$!)
476
+ pairs = data[1..-1].enum_slice(2).map { |section, contents|
476
477
  [section.downcase, contents.strip]
477
478
  }
478
479
  Hash[*pairs.flatten]
@@ -906,7 +907,8 @@ class Jumpstart
906
907
 
907
908
  def run_doc_section(file, section, instance, &block)
908
909
  contents = File.read(file)
909
- if section_contents = contents[%r!^=+[ \t]#{section}.*?\n(.*?)^=!m, 1]
910
+ re = %r!^=+[ \t]#{Regexp.quote(section)}.*?\n(.*?)^=!m
911
+ if section_contents = contents[re, 1]
910
912
  index = 0
911
913
  section_contents.scan(%r!^( \S.*?)(?=(^\S|\Z))!m) { |indented, unused|
912
914
  code_sections = indented.split(%r!^ \#\#\#\# output:\s*$!)
@@ -13,9 +13,7 @@ module CompTree
13
13
  }
14
14
  }
15
15
 
16
- node = Thread.new {
17
- master_loop(root, num_threads, from_workers, to_workers)
18
- }.value
16
+ node = master_loop(root, num_threads, from_workers, to_workers)
19
17
 
20
18
  num_threads.times { to_workers.push(nil) }
21
19
  workers.each { |t| t.join }
@@ -5,7 +5,7 @@
5
5
  # See README.rdoc.
6
6
  #
7
7
  module CompTree
8
- VERSION = "1.0.0"
8
+ VERSION = "1.0.1"
9
9
 
10
10
  class << self
11
11
  #
@@ -4,21 +4,17 @@ module CompTree
4
4
  # Base class for CompTree errors.
5
5
  #
6
6
  class Error < StandardError
7
- def inspect #:nodoc:
8
- "#<#{self.class.name}: #{message}>"
9
- end
10
7
  end
11
8
 
12
9
  #
13
10
  # Base class for node errors.
14
11
  #
15
12
  class NodeError < Error
16
- attr_reader :node_name
17
-
18
13
  def initialize(node_name) #:nodoc:
19
- super()
20
14
  @node_name = node_name
15
+ super(custom_message)
21
16
  end
17
+ attr_reader :node_name
22
18
  end
23
19
 
24
20
  #
@@ -28,7 +24,7 @@ module CompTree
28
24
  # driver.nodes[name].function = lambda { ... }
29
25
  #
30
26
  class RedefinitionError < NodeError
31
- def message #:nodoc:
27
+ def custom_message #:nodoc:
32
28
  "attempt to redefine node `#{node_name.inspect}'"
33
29
  end
34
30
  end
@@ -37,7 +33,7 @@ module CompTree
37
33
  # Encountered a node without a function during a computation.
38
34
  #
39
35
  class NoFunctionError < NodeError
40
- def message #:nodoc:
36
+ def custom_message #:nodoc:
41
37
  "no function was defined for node `#{node_name.inspect}'"
42
38
  end
43
39
  end
@@ -46,7 +42,7 @@ module CompTree
46
42
  # Requested node does not exist.
47
43
  #
48
44
  class NoNodeError < NodeError
49
- def message #:nodoc:
45
+ def custom_message #:nodoc:
50
46
  "no node named `#{node_name.inspect}'"
51
47
  end
52
48
  end
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-13 00:00:00 -04:00
12
+ date: 2009-09-22 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: CompTree is parallel computation tree structure based upon concepts from pure functional programming.
16
+ description: CompTree is a parallel computation tree structure based upon concepts from pure functional programming.
17
17
  email:
18
18
  - quixoticsycophant@gmail.com
19
19
  executables: []
@@ -57,7 +57,7 @@ rdoc_options:
57
57
  - --main
58
58
  - README.rdoc
59
59
  - --title
60
- - "comp_tree: A simple framework for parallelizing computations."
60
+ - "comp_tree: A simple framework for automatic parallelism."
61
61
  - --exclude
62
62
  - CHANGES.rdoc
63
63
  - --exclude
@@ -122,6 +122,6 @@ rubyforge_project: comptree
122
122
  rubygems_version: 1.3.5
123
123
  signing_key:
124
124
  specification_version: 3
125
- summary: A simple framework for parallelizing computations.
125
+ summary: A simple framework for automatic parallelism.
126
126
  test_files: []
127
127