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
3808dc95
Unverified
Commit
3808dc95
authored
Aug 28, 2020
by
Zihao Ye
Committed by
GitHub
Aug 28, 2020
Browse files
[hotfix] Disable hypersparse memory optimization. (#2121)
* upd * upd
parent
0435b74c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
8 deletions
+31
-8
src/graph/unit_graph.cc
src/graph/unit_graph.cc
+5
-2
tests/compute/test_graph.py
tests/compute/test_graph.py
+20
-0
tests/compute/test_heterograph.py
tests/compute/test_heterograph.py
+2
-2
tests/compute/test_sampling.py
tests/compute/test_sampling.py
+4
-4
No files found.
src/graph/unit_graph.cc
View file @
3808dc95
...
@@ -1446,8 +1446,11 @@ SparseFormat UnitGraph::SelectFormat(dgl_format_code_t preferred_formats) const
...
@@ -1446,8 +1446,11 @@ SparseFormat UnitGraph::SelectFormat(dgl_format_code_t preferred_formats) const
dgl_format_code_t
created
=
GetCreatedFormats
();
dgl_format_code_t
created
=
GetCreatedFormats
();
if
(
common
&
created
)
if
(
common
&
created
)
return
DecodeFormat
(
common
&
created
);
return
DecodeFormat
(
common
&
created
);
if
(
coo_
->
defined
()
&&
coo_
->
IsHypersparse
())
// only allow coo for hypersparse graph.
return
SparseFormat
::
kCOO
;
// NOTE(zihao): hypersparse is currently disabled since many CUDA operators on COO have
// not been implmented yet.
// if (coo_->defined() && coo_->IsHypersparse()) // only allow coo for hypersparse graph.
// return SparseFormat::kCOO;
if
(
common
)
if
(
common
)
return
DecodeFormat
(
common
);
return
DecodeFormat
(
common
);
return
DecodeFormat
(
created
);
return
DecodeFormat
(
created
);
...
...
tests/compute/test_graph.py
View file @
3808dc95
...
@@ -319,9 +319,29 @@ def test_ismultigraph():
...
@@ -319,9 +319,29 @@ def test_ismultigraph():
g
.
add_edges
([
0
,
2
],
[
0
,
3
])
g
.
add_edges
([
0
,
2
],
[
0
,
3
])
assert
g
.
is_multigraph
==
True
assert
g
.
is_multigraph
==
True
def
test_hypersparse_query
():
g
=
dgl
.
DGLGraph
()
g
=
g
.
to
(
F
.
ctx
())
g
.
add_nodes
(
1000001
)
g
.
add_edges
([
0
],
[
1
])
for
i
in
range
(
10
):
assert
g
.
has_node
(
i
)
assert
i
in
g
assert
not
g
.
has_node
(
1000002
)
assert
g
.
edge_id
(
0
,
1
)
==
0
src
,
dst
=
g
.
find_edges
([
0
])
src
,
dst
,
eid
=
g
.
in_edges
(
1
,
form
=
'all'
)
src
,
dst
,
eid
=
g
.
out_edges
(
0
,
form
=
'all'
)
src
,
dst
=
g
.
edges
()
assert
g
.
in_degree
(
0
)
==
0
assert
g
.
in_degree
(
1
)
==
1
assert
g
.
out_degree
(
0
)
==
1
assert
g
.
out_degree
(
1
)
==
0
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_query
()
test_query
()
test_mutation
()
test_mutation
()
test_scipy_adjmat
()
test_scipy_adjmat
()
test_incmat
()
test_incmat
()
test_find_edges
()
test_find_edges
()
test_hypersparse_query
()
tests/compute/test_heterograph.py
View file @
3808dc95
...
@@ -366,7 +366,7 @@ def test_query(idtype):
...
@@ -366,7 +366,7 @@ def test_query(idtype):
print
(
g
)
print
(
g
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU does not have COO impl."
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU does not have COO impl."
)
def
test_hypersparse
():
def
_
test_hypersparse
():
N1
=
1
<<
50
# should crash if allocated a CSR
N1
=
1
<<
50
# should crash if allocated a CSR
N2
=
1
<<
48
N2
=
1
<<
48
...
@@ -431,7 +431,7 @@ def test_hypersparse():
...
@@ -431,7 +431,7 @@ def test_hypersparse():
assert
g
.
out_degrees
(
N2
,
'plays'
)
==
0
assert
g
.
out_degrees
(
N2
,
'plays'
)
==
0
assert
F
.
asnumpy
(
g
.
out_degrees
([
0
,
N2
],
'plays'
)).
tolist
()
==
[
1
,
0
]
assert
F
.
asnumpy
(
g
.
out_degrees
([
0
,
N2
],
'plays'
)).
tolist
()
==
[
1
,
0
]
def
test_edge_ids
():
def
_
test_edge_ids
():
N1
=
1
<<
50
# should crash if allocated a CSR
N1
=
1
<<
50
# should crash if allocated a CSR
N2
=
1
<<
48
N2
=
1
<<
48
...
...
tests/compute/test_sampling.py
View file @
3808dc95
...
@@ -531,22 +531,22 @@ def _test_sample_neighbors_topk_outedge(hypersparse):
...
@@ -531,22 +531,22 @@ def _test_sample_neighbors_topk_outedge(hypersparse):
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
def
test_sample_neighbors
():
def
test_sample_neighbors
():
_test_sample_neighbors
(
False
)
_test_sample_neighbors
(
False
)
_test_sample_neighbors
(
True
)
#
_test_sample_neighbors(True)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
def
test_sample_neighbors_outedge
():
def
test_sample_neighbors_outedge
():
_test_sample_neighbors_outedge
(
False
)
_test_sample_neighbors_outedge
(
False
)
_test_sample_neighbors_outedge
(
True
)
#
_test_sample_neighbors_outedge(True)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
def
test_sample_neighbors_topk
():
def
test_sample_neighbors_topk
():
_test_sample_neighbors_topk
(
False
)
_test_sample_neighbors_topk
(
False
)
_test_sample_neighbors_topk
(
True
)
#
_test_sample_neighbors_topk(True)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
def
test_sample_neighbors_topk_outedge
():
def
test_sample_neighbors_topk_outedge
():
_test_sample_neighbors_topk_outedge
(
False
)
_test_sample_neighbors_topk_outedge
(
False
)
_test_sample_neighbors_topk_outedge
(
True
)
#
_test_sample_neighbors_topk_outedge(True)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
@
unittest
.
skipIf
(
F
.
_default_context_str
==
'gpu'
,
reason
=
"GPU sample neighbors not implemented"
)
def
test_sample_neighbors_with_0deg
():
def
test_sample_neighbors_with_0deg
():
...
...
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