parallel 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parallel.rb +4 -0
- data/lib/parallel/processor_count.rb +3 -52
- data/lib/parallel/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587c7508b0e181ee03b60b9641ac9afa3feaa09a2fe3af0e6fc52d11ecf22338
|
4
|
+
data.tar.gz: 9e4fafeb97a74277aa33276dbb4383ee5227b26553eca719af4a5ca4fd8daa0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 411d4eb1d0f9387327c7778588eb2337280031739c4237b9123ab1ad995c7f9ec53312c2887e65df61203451061a9b318d2e23ea08a94ff727714ae2067a4c78
|
7
|
+
data.tar.gz: 57719ea9cd17ce0b82470aeb1128344fda823ce7f28779aa2ff6cc4f7581583bf3db2e86418f59d9926fcc7e8124edb0643bf95930cdf6410f73d586ea0c47f9
|
data/lib/parallel.rb
CHANGED
@@ -1,60 +1,11 @@
|
|
1
|
-
|
2
|
-
require 'etc'
|
3
|
-
end
|
1
|
+
require 'etc'
|
4
2
|
|
5
3
|
module Parallel
|
6
4
|
module ProcessorCount
|
7
|
-
# Number of processors seen by the OS and used for process scheduling.
|
8
|
-
#
|
9
|
-
# * AIX: /usr/sbin/pmcycles (AIX 5+), /usr/sbin/lsdev
|
10
|
-
# * BSD: /sbin/sysctl
|
11
|
-
# * Cygwin: /proc/cpuinfo
|
12
|
-
# * Darwin: /usr/bin/hwprefs, /usr/sbin/sysctl
|
13
|
-
# * HP-UX: /usr/sbin/ioscan
|
14
|
-
# * IRIX: /usr/sbin/sysconf
|
15
|
-
# * Linux: /proc/cpuinfo
|
16
|
-
# * Minix 3+: /proc/cpuinfo
|
17
|
-
# * Solaris: /usr/sbin/psrinfo
|
18
|
-
# * Tru64 UNIX: /usr/sbin/psrinfo
|
19
|
-
# * UnixWare: /usr/sbin/psrinfo
|
20
|
-
#
|
5
|
+
# Number of processors seen by the OS and used for process scheduling. It's just wrapper for Etc.nprocessors
|
21
6
|
def processor_count
|
22
7
|
@processor_count ||= begin
|
23
|
-
|
24
|
-
Etc.nprocessors
|
25
|
-
else
|
26
|
-
os_name = RbConfig::CONFIG["target_os"]
|
27
|
-
if os_name =~ /mingw|mswin/
|
28
|
-
require 'win32ole'
|
29
|
-
result = WIN32OLE.connect("winmgmts://").ExecQuery(
|
30
|
-
"select NumberOfLogicalProcessors from Win32_Processor")
|
31
|
-
result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
|
32
|
-
elsif File.readable?("/proc/cpuinfo")
|
33
|
-
IO.read("/proc/cpuinfo").scan(/^processor/).size
|
34
|
-
elsif File.executable?("/usr/bin/hwprefs")
|
35
|
-
IO.popen("/usr/bin/hwprefs thread_count").read.to_i
|
36
|
-
elsif File.executable?("/usr/sbin/psrinfo")
|
37
|
-
IO.popen("/usr/sbin/psrinfo").read.scan(/^.*on-*line/).size
|
38
|
-
elsif File.executable?("/usr/sbin/ioscan")
|
39
|
-
IO.popen("/usr/sbin/ioscan -kC processor") do |out|
|
40
|
-
out.read.scan(/^.*processor/).size
|
41
|
-
end
|
42
|
-
elsif File.executable?("/usr/sbin/pmcycles")
|
43
|
-
IO.popen("/usr/sbin/pmcycles -m").read.count("\n")
|
44
|
-
elsif File.executable?("/usr/sbin/lsdev")
|
45
|
-
IO.popen("/usr/sbin/lsdev -Cc processor -S 1").read.count("\n")
|
46
|
-
elsif File.executable?("/usr/sbin/sysconf") and os_name =~ /irix/i
|
47
|
-
IO.popen("/usr/sbin/sysconf NPROC_ONLN").read.to_i
|
48
|
-
elsif File.executable?("/usr/sbin/sysctl")
|
49
|
-
IO.popen("/usr/sbin/sysctl -n hw.ncpu").read.to_i
|
50
|
-
elsif File.executable?("/sbin/sysctl")
|
51
|
-
IO.popen("/sbin/sysctl -n hw.ncpu").read.to_i
|
52
|
-
else
|
53
|
-
$stderr.puts "Unknown platform: " + RbConfig::CONFIG["target_os"]
|
54
|
-
$stderr.puts "Assuming 1 processor."
|
55
|
-
1
|
56
|
-
end
|
57
|
-
end
|
8
|
+
Etc.nprocessors
|
58
9
|
end
|
59
10
|
end
|
60
11
|
|
data/lib/parallel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -32,7 +32,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: '2.2'
|
36
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|