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
61bdff40
Commit
61bdff40
authored
Jan 30, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not load devices by TF
parent
53c4db69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
tensorpack/callbacks/prof.py
tensorpack/callbacks/prof.py
+2
-2
tensorpack/utils/gpu.py
tensorpack/utils/gpu.py
+6
-6
No files found.
tensorpack/callbacks/prof.py
View file @
61bdff40
...
@@ -35,9 +35,9 @@ class GPUUtilizationTracker(Callback):
...
@@ -35,9 +35,9 @@ class GPUUtilizationTracker(Callback):
if
devices
is
None
:
if
devices
is
None
:
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
)
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
)
if
env
is
None
:
if
env
is
None
:
logger
.
warn
(
"[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! "
"Will monitor all visible GPUs!"
)
self
.
_devices
=
list
(
map
(
str
,
range
(
get_nr_gpu
())))
self
.
_devices
=
list
(
map
(
str
,
range
(
get_nr_gpu
())))
logger
.
warn
(
"[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! "
"Will monitor all {} visible GPUs!"
.
format
(
len
(
self
.
_devices
)))
else
:
else
:
if
len
(
env
):
if
len
(
env
):
self
.
_devices
=
env
.
split
(
','
)
self
.
_devices
=
env
.
split
(
','
)
...
...
tensorpack/utils/gpu.py
View file @
61bdff40
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
import
os
import
os
from
.utils
import
change_env
from
.utils
import
change_env
from
.
import
logger
from
.
concurrency
import
subproc_call
__all__
=
[
'change_gpu'
,
'get_nr_gpu'
]
__all__
=
[
'change_gpu'
,
'get_nr_gpu'
]
...
@@ -29,8 +29,8 @@ def get_nr_gpu():
...
@@ -29,8 +29,8 @@ def get_nr_gpu():
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
,
None
)
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
,
None
)
if
env
is
not
None
:
if
env
is
not
None
:
return
len
(
env
.
split
(
','
))
return
len
(
env
.
split
(
','
))
logger
.
info
(
"Loading devices by TensorFlow ..."
)
output
,
code
=
subproc_call
(
"nvidia-smi -L"
,
timeout
=
5
)
from
tensorflow.python.client
import
device_lib
if
code
!=
0
:
device_protos
=
device_lib
.
list_local_devices
()
return
0
gpus
=
[
x
.
name
for
x
in
device_protos
if
x
.
device_type
==
'GPU'
]
output
=
output
.
decode
(
'utf-8'
)
return
len
(
gpus
)
return
len
(
output
.
strip
()
.
split
(
'
\n
'
)
)
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