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
21a40279
Unverified
Commit
21a40279
authored
Sep 02, 2021
by
xiang song(charlie.song)
Committed by
GitHub
Sep 02, 2021
Browse files
Fix distributed device mapping problem. (#3313)
Co-authored-by:
Ubuntu
<
ubuntu@ip-172-31-2-66.ec2.internal
>
parent
5a245104
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
5 deletions
+5
-5
examples/pytorch/graphsage/experimental/train_dist.py
examples/pytorch/graphsage/experimental/train_dist.py
+1
-1
examples/pytorch/graphsage/experimental/train_dist_transductive.py
...pytorch/graphsage/experimental/train_dist_transductive.py
+1
-1
examples/pytorch/graphsage/experimental/train_dist_unsupervised.py
...pytorch/graphsage/experimental/train_dist_unsupervised.py
+1
-1
examples/pytorch/graphsage/experimental/train_dist_unsupervised_transductive.py
...sage/experimental/train_dist_unsupervised_transductive.py
+1
-1
examples/pytorch/rgcn/experimental/entity_classify_dist.py
examples/pytorch/rgcn/experimental/entity_classify_dist.py
+1
-1
No files found.
examples/pytorch/graphsage/experimental/train_dist.py
View file @
21a40279
...
@@ -279,7 +279,7 @@ def main(args):
...
@@ -279,7 +279,7 @@ 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
(
g
.
rank
()
%
args
.
num_gpus
))
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
labels
=
g
.
ndata
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
())]
labels
=
g
.
ndata
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
())]
n_classes
=
len
(
th
.
unique
(
labels
[
th
.
logical_not
(
th
.
isnan
(
labels
))]))
n_classes
=
len
(
th
.
unique
(
labels
[
th
.
logical_not
(
th
.
isnan
(
labels
))]))
print
(
'#labels:'
,
n_classes
)
print
(
'#labels:'
,
n_classes
)
...
...
examples/pytorch/graphsage/experimental/train_dist_transductive.py
View file @
21a40279
...
@@ -276,7 +276,7 @@ def main(args):
...
@@ -276,7 +276,7 @@ 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
(
g
.
rank
()
%
args
.
num_gpus
))
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
labels
=
g
.
ndata
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
())]
labels
=
g
.
ndata
[
'labels'
][
np
.
arange
(
g
.
number_of_nodes
())]
n_classes
=
len
(
th
.
unique
(
labels
[
th
.
logical_not
(
th
.
isnan
(
labels
))]))
n_classes
=
len
(
th
.
unique
(
labels
[
th
.
logical_not
(
th
.
isnan
(
labels
))]))
print
(
'#labels:'
,
n_classes
)
print
(
'#labels:'
,
n_classes
)
...
...
examples/pytorch/graphsage/experimental/train_dist_unsupervised.py
View file @
21a40279
...
@@ -435,7 +435,7 @@ def main(args):
...
@@ -435,7 +435,7 @@ 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
(
g
.
rank
()
%
args
.
num_gpus
))
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
# Pack data
# Pack data
in_feats
=
g
.
ndata
[
'features'
].
shape
[
1
]
in_feats
=
g
.
ndata
[
'features'
].
shape
[
1
]
...
...
examples/pytorch/graphsage/experimental/train_dist_unsupervised_transductive.py
View file @
21a40279
...
@@ -198,7 +198,7 @@ def main(args):
...
@@ -198,7 +198,7 @@ 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
(
g
.
rank
()
%
args
.
num_gpus
))
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
# Pack data
# Pack data
global_train_nid
=
global_train_nid
.
squeeze
()
global_train_nid
=
global_train_nid
.
squeeze
()
...
...
examples/pytorch/rgcn/experimental/entity_classify_dist.py
View file @
21a40279
...
@@ -573,7 +573,7 @@ def main(args):
...
@@ -573,7 +573,7 @@ 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
(
g
.
rank
()
%
args
.
num_gpus
))
device
=
th
.
device
(
'cuda:'
+
str
(
args
.
local_rank
))
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