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
e14860d9
"dgl_sparse/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "ff090f698e0fbb2382f7c8ec2ca20a2e4500efdd"
Unverified
Commit
e14860d9
authored
Aug 18, 2022
by
Rhett Ying
Committed by
GitHub
Aug 18, 2022
Browse files
[Example][Bug] fix device index for dist train on GPUs (#4403)
parent
cf4727a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
examples/pytorch/rgcn/experimental/entity_classify_dist.py
examples/pytorch/rgcn/experimental/entity_classify_dist.py
+2
-1
No files found.
examples/pytorch/rgcn/experimental/entity_classify_dist.py
View file @
e14860d9
...
@@ -573,7 +573,8 @@ def main(args):
...
@@ -573,7 +573,8 @@ def main(args):
if
args
.
num_gpus
==
-
1
:
if
args
.
num_gpus
==
-
1
:
device
=
th
.
device
(
'cpu'
)
device
=
th
.
device
(
'cpu'
)
else
:
else
:
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
dev_id
=
g
.
rank
()
%
args
.
num_gpus
device
=
th
.
device
(
'cuda:'
+
str
(
dev_id
))
labels
=
g
.
nodes
[
'paper'
].
data
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))]
labels
=
g
.
nodes
[
'paper'
].
data
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))]
all_val_nid
=
th
.
LongTensor
(
np
.
nonzero
(
g
.
nodes
[
'paper'
].
data
[
'val_mask'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))])).
squeeze
()
all_val_nid
=
th
.
LongTensor
(
np
.
nonzero
(
g
.
nodes
[
'paper'
].
data
[
'val_mask'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))])).
squeeze
()
all_test_nid
=
th
.
LongTensor
(
np
.
nonzero
(
g
.
nodes
[
'paper'
].
data
[
'test_mask'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))])).
squeeze
()
all_test_nid
=
th
.
LongTensor
(
np
.
nonzero
(
g
.
nodes
[
'paper'
].
data
[
'test_mask'
][
np
.
arange
(
g
.
number_of_nodes
(
'paper'
))])).
squeeze
()
...
...
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