compute_unit 0.2.0 → 0.2.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: 0ce131c209f99ed5bd86a2439e56b2fcd8e0d7b85120db149d3c4427e6ea8ef0
4
- data.tar.gz: 478ef837c6b68adecfc84bb6adc4f6120a8f8e119e371ce13f3503808e92788f
3
+ metadata.gz: 82032a2c2110769430dd7b1a3f4b624227275eb5a3a3e62f6e0e42bdb41790c3
4
+ data.tar.gz: 7e45e2b1cd11b5cb0cfb40b00fee99a20ecc6e125064a2251372c4e14f22e1ca
5
5
  SHA512:
6
- metadata.gz: 9f1f22c7a80b053fb7612bb0e40bd7f2ea609b4c747dcdf486875289d2edab9090d590ca333d33be763cc3cec55faa6ca3a8568dc8f8f212eea3adf3e629120b
7
- data.tar.gz: 11b96609eec70c967865ecb476367210a356dfdec6a9b833929c4992e937ad8f568cdf5a01e4f1a7fa77cdcf941a245d20a55a5704385b7de1c4efc11855605d
6
+ metadata.gz: 8c818aa6ba28c5af8d57e8e99e4deb81a3eb4cc19532ce68d4888e6f644d780360c5568272667a9c5edc4807da90b49ee7c454c86164d925eab409c0332385c2
7
+ data.tar.gz: 2898757c00752709b8cfec4a4137f3bc65310d0e1af2a68637a1b3eba385f7e0188acb2790538b40e1fd2a650f65152175bfd99947cdd2d023baee3fa321aa64
@@ -1,6 +1,12 @@
1
1
  # Compute Unit Changelog
2
2
 
3
3
  ## Unrleased
4
+
5
+ ## 0.2.1
6
+ Released 6/6/2020
7
+
8
+ * update rake and other gems
9
+
4
10
  ## 0.2.0
5
11
  Released 6/5/2020
6
12
  * Added more cpu methods for various POI.
data/Gemfile CHANGED
@@ -2,17 +2,11 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
-
6
- gem 'opencl_ruby_ffi', '~> 1.3.4'
7
- gem 'compute_unit', path: '.'
8
-
9
5
  group :test do
10
6
  gem 'pry'
11
7
  gem 'rubocop'
12
8
  gem 'rubocop-rspec'
13
9
  gem 'ruby-prof'
14
10
  gem 'simplecov'
15
- gem 'rake', '~> 10.0'
16
- gem 'rspec', '~> 3.0'
17
- gem 'bundler', '~> 2.0'
18
11
  end
12
+ gemspec
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Compute Unit Ruby Library
2
- The compute unit library helps you write future abstractions and tooling for crypto mining, machine learning or just general purpose usage. This library was extracted out of the crypto mining tool [Crossbelt](https://crossbelt.blockops.party) to help spur more tooling to ruby.
2
+ The compute unit library helps you write future abstractions and tooling for crypto mining, machine learning or just general purpose. This library was extracted out of the crypto mining tool [Crossbelt](https://crossbelt.blockops.party) to help spur more tooling for ruby.
3
3
 
4
4
  Uses the sysfs filesystem to quickly read and write compute unit data. More information about sysfs can be found [here](https://www.kernel.org/doc/Documentation/filesystems/sysfs-pci.txt)
5
5
 
6
- This library will:
6
+ This library has the ability to:
7
7
 
8
8
  * Detect all compute devices such as cpu, gpu, and anything else we add to this library.
9
9
  * Provide the ability to control GPU fans.
@@ -11,6 +11,7 @@ This library will:
11
11
  * Change or view voltage, core clock, memory clock and other tunning parameters used for overclocking.
12
12
  * Provide inventory data of all the devices with make, model and other important information.
13
13
  * Provide realtime status information of various data points. Useful for real-time tunning.
14
+ * Interact with the compute device via ruby.
14
15
 
15
16
  This library was open sourced to allow further refinement and usage throughout the ruby community.
16
17
  Since machine learning is not popular on ruby due to device and program support, I hope this gem will
@@ -34,17 +35,110 @@ Or install it yourself as:
34
35
 
35
36
  ## Usage
36
37
 
38
+ Find all compute devices
37
39
  ```
38
40
  require 'compute_unit'
39
41
  devices = ComputeUnit.find_all
40
42
 
41
43
  ```
42
44
 
45
+ Find just GPU devices and list the voltage table
46
+
47
+ ```ruby
48
+ require 'compute_unit/gpu'
49
+
50
+ gpu = ComputeUnit::Gpu.find_all.first
51
+ gpu.voltage_table
52
+ => [{:pstate=>0, :clk=>852, :volt=>800, :type=>:sclk},
53
+ {:pstate=>1, :clk=>997, :volt=>860, :type=>:sclk},
54
+ {:pstate=>2, :clk=>1084, :volt=>860, :type=>:sclk},
55
+ {:pstate=>3, :clk=>1138, :volt=>860, :type=>:sclk},
56
+ {:pstate=>4, :clk=>1200, :volt=>860, :type=>:sclk},
57
+ {:pstate=>5, :clk=>1401, :volt=>860, :type=>:sclk},
58
+ {:pstate=>6, :clk=>1536, :volt=>860, :type=>:sclk},
59
+ {:pstate=>7, :clk=>1630, :volt=>1200, :type=>:sclk}]
60
+
61
+ gpu.amdgpu_pm_info
62
+ => {:mclk=>{:value=>"1020", :unit=>"MHz"},
63
+ :sclk=>{:value=>"994", :unit=>"MHz"},
64
+ :pstate_sclk=>{:value=>"1138", :unit=>"MHz"},
65
+ :pstate_mclk=>{:value=>"800", :unit=>"MHz"},
66
+ :vddgfx=>{:value=>"862", :unit=>"mV"},
67
+ :average_gpu=>{:value=>"121.0", :unit=>"W"},
68
+ :temperature=>{:value=>"57", :unit=>"C"},
69
+ :load=>{:value=>"100", :unit=>"%"}}
70
+
71
+ ```
72
+
73
+ ## Example CLI command
74
+ There is a `list_computes` command that will enumerate all the compute devices found on the system.
75
+
76
+ ```ruby
77
+ list_computes
78
+ [
79
+ {
80
+ "uuid": "GPU0",
81
+ "gpuId": "GPU0",
82
+ "syspath": "/sys/bus/pci/devices/0000:03:00.0",
83
+ "pciLoc": "0000:03:00.0",
84
+ "name": "RX Vega56",
85
+ "bios": "113-D0500100-102",
86
+ "subType": "amdgpu",
87
+ "make": "AMD",
88
+ "model": "RX Vega56",
89
+ "vendor": "AMD",
90
+ "power": 121,
91
+ "utilization": 100,
92
+ "temperature": 57,
93
+ "status": 0,
94
+ "pstate": -1,
95
+ "fanSpeed": 2946,
96
+ "type": "GPU",
97
+ "maxTemp": null,
98
+ "mem": 1020,
99
+ "cor": 997,
100
+ "vlt": 862,
101
+ "mem_temp": 75,
102
+ "maxFan": null,
103
+ "dpm": null,
104
+ "vddci": null,
105
+ "maxPower": null,
106
+ "ocProfile": null,
107
+ "opencl_enabled": false
108
+ },
109
+ {
110
+ "chip_make": "GenuineIntel",
111
+ "make": "GenuineIntel",
112
+ "model": "Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz",
113
+ "device_id": "590f",
114
+ "vendor_id": "8086",
115
+ "subsystem_device_id": "7a59",
116
+ "subsystem_vendor_id": "1462",
117
+ "device_class": "060000",
118
+ "temp": 33,
119
+ "minFreqMhz": 800,
120
+ "maxFreqMhz": 3900,
121
+ "currentFreqMhz": 3600,
122
+ "numCores": 2,
123
+ "numThreads": 2,
124
+ "nproc": 4,
125
+ "temps": {
126
+ "package_id_0": 33,
127
+ "core_0": 26,
128
+ "core_1": 33
129
+ }
130
+ }
131
+ ]
132
+ ```
133
+
43
134
  ### Subclassing a compute object
44
- Instead of monkey patching this code you can simply subclass the objects. The find_all methods are intelligent enough to locate your subclass by searching the Objectspace for all decendants of `ComputeUnit::ComputeBase`. This makes it dead simple to add new functionality without having to wrap any code. This gives you the ability to include new modules or override existing methods.
135
+ Instead of monkey patching this code you can simply subclass the objects. The find_all methods are intelligent enough to locate your subclass by searching the Objectspace for all decendants of `ComputeUnit::ComputeBase`. This makes it dead simple to add new functionality without having to wrap any code. This gives you the ability to include new modules or override existing methods. Just make sure you load your class before using the find_all method.
136
+
137
+
45
138
 
46
139
  ```ruby
47
140
  # coolproject/vegagpu.rb
141
+ require 'cool_project/vega_gpu'
48
142
  module CoolProject
49
143
  class VegaGpu < ::ComputeUnit::Gpu::AmdGpu
50
144
  include CoolProject::Metrics
@@ -60,7 +154,7 @@ end
60
154
 
61
155
  Once you have your new class created all you need to do is load the class before running find all.
62
156
 
63
- ```
157
+ ```ruby
64
158
  require 'compute_unit'
65
159
  require 'coolproject/vegagpu'
66
160
  require 'yaml'
@@ -84,6 +178,21 @@ There will likely be changes with reading and writing information to sysfs as ne
84
178
  * 4.15 - 4.20
85
179
  * 5.x
86
180
 
181
+ ## OpenCL Usage
182
+ The opencl_ruby_ffi gem is optionally used to gather additional info about the GPU. This can sometimes result in better model info.
183
+
184
+ There is some caution when using OpenCL. If a GPU is dead, OpenCL tends to hang/freeze thus forcing a reboot. This is not a bug in the compute_unit or opencl_ruby_ffi gem but in the OpenCL library instead.
185
+
186
+ Getting data from OpenCL also takes a long time! So if you have multiple GPUs in your system this could takes multiple seconds to return data. Because of this we cache the responses for the next query. This response is cached until the system checksum changes. This checksum is a special calculate of all the devices present in the system. So if you ever added or changed the equipment in the system, a new OpenCL query would ensue.
187
+
188
+ To enable OpenCL you just need to pass a boolean value to any of the find_all methods:
189
+
190
+ ```ruby
191
+ require 'compute_unit'
192
+ devices = ComputeUnit.find_all(true)
193
+
194
+ ```
195
+
87
196
  ## Development
88
197
 
89
198
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -96,7 +205,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/logicm
96
205
 
97
206
  ## License
98
207
 
99
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
208
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT.
100
209
 
101
210
  ## Code of Conduct
102
211
 
@@ -13,9 +13,9 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'A ruby library for compute unit devices'
14
14
  spec.description = <<~EOF
15
15
 
16
- A ruby library that searches uses the linux sysfs file system for compute unit devices such as
17
- CPUS, GPUs and other ASIC compute devices. Allows programmatic access collect real time metrics from the kernel or relatated driver toolchain.
18
- Is meant to be used as a toolchain to future build tooling on. This library also makes use of opencl toolchain and requires
16
+ A ruby library that searches the linux sysfs file system for compute unit devices such as
17
+ CPUS, GPUs and other ASIC compute devices. Allows programmatic access to collect real time metrics from the kernel or relatated driver toolchain.
18
+ Is meant to be used as a toolchain for future tools. This library also makes use of opencl library and requires
19
19
  the opencl_ruby_ffi gem.
20
20
 
21
21
  EOF
@@ -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"
28
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/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.
@@ -36,8 +36,8 @@ Gem::Specification.new do |spec|
36
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
37
  spec.require_paths = ['lib']
38
38
 
39
- spec.add_dependency 'opencl_ruby_ffi', '~> 1.3.0'
40
- spec.add_development_dependency 'bundler', '~> 2.0'
41
- spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_dependency 'opencl_ruby_ffi', '~> 1.3.4'
40
+ spec.add_development_dependency 'bundler', '~> 2.1'
41
+ spec.add_development_dependency 'rake', '~> 13'
42
42
  spec.add_development_dependency 'rspec', '~> 3.0'
43
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ComputeUnit
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.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.2.0
4
+ version: 0.2.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-05 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opencl_ruby_ffi
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.0
19
+ version: 1.3.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.0
26
+ version: 1.3.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '2.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -68,9 +68,9 @@ dependencies:
68
68
  version: '3.0'
69
69
  description: |2+
70
70
 
71
- A ruby library that searches uses the linux sysfs file system for compute unit devices such as
72
- CPUS, GPUs and other ASIC compute devices. Allows programmatic access collect real time metrics from the kernel or relatated driver toolchain.
73
- Is meant to be used as a toolchain to future build tooling on. This library also makes use of opencl toolchain and requires
71
+ A ruby library that searches the linux sysfs file system for compute unit devices such as
72
+ CPUS, GPUs and other ASIC compute devices. Allows programmatic access to collect real time metrics from the kernel or relatated driver toolchain.
73
+ Is meant to be used as a toolchain for future tools. This library also makes use of opencl library and requires
74
74
  the opencl_ruby_ffi gem.
75
75
 
76
76
  email:
@@ -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
122
+ changelog_uri: https://gitlab.com/blockops/compute_unit/CHANGELOG.md
123
123
  post_install_message:
124
124
  rdoc_options: []
125
125
  require_paths: