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
41c8446c
Commit
41c8446c
authored
Jul 14, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing file
parent
eee59532
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
tensorpack/train/base.py
tensorpack/train/base.py
+1
-1
tensorpack/utils/gpu.py
tensorpack/utils/gpu.py
+24
-0
No files found.
tensorpack/train/base.py
View file @
41c8446c
...
...
@@ -136,9 +136,9 @@ class Trainer(object):
except
(
KeyboardInterrupt
,
Exception
):
raise
finally
:
self
.
coord
.
request_stop
()
# Do I need to run queue.close?
callbacks
.
after_train
()
self
.
coord
.
request_stop
()
self
.
summary_writer
.
close
()
self
.
sess
.
close
()
...
...
tensorpack/utils/gpu.py
0 → 100644
View file @
41c8446c
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: gpu.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from
.utils
import
change_env
__all__
=
[
'change_gpu'
,
'get_nr_gpu'
,
'get_gpus'
]
def
change_gpu
(
val
):
return
change_env
(
'CUDA_VISIBLE_DEVICES'
,
str
(
val
))
def
get_nr_gpu
():
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
,
None
)
assert
env
is
not
None
# TODO
return
len
(
env
.
split
(
','
))
def
get_gpus
():
""" return a list of GPU physical id"""
env
=
os
.
environ
.
get
(
'CUDA_VISIBLE_DEVICES'
,
None
)
assert
env
is
not
None
# TODO
return
map
(
int
,
env
.
strip
()
.
split
(
','
))
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