parallel 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -4
- data/Rakefile +1 -1
- data/Readme.md +6 -4
- data/VERSION +1 -1
- data/lib/parallel.rb +5 -1
- data/parallel.gemspec +3 -4
- data/spec/parallel_spec.rb +14 -0
- metadata +6 -6
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations)
|
1
|
+
Run any code in parallel Processes(> use all CPUs) or Threads(> speedup blocking operations).<br/>
|
2
2
|
Best suited for map-reduce or e.g. parallel downloads/uploads.
|
3
3
|
|
4
4
|
Install
|
@@ -52,7 +52,9 @@ Authors
|
|
52
52
|
- [mikezter](http://github.com/mikezter)
|
53
53
|
- [Jeremy Durham](http://www.jeremydurham.com)
|
54
54
|
- [Nick Gauthier](http://www.ngauthier.com)
|
55
|
+
- [Andrew Bowerman](http://andrewbowerman.com)
|
56
|
+
- [Byron Bowerman](http://me.bm5k.com/)
|
55
57
|
|
56
|
-
[Michael Grosser](http://grosser.it)
|
57
|
-
|
58
|
-
Hereby placed under public domain, do what you want, just do not hold me accountable...
|
58
|
+
[Michael Grosser](http://grosser.it)<br/>
|
59
|
+
michael@grosser.it<br/>
|
60
|
+
Hereby placed under public domain, do what you want, just do not hold me accountable...
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/lib/parallel.rb
CHANGED
@@ -64,7 +64,7 @@ class Parallel
|
|
64
64
|
when /darwin9/
|
65
65
|
`hwprefs cpu_count`.to_i
|
66
66
|
when /darwin10/
|
67
|
-
`hwprefs thread_count
|
67
|
+
(hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
|
68
68
|
when /linux/
|
69
69
|
`cat /proc/cpuinfo | grep processor | wc -l`.to_i
|
70
70
|
when /freebsd/
|
@@ -74,6 +74,10 @@ class Parallel
|
|
74
74
|
|
75
75
|
private
|
76
76
|
|
77
|
+
def self.hwprefs_available?
|
78
|
+
`which hwprefs` != ''
|
79
|
+
end
|
80
|
+
|
77
81
|
def self.work_in_threads(items, options, &block)
|
78
82
|
results = []
|
79
83
|
current = -1
|
data/parallel.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-15}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.files = [
|
15
15
|
"Gemfile",
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.homepage = %q{http://github.com/grosser/parallel}
|
47
47
|
s.rdoc_options = ["--charset=UTF-8"]
|
48
48
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = %q{1.
|
49
|
+
s.rubygems_version = %q{1.4.2}
|
50
50
|
s.summary = %q{Run any kind of code in parallel processes}
|
51
51
|
s.test_files = [
|
52
52
|
"spec/spec_helper.rb",
|
@@ -75,7 +75,6 @@ Gem::Specification.new do |s|
|
|
75
75
|
]
|
76
76
|
|
77
77
|
if s.respond_to? :specification_version then
|
78
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
79
78
|
s.specification_version = 3
|
80
79
|
|
81
80
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/spec/parallel_spec.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
require File.expand_path('spec/spec_helper')
|
2
2
|
|
3
3
|
describe Parallel do
|
4
|
+
|
5
|
+
describe :processor_count do
|
6
|
+
it "returns a number" do
|
7
|
+
(1..999).should include(Parallel.processor_count)
|
8
|
+
end
|
9
|
+
|
10
|
+
if RUBY_PLATFORM =~ /darwin10/
|
11
|
+
it 'works if hwprefs in not available' do
|
12
|
+
Parallel.should_receive(:hwprefs_available?).and_return false
|
13
|
+
(1..999).should include(Parallel.processor_count)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
describe :in_processes do
|
5
19
|
def cpus
|
6
20
|
Parallel.processor_count
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-15 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements: []
|
89
89
|
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.4.2
|
92
92
|
signing_key:
|
93
93
|
specification_version: 3
|
94
94
|
summary: Run any kind of code in parallel processes
|