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
4f352b29
You need to sign in or sign up before continuing.
Commit
4f352b29
authored
Jun 24, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pipedir in prefetchzmq
parent
ef117f9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
tensorpack/dataflow/imgaug/base.py
tensorpack/dataflow/imgaug/base.py
+1
-1
tensorpack/dataflow/prefetch.py
tensorpack/dataflow/prefetch.py
+13
-4
No files found.
tensorpack/dataflow/imgaug/base.py
View file @
4f352b29
...
...
@@ -75,7 +75,7 @@ class AugmentorList(ImageAugmentor):
super
(
AugmentorList
,
self
)
.
__init__
()
def
_get_augment_params
(
self
,
img
):
# the next augmentor requires the previos one to finish
# the next augmentor requires the previo
u
s one to finish
raise
RuntimeError
(
"Cannot simply get parameters of a AugmentorList!"
)
def
_augment_return_params
(
self
,
img
):
...
...
tensorpack/dataflow/prefetch.py
View file @
4f352b29
...
...
@@ -95,11 +95,12 @@ class PrefetchProcessZMQ(multiprocessing.Process):
class
PrefetchDataZMQ
(
ProxyDataFlow
):
""" Work the same as `PrefetchData`, but faster. """
def
__init__
(
self
,
ds
,
nr_proc
=
1
):
def
__init__
(
self
,
ds
,
nr_proc
=
1
,
pipedir
=
'.'
):
"""
:param ds: a `DataFlow` instance.
:param nr_proc: number of processes to use. When larger than 1, order
of datapoints will be random.
:param pipedir: a local directory where the pipes would be. Useful if you're running on non-local FS such as NFS.
"""
super
(
PrefetchDataZMQ
,
self
)
.
__init__
(
ds
)
try
:
...
...
@@ -110,7 +111,8 @@ class PrefetchDataZMQ(ProxyDataFlow):
self
.
context
=
zmq
.
Context
()
self
.
socket
=
self
.
context
.
socket
(
zmq
.
PULL
)
self
.
pipename
=
"ipc://dataflow-pipe-"
+
str
(
uuid
.
uuid1
())[:
6
]
assert
os
.
path
.
isdir
(
pipedir
)
self
.
pipename
=
"ipc://{}/dataflow-pipe-"
.
format
(
pipedir
.
rstrip
(
'/'
))
+
str
(
uuid
.
uuid1
())[:
6
]
self
.
socket
.
set_hwm
(
5
)
# a little bit faster than default, don't know why
self
.
socket
.
bind
(
self
.
pipename
)
...
...
@@ -130,9 +132,16 @@ class PrefetchDataZMQ(ProxyDataFlow):
yield
dp
def
__del__
(
self
):
logger
.
info
(
"Prefetch process exiting..."
)
# on exit, logger may not be functional anymore
try
:
logger
.
info
(
"Prefetch process exiting..."
)
except
:
pass
if
not
self
.
context
.
closed
:
self
.
context
.
destroy
(
0
)
for
x
in
self
.
procs
:
x
.
terminate
()
logger
.
info
(
"Prefetch process exited."
)
try
:
logger
.
info
(
"Prefetch process exited."
)
except
:
pass
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