compute_unit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/compute_unit.gemspec +1 -1
- data/lib/compute_unit.rb +14 -1
- data/lib/compute_unit/device.rb +2 -2
- data/lib/compute_unit/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: 0ff898fab62731ca014ea856033f2e7d024e1013703af0cba4b194844b1fc683
|
4
|
+
data.tar.gz: 9c9e7b32eca6a7313c823ef6c96171f939882550c3f5ecd405c359640ed71e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08fb1888538fefb976eb66350eb1fb1afaac4901bc847b60532228ffbcdd565dc72448f318566dc5781d0a69b53c81ef47b32836e5b51eee0c4925c200e95792'
|
7
|
+
data.tar.gz: ea1603c5ff7aa307e7d566b50420a31e582b437255e2a6eff57f44981732e0c98865684035dec64da270bd59a457fd30250950e5cc5a28dad33cb338ef329a06
|
data/CHANGELOG.md
CHANGED
data/compute_unit.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.metadata['homepage_uri'] = spec.homepage
|
27
27
|
spec.metadata['source_code_uri'] = spec.homepage
|
28
|
-
spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
|
28
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/-/blob/master/CHANGELOG.md"
|
29
29
|
|
30
30
|
# Specify which files should be added to the gem when it is released.
|
31
31
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/compute_unit.rb
CHANGED
@@ -11,23 +11,36 @@ module ComputeUnit
|
|
11
11
|
SYS_DEVICE_PATH = File.join(SYSFS_PATH, 'bus/pci/devices')
|
12
12
|
PCI_DATABASE_PATH = File.join(File.dirname(__dir__), 'pci.ids')
|
13
13
|
PCI_DATABASE_URL = 'http://pci-ids.ucw.cz/v2.2/pci.ids'
|
14
|
+
DEFAULT_PCIDB_PATH = '/usr/share/hwdata/pci.ids'
|
14
15
|
|
16
|
+
# @param use_opencl [Boolean]
|
17
|
+
# @return [Array] - return a list of compute units
|
15
18
|
def self.find_all(use_opencl = false)
|
16
19
|
require 'compute_unit/gpu'
|
17
20
|
require 'compute_unit/cpu'
|
18
21
|
require 'compute_unit/asic'
|
19
|
-
|
22
|
+
|
23
|
+
copy_default_database unless File.exist?(PCI_DATABASE_PATH)
|
20
24
|
|
21
25
|
ComputeUnit::Gpu.find_all(use_opencl) +
|
22
26
|
ComputeUnit::Cpu.find_all +
|
23
27
|
ComputeUnit::Asic.find_all
|
24
28
|
end
|
25
29
|
|
30
|
+
# copies the default pci database from linux filesystem over to the gem path
|
31
|
+
def copy_default_database
|
32
|
+
File.cp(DEFAULT_PCIDB_PATH, PCI_DATABASE_PATH)
|
33
|
+
end
|
34
|
+
|
35
|
+
# get a fresh copy of the database and then use find_all
|
36
|
+
# @param use_opencl [Boolean]
|
37
|
+
# @return [Array] - return a list of compute units
|
26
38
|
def self.find_all_with_database(use_opencl = false)
|
27
39
|
refresh_pci_database
|
28
40
|
find_all(use_opencl)
|
29
41
|
end
|
30
42
|
|
43
|
+
# downloads the pci database
|
31
44
|
def self.refresh_pci_database
|
32
45
|
ComputeUnit::Utils.check_for_root
|
33
46
|
require 'net/http'
|
data/lib/compute_unit/device.rb
CHANGED
@@ -140,9 +140,9 @@ module ComputeUnit
|
|
140
140
|
# @param item [String] - the name of the hwmon file to read from
|
141
141
|
# @param default [Object] - the default value to return if the file is empty or not readable
|
142
142
|
# @return [String] - the value of the item looked up
|
143
|
-
def read_hwmon_data(item,
|
143
|
+
def read_hwmon_data(item, default = nil)
|
144
144
|
path = File.join(hwmon_path, item)
|
145
|
-
read_file(path)
|
145
|
+
read_file(path, default)
|
146
146
|
end
|
147
147
|
|
148
148
|
# @param item [String] - the name of the hwmon file to write to
|
data/lib/compute_unit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compute_unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opencl_ruby_ffi
|
@@ -119,7 +119,7 @@ licenses:
|
|
119
119
|
metadata:
|
120
120
|
homepage_uri: https://gitlab.com/blockops/compute_unit
|
121
121
|
source_code_uri: https://gitlab.com/blockops/compute_unit
|
122
|
-
changelog_uri: https://gitlab.com/blockops/compute_unit/CHANGELOG.md
|
122
|
+
changelog_uri: https://gitlab.com/blockops/compute_unit/-/blob/master/CHANGELOG.md
|
123
123
|
post_install_message:
|
124
124
|
rdoc_options: []
|
125
125
|
require_paths:
|