Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
maskrcnn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
人工智能
maskrcnn
Commits
c5ca36fc
Commit
c5ca36fc
authored
Jan 30, 2019
by
夜阑听风
Committed by
Francisco Massa
Jan 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use dist.barrier to synchronize (#393)
parent
5f2a8263
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
14 deletions
+3
-14
comm.py
maskrcnn_benchmark/utils/comm.py
+1
-14
test_net.py
tools/test_net.py
+1
-0
train_net.py
tools/train_net.py
+1
-0
No files found.
maskrcnn_benchmark/utils/comm.py
View file @
c5ca36fc
...
...
@@ -40,22 +40,9 @@ def synchronize():
if
not
dist
.
is_initialized
():
return
world_size
=
dist
.
get_world_size
()
rank
=
dist
.
get_rank
()
if
world_size
==
1
:
return
def
_send_and_wait
(
r
):
if
rank
==
r
:
tensor
=
torch
.
tensor
(
0
,
device
=
"cuda"
)
else
:
tensor
=
torch
.
tensor
(
1
,
device
=
"cuda"
)
dist
.
broadcast
(
tensor
,
r
)
while
tensor
.
item
()
==
1
:
time
.
sleep
(
1
)
_send_and_wait
(
0
)
# now sync on the main process
_send_and_wait
(
1
)
dist
.
barrier
()
def
all_gather
(
data
):
...
...
tools/test_net.py
View file @
c5ca36fc
...
...
@@ -44,6 +44,7 @@ def main():
torch
.
distributed
.
init_process_group
(
backend
=
"nccl"
,
init_method
=
"env://"
)
synchronize
()
cfg
.
merge_from_file
(
args
.
config_file
)
cfg
.
merge_from_list
(
args
.
opts
)
...
...
tools/train_net.py
View file @
c5ca36fc
...
...
@@ -139,6 +139,7 @@ def main():
torch
.
distributed
.
init_process_group
(
backend
=
"nccl"
,
init_method
=
"env://"
)
synchronize
()
cfg
.
merge_from_file
(
args
.
config_file
)
cfg
.
merge_from_list
(
args
.
opts
)
...
...
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