FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gpu-utils/gpu-ls at master · Ricks-Lab/gpu-utils · GitHub
Ricks-Lab
/
gpu-utils
Public
Notifications
You must be signed in to change notification settings
Fork
25
Star
153
Code
Issues
8
Pull requests
1
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
gpu-utils
/
gpu-ls
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
183 lines (158 loc) · 7.91 KB
Breadcrumbs
gpu-utils
/
gpu-ls
Copy path
File metadata and controls
executable file
·
183 lines (158 loc) · 7.91 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/env python3
""" gpu-ls - Displays details about installed and compatible GPUs.
Part of the rickslab-gpu-utils package which includes gpu-ls, gpu-mon,
gpu-pac, and gpu-plot.
This utility displays most relevant parameters for installed and compatible
GPUs. The default behavior is to list relevant parameters by GPU. OpenCL
platform information is added when the *--clinfo* option is used. A brief
listing of key parameters is available with the *--short* command line
option. A simplified table of current GPU state is displayed with the
*--table* option. The *--no_fan* can be used to ignore fan settings. The
*--pstate* option can be used to output the p-state table for each GPU
instead of the list of basic parameters. The *--ppm* option is used to
output the table of available power/performance modes instead of basic
parameters. The *--features* option is used to output the table of amdgpu
pp features and their status instead of basic parameters. The *--force_all*
results in an attempt to read all possible sensors, regardless of how the
GPU is classified. The *--raw* will read all possible driver files and
display with indicators of if a gpu-util keyword and description is
associated with each file along with its contents. The *--verbose* option
will display progress and informational messages generated by the utilities.
By default, output data is formatted and color coded, so the *--no_markup*
option can be specified to get plain text.
Copyright (C) 2019 RicksLab
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
"""
__author__
=
'RicksLab'
__copyright__
=
'Copyright (C) 2019 RicksLab'
__license__
=
'GNU General Public License'
__program_name__
=
'gpu-ls'
__maintainer__
=
'RicksLab'
__docformat__
=
'reStructuredText'
# pylint: disable=multiple-statements
# pylint: disable=line-too-long
# pylint: disable=consider-using-f-string
import
argparse
import
sys
import
logging
from
platform
import
release
from
GPUmodules
import
__version__
,
__status__
,
__credits__
from
GPUmodules
import
GPUmodule
as
Gpu
from
GPUmodules
.
env
import
GUT_CONST
from
GPUmodules
.
GPUKeys
import
SensorSet
LOGGER
=
logging
.
getLogger
(
'gpu-utils'
)
def
main
()
->
None
:
""" Main flow for gpu-ls.
"""
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--about'
,
help
=
'README'
,
action
=
'store_true'
,
default
=
False
)
# Arguments affecting overall format.
format_group
=
parser
.
add_mutually_exclusive_group
(
required
=
False
)
format_group
.
add_argument
(
'--long'
,
help
=
'Long listing of GPU details. Includes pstate, ppm, features, and clinfo.'
,
action
=
'store_true'
,
default
=
False
)
format_group
.
add_argument
(
'--short'
,
help
=
'Short listing of basic GPU details'
,
action
=
'store_true'
,
default
=
False
)
format_group
.
add_argument
(
'--table'
,
help
=
'Current status of readable GPUs'
,
action
=
'store_true'
,
default
=
False
)
format_group
.
add_argument
(
'--raw'
,
help
=
'Show all raw GPU sensor data'
,
action
=
'store_true'
,
default
=
False
)
# Arguments to select detail reports.
detail_group
=
parser
.
add_mutually_exclusive_group
(
required
=
False
)
detail_group
.
add_argument
(
'--pstates'
,
help
=
'Output pstate tables instead of GPU details'
,
action
=
'store_true'
,
default
=
False
)
detail_group
.
add_argument
(
'--ppm'
,
help
=
'Output power/performance mode tables instead of GPU details'
,
action
=
'store_true'
,
default
=
False
)
detail_group
.
add_argument
(
'--features'
,
help
=
'Output amdgpu Feature table instead of GPU details'
,
action
=
'store_true'
,
default
=
False
)
detail_group
.
add_argument
(
'--clinfo'
,
help
=
'Include openCL with card details'
,
action
=
'store_true'
,
default
=
False
)
# Arguments that influence report behavior.
parser
.
add_argument
(
'--verbose'
,
help
=
'Display informational message of GPU util progress'
,
action
=
'store_true'
,
default
=
False
)
parser
.
add_argument
(
'--force_all'
,
help
=
'Force attempt to read all sensors'
,
action
=
'store_true'
,
default
=
False
)
parser
.
add_argument
(
'--no_markup'
,
help
=
'Do not format ls output'
,
action
=
'store_true'
,
default
=
False
)
parser
.
add_argument
(
'--no_fan'
,
help
=
'Do not include fan setting options'
,
action
=
'store_true'
,
default
=
False
)
parser
.
add_argument
(
'-d'
,
'--debug'
,
help
=
'Debug logger output'
,
action
=
'store_true'
,
default
=
False
)
args
=
parser
.
parse_args
()
# About me
if
args
.
about
:
GUT_CONST
.
check_env
()
current_pversion
=
sys
.
version_info
current_kversion_str
=
release
()
print
(
__doc__
)
print
(
'Author: '
,
__author__
)
print
(
'Copyright: '
,
__copyright__
)
print
(
'Credits: '
,
*
[
'
\n
{}'
.
format
(
item
)
for
item
in
__credits__
])
print
(
'License: '
,
__license__
)
print
(
'Rickslab-gpu-utils Version: '
,
__version__
)
print
(
'Install Type: '
,
GUT_CONST
.
install_type
)
print
(
'Distro: {}'
.
format
(
GUT_CONST
.
distro
))
print
(
'Kernel Version: {}'
.
format
(
current_kversion_str
))
print
(
'Python Version: {}.{}.{}'
.
format
(
current_pversion
[
0
],
current_pversion
[
1
],
current_pversion
[
2
]))
print
(
'Maintainer: '
,
__maintainer__
)
print
(
'Status: '
,
__status__
)
sys
.
exit
(
0
)
if
args
.
short
:
args
.
no_fan
=
True
GUT_CONST
.
set_args
(
args
,
__program_name__
)
LOGGER
.
debug
(
'########## %s %s'
,
__program_name__
,
__version__
)
if
GUT_CONST
.
check_env
()
<
0
:
print
(
'Error in environment. Exiting...'
)
sys
.
exit
(
-
1
)
# Get list of GPUs and exit if no GPUs detected
gpu_list
=
Gpu
.
GpuList
()
gpu_list
.
set_gpu_list
(
clinfo_flag
=
True
)
num_gpus
=
gpu_list
.
num_gpus
()
if
num_gpus
[
'total'
]
==
0
:
print
(
'No GPUs detected, exiting...'
)
sys
.
exit
(
-
1
)
# Display vendor and driver details
Gpu
.
print_driver_vendor_summary
(
gpu_list
)
# Read data static/dynamic/info/state driver information for GPUs
gpu_list
.
read_gpu_sensor_set
(
data_type
=
SensorSet
.
All
)
# Check number of readable/writable GPUs again
print
(
gpu_list
)
# If specified, display raw sensor details
if
args
.
raw
:
gpu_list
.
read_raw_sensors
()
gpu_list
.
print_raw
()
sys
.
exit
(
0
)
# Print out user requested details
gpu_list
.
read_gpu_pstates
()
if
args
.
long
:
gpu_list
.
print
(
long
=
args
.
long
)
elif
args
.
short
:
gpu_list
.
print
(
short
=
args
.
short
)
elif
args
.
table
:
com_gpu_list
=
Gpu
.
set_mon_plot_compatible_gpu_list
(
gpu_list
)
com_gpu_list
.
print_table
(
title
=
'Status of Compatible GPUs:'
)
elif
args
.
pstates
or
args
.
ppm
or
args
.
features
or
args
.
clinfo
:
if
args
.
pstates
:
gpu_list
.
print_param_table
(
param_name
=
'pstate'
)
elif
args
.
ppm
:
gpu_list
.
print_param_table
(
param_name
=
'ppm'
)
elif
args
.
features
:
gpu_list
.
print_param_table
(
param_name
=
'pp_features'
)
elif
args
.
clinfo
:
gpu_list
.
print_param_table
(
param_name
=
'clinfo'
)
print
(
''
)
else
:
gpu_list
.
print
()
sys
.
exit
(
0
)
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL