Unverified Commit 3808dc95 authored by Zihao Ye's avatar Zihao Ye Committed by GitHub
Browse files

[hotfix] Disable hypersparse memory optimization. (#2121)

* upd

* upd
parent 0435b74c
...@@ -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);
......
...@@ -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()
...@@ -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
......
...@@ -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():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment