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
e156331b
Unverified
Commit
e156331b
authored
May 12, 2021
by
chwan-rice
Committed by
GitHub
May 13, 2021
Browse files
return a list of ntypes/etypes (#2742)
Co-authored-by:
Da Zheng
<
zhengda1936@gmail.com
>
parent
85231dc9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
python/dgl/distributed/partition.py
python/dgl/distributed/partition.py
+4
-1
No files found.
python/dgl/distributed/partition.py
View file @
e156331b
...
@@ -113,6 +113,7 @@ def load_partition(part_config, part_id):
...
@@ -113,6 +113,7 @@ def load_partition(part_config, part_id):
assert
EID
in
graph
.
edata
,
"the partition graph should contain edge mapping to global edge ID"
assert
EID
in
graph
.
edata
,
"the partition graph should contain edge mapping to global edge ID"
gpb
,
graph_name
,
ntypes
,
etypes
=
load_partition_book
(
part_config
,
part_id
,
graph
)
gpb
,
graph_name
,
ntypes
,
etypes
=
load_partition_book
(
part_config
,
part_id
,
graph
)
ntypes_list
,
etypes_list
=
[],
[]
for
ntype
in
ntypes
:
for
ntype
in
ntypes
:
ntype_id
=
ntypes
[
ntype
]
ntype_id
=
ntypes
[
ntype
]
# graph.ndata[NID] are global homogeneous node IDs.
# graph.ndata[NID] are global homogeneous node IDs.
...
@@ -122,6 +123,7 @@ def load_partition(part_config, part_id):
...
@@ -122,6 +123,7 @@ def load_partition(part_config, part_id):
partids2
=
gpb
.
nid2partid
(
per_type_nids
,
ntype
)
partids2
=
gpb
.
nid2partid
(
per_type_nids
,
ntype
)
assert
np
.
all
(
F
.
asnumpy
(
partids1
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids1
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids2
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids2
==
part_id
)),
'load a wrong partition'
ntypes_list
.
append
(
ntype
)
for
etype
in
etypes
:
for
etype
in
etypes
:
etype_id
=
etypes
[
etype
]
etype_id
=
etypes
[
etype
]
# graph.edata[EID] are global homogeneous edge IDs.
# graph.edata[EID] are global homogeneous edge IDs.
...
@@ -131,7 +133,8 @@ def load_partition(part_config, part_id):
...
@@ -131,7 +133,8 @@ def load_partition(part_config, part_id):
partids2
=
gpb
.
eid2partid
(
per_type_eids
,
etype
)
partids2
=
gpb
.
eid2partid
(
per_type_eids
,
etype
)
assert
np
.
all
(
F
.
asnumpy
(
partids1
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids1
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids2
==
part_id
)),
'load a wrong partition'
assert
np
.
all
(
F
.
asnumpy
(
partids2
==
part_id
)),
'load a wrong partition'
return
graph
,
node_feats
,
edge_feats
,
gpb
,
graph_name
,
ntypes
,
etypes
etypes_list
.
append
(
etype
)
return
graph
,
node_feats
,
edge_feats
,
gpb
,
graph_name
,
ntypes_list
,
etypes_list
def
load_partition_book
(
part_config
,
part_id
,
graph
=
None
):
def
load_partition_book
(
part_config
,
part_id
,
graph
=
None
):
''' Load a graph partition book from the partition config file.
''' Load a graph partition book from the partition config file.
...
...
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