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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcc45e864245505b64cd82233ca7f8ad70d0d12ca1a976862ba46c80e66fefc8
4
- data.tar.gz: 6903aff2b613ee6f88c41aa051e65404f31c8923bab2059323dfd27bc99cc5e0
3
+ metadata.gz: 0ff898fab62731ca014ea856033f2e7d024e1013703af0cba4b194844b1fc683
4
+ data.tar.gz: 9c9e7b32eca6a7313c823ef6c96171f939882550c3f5ecd405c359640ed71e2d
5
5
  SHA512:
6
- metadata.gz: a971813c562bc8c29305f1fe3668f229b52bd018049d36879fcc943a935232e8d8bb34095e74643ca9d3da594796a4cdfdc33fe06b36a8501a75c0a330489cb3
7
- data.tar.gz: bc17da953ab1904661c7037977c36b1dda69c7c4236c5854730743fa9332987a92ba3891e97052c4ee9361bea7a0b830a917235e15f1db75e8246b7835715a6e
6
+ metadata.gz: '08fb1888538fefb976eb66350eb1fb1afaac4901bc847b60532228ffbcdd565dc72448f318566dc5781d0a69b53c81ef47b32836e5b51eee0c4925c200e95792'
7
+ data.tar.gz: ea1603c5ff7aa307e7d566b50420a31e582b437255e2a6eff57f44981732e0c98865684035dec64da270bd59a457fd30250950e5cc5a28dad33cb338ef329a06
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unrleased
4
4
 
5
+ ## 0.3.1
6
+ Released 9/24/2020
7
+
8
+ * Use the default system pcidb file instead of throwing error
9
+ * Return default data if no hmon value exist
10
+
5
11
  ## 0.3.0
6
12
  Released 6/16/2020
7
13
 
@@ -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.
@@ -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
- raise Exceptions::InvalidPCIDatabase.new('Run: ComputeUnit.refresh_pci_database') unless File.exist?(PCI_DATABASE_PATH)
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'
@@ -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, _default = nil)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ComputeUnit
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
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.0
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-06-16 00:00:00.000000000 Z
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: