Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
e7aaaf13
Commit
e7aaaf13
authored
Jun 20, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GPU Util Tracker use CUDA_VISIBLE_DEVICES
parent
a23a92d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
tensorpack/callbacks/stats.py
tensorpack/callbacks/stats.py
+10
-4
No files found.
tensorpack/callbacks/stats.py
View file @
e7aaaf13
...
@@ -35,16 +35,22 @@ class SendStat(Callback):
...
@@ -35,16 +35,22 @@ class SendStat(Callback):
class
GPUUtilizationTracker
(
Callback
):
class
GPUUtilizationTracker
(
Callback
):
""" Summarize the average GPU utilization within an epoch"""
""" Summarize the average GPU utilization within an epoch"""
def
__init__
(
self
,
devices
):
def
__init__
(
self
,
devices
=
None
):
"""
"""
Args:
Args:
devices (list[int]): physical GPU ids
devices (list[int]): physical GPU ids
. If None, will use CUDA_VISIBLE_DEVICES
"""
"""
if
devices
is
None
:
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
)
assert
env
is
not
None
,
"[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None!"
self
.
_devices
=
env
.
split
(
','
)
else
:
self
.
_devices
=
list
(
map
(
str
,
devices
))
self
.
_devices
=
list
(
map
(
str
,
devices
))
assert
len
(
self
.
_devices
),
"[GPUUtilizationTracker] No GPU device given!"
self
.
_command
=
"nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits -i "
+
\
self
.
_command
=
"nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits -i "
+
\
','
.
join
(
self
.
_devices
)
','
.
join
(
self
.
_devices
)
output
,
ret
=
subproc_call
(
self
.
_command
)
_
,
ret
=
subproc_call
(
self
.
_command
)
assert
ret
==
0
,
"Cannot fetch GPU utilization!"
assert
ret
==
0
,
"Cannot fetch GPU utilization!"
def
_before_train
(
self
):
def
_before_train
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment