nvidia-smi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93f2f96de404d5617142645bb68d29c262cff38e
4
+ data.tar.gz: 7dcc98871d3cb625dedfd420b5413e3d77a99b69
5
+ SHA512:
6
+ metadata.gz: 73eda3ea2a7da36372a9e913f9cc67ed3f24473dafc268e751715c77ec8efa60107f7d3a0c5570fdb8aee43713e6f8524a215f65def029587444409c4e131a13
7
+ data.tar.gz: 259172d4d5a5d249a17bf9a45da9d0e77c82a8cdd5f6b346c45378d21b1f888c016413bde3bf34080b21b7446cae2b48612b715b72a51d04190b1a975fccf6ef
data/.bnsignore ADDED
@@ -0,0 +1,18 @@
1
+ # The list of files that should be ignored by Mr Bones.
2
+ # Lines that start with '#' are comments.
3
+ #
4
+ # A .gitignore file can be used instead by setting it as the ignore
5
+ # file in your Rakefile:
6
+ #
7
+ # Bones {
8
+ # ignore_file '.gitignore'
9
+ # }
10
+ #
11
+ # For a project with a C extension, the following would be a good set of
12
+ # exclude patterns (uncomment them if you want to use them):
13
+ # *.[oa]
14
+ # *~
15
+ announcement.txt
16
+ coverage
17
+ doc
18
+ pkg
data/History.txt ADDED
@@ -0,0 +1,7 @@
1
+ == 0.1.0 / 2017-11-05
2
+
3
+ * Very basic functionality
4
+ * Number of Nvidia GPUs
5
+ * Driver version
6
+ * Basic informations about each GPU, wrapped in a Struct
7
+
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ nvidia-smi
2
+ ===========
3
+
4
+ Features
5
+ --------
6
+
7
+ Get informations about the system's GPU(s), through nvidia-smi.
8
+
9
+ Examples
10
+ --------
11
+
12
+ require 'nvidia-smi'
13
+ NvidiaSmi.gpu_count
14
+ => 1
15
+ NvidiaSmi.driver_version
16
+ => "384.90"
17
+ NvidiaSmi.gpus.first
18
+ => #<struct Struct::Gpu index="0", pci_bus="0x01", name="GeForce GTX 1060 3GB", uuid="GPU-57737cf0-1db6-4905-9caa-1eeb73beb974", temperature_gpu="72", fan_speed="55 %", memory_used="1216 MiB", memory_total="3013 MiB", memory_free="1797 MiB", utilization_memory="55 %", utilization_gpu="99 %", power_draw="121.77 W", power_limit="120.00 W", pstate="P2", clocks_gr="1759 MHz", clocks_sm="1759 MHz", clocks_mem="3802 MHz", clocks_video="1582 MHz", vbios_version="86.06.3C.00.8E">
19
+
20
+ Requirements
21
+ ------------
22
+
23
+ * Nvidia driver
24
+ * nvidia-smi
25
+
26
+ Install
27
+ -------
28
+
29
+ sudo gem install nvidia-smi
30
+
31
+ Author
32
+ ------
33
+
34
+ Original author: Julien Cornuwel
35
+
36
+ Contributors:
37
+
38
+ * YourNameGoesHere
39
+
40
+ License
41
+ -------
42
+
43
+ The MIT License
44
+
45
+ Copyright (c) 2017 FIXME Julien Cornuwel
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of this software and associated documentation files (the
49
+ 'Software'), to deal in the Software without restriction, including
50
+ without limitation the rights to use, copy, modify, merge, publish,
51
+ distribute, sublicense, and/or sell copies of the Software, and to
52
+ permit persons to whom the Software is furnished to do so, subject to
53
+ the following conditions:
54
+
55
+ The above copyright notice and this permission notice shall be
56
+ included in all copies or substantial portions of the Software.
57
+
58
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
59
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
61
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
62
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
63
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
64
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+
2
+ begin
3
+ require 'bones'
4
+ rescue LoadError
5
+ abort '### Please install the "bones" gem ###'
6
+ end
7
+
8
+ task :default => 'test:run'
9
+ task 'gem:release' => 'test:run'
10
+
11
+ Bones {
12
+ name 'nvidia-smi'
13
+ authors 'Julien Cornuwel'
14
+ email 'julien@cornuwel.net'
15
+ url 'https://github.com/cornuwel/nvidia-smi'
16
+ }
17
+
data/lib/nvidia-smi.rb ADDED
@@ -0,0 +1,53 @@
1
+ module NvidiaSmi
2
+
3
+ @@nvidia_keys = [
4
+ 'index',
5
+ 'pci.bus',
6
+ 'name',
7
+ 'uuid',
8
+ 'temperature.gpu',
9
+ 'fan.speed',
10
+ 'memory.used',
11
+ 'memory.total',
12
+ 'memory.free',
13
+ 'utilization.memory',
14
+ 'utilization.gpu',
15
+ 'power.draw',
16
+ 'power.limit',
17
+ 'pstate',
18
+ 'clocks.gr',
19
+ 'clocks.sm',
20
+ 'clocks.mem',
21
+ 'clocks.video',
22
+ 'vbios_version'
23
+ ]
24
+
25
+ return_keys = @@nvidia_keys.map(&:clone).each do |s|
26
+ s.gsub!('.', '_')
27
+ end
28
+
29
+ Struct.new('Gpu', *return_keys)
30
+
31
+
32
+ def self.gpu_count
33
+ `nvidia-smi --query-gpu=count --format=csv,noheader -i 0`.to_i
34
+ end
35
+
36
+ def self.driver_version
37
+ `nvidia-smi --query-gpu=driver_version --format=csv,noheader -i 0`.strip
38
+ end
39
+
40
+ def self.gpus
41
+ gpus = Array.new
42
+ data = `nvidia-smi --query-gpu=#{@@nvidia_keys.join(',')} --format=csv,noheader`.each_line do |line|
43
+ values = line.strip.split(',').each do |v|
44
+ v.strip!
45
+ end
46
+
47
+ gpus << Struct::Gpu.new(*values)
48
+ end
49
+ return gpus
50
+ end
51
+
52
+ end
53
+
@@ -0,0 +1,6 @@
1
+
2
+ require File.expand_path('../spec_helper', __FILE__)
3
+
4
+ describe NvidiaSmi do
5
+ end
6
+
@@ -0,0 +1,17 @@
1
+
2
+ require 'rubygems'
3
+ require 'rspec'
4
+
5
+ require File.expand_path('../../lib/nvidia-smi', __FILE__)
6
+
7
+ RSpec.configure do |config|
8
+ # == Mock Framework
9
+ #
10
+ # RSpec uses it's own mocking framework by default. If you prefer to
11
+ # use mocha, flexmock or RR, uncomment the appropriate line:
12
+ #
13
+ # config.mock_framework = :mocha
14
+ # config.mock_framework = :flexmock
15
+ # config.mock_framework = :rr
16
+ end
17
+
File without changes
data/version.txt ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nvidia-smi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Julien Cornuwel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bones
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.8.4
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.8.4
27
+ description: Get informations about the system's GPU(s), through nvidia-smi.
28
+ email: julien@cornuwel.net
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files:
32
+ - History.txt
33
+ files:
34
+ - ".bnsignore"
35
+ - History.txt
36
+ - README.md
37
+ - Rakefile
38
+ - lib/nvidia-smi.rb
39
+ - spec/nvidia-smi_spec.rb
40
+ - spec/spec_helper.rb
41
+ - test/test_nvidia-smi.rb
42
+ - version.txt
43
+ homepage: https://github.com/cornuwel/nvidia-smi
44
+ licenses: []
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options:
48
+ - "--main"
49
+ - README.md
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project: nvidia-smi
64
+ rubygems_version: 2.5.1
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Get informations about the system's GPU(s), through nvidia-smi.
68
+ test_files:
69
+ - test/test_nvidia-smi.rb