Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
8f1b5782
Unverified
Commit
8f1b5782
authored
Nov 08, 2023
by
Ramon Zhou
Committed by
GitHub
Nov 08, 2023
Browse files
[Misc] Add dist.barrier to fix low accuracy issue in the example. (#6544)
parent
0b5abba8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
examples/multigpu/graphbolt/node_classification.py
examples/multigpu/graphbolt/node_classification.py
+2
-0
No files found.
examples/multigpu/graphbolt/node_classification.py
View file @
8f1b5782
...
@@ -278,6 +278,7 @@ def train(
...
@@ -278,6 +278,7 @@ def train(
dist
.
reduce
(
tensor
=
acc
,
dst
=
0
)
dist
.
reduce
(
tensor
=
acc
,
dst
=
0
)
total_loss
/=
step
+
1
total_loss
/=
step
+
1
dist
.
reduce
(
tensor
=
total_loss
,
dst
=
0
)
dist
.
reduce
(
tensor
=
total_loss
,
dst
=
0
)
dist
.
barrier
()
epoch_end
=
time
.
time
()
epoch_end
=
time
.
time
()
if
rank
==
0
:
if
rank
==
0
:
...
@@ -349,6 +350,7 @@ def run(rank, world_size, args, devices, dataset):
...
@@ -349,6 +350,7 @@ def run(rank, world_size, args, devices, dataset):
/
world_size
/
world_size
)
)
dist
.
reduce
(
tensor
=
test_acc
,
dst
=
0
)
dist
.
reduce
(
tensor
=
test_acc
,
dst
=
0
)
dist
.
barrier
()
if
rank
==
0
:
if
rank
==
0
:
print
(
f
"Test Accuracy
{
test_acc
.
item
():.
4
f
}
"
)
print
(
f
"Test Accuracy
{
test_acc
.
item
():.
4
f
}
"
)
...
...
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