dmlc--dgl
44089c8b4d
* Merge * [Graph][CUDA] Graph on GPU and many refactoring (#1791) * change edge_ids behavior and C++ impl * fix unittests; remove utils.Index in edge_id * pass mx and th tests * pass tf test * add aten::Scatter_ * Add nonzero; impl CSRGetDataAndIndices/CSRSliceMatrix * CSRGetData and CSRGetDataAndIndices passed tests * CSRSliceMatrix basic tests * fix bug in empty slice * CUDA CSRHasDuplicate * has_node; has_edge_between * predecessors, successors * deprecate send/recv; fix send_and_recv * deprecate send/recv; fix send_and_recv * in_edges; out_edges; all_edges; apply_edges * in deg/out deg * subgraph/edge_subgraph * adj * in_subgraph/out_subgraph * sample neighbors * set/get_n/e_repr * wip: working on refactoring all idtypes * pass ndata/edata tests on gpu * fix * stash * workaround nonzero issue * stash * nx conversion * test_hetero_basics except update routines * test_update_routines * test_hetero_basics for pytorch * more fixes * WIP: flatten graph * wip: flatten * test_flatten * test_to_device * fix bug in to_homo * fix bug in CSRSliceMatrix * pass subgraph test * fix send_and_recv * fix filter * test_heterograph * passed all pytorch tests * fix mx unittest * fix pytorch test_nn * fix all unittests for PyTorch * passed all mxnet tests * lint * fix tf nn test * pass all tf tests * lint * lint * change deprecation * try fix compile * lint * update METIDS * fix utest * fix * fix utests * try debug * revert * small fix * fix utests * upd * upd * upd * fix * upd * upd * upd * upd * upd * trigger * +1s * [kernel] Use heterograph index instead of unitgraph index (#1813) * upd * upd * upd * fix * upd * upd * upd * upd * upd * trigger * +1s * [Graph] Mutation for Heterograph (#1818) * mutation add_nodes and add_edges * Add support for remove_edges, remove_nodes, add_selfloop, remove_selfloop * Fix Co-authored-by: Ubuntu <ubuntu@ip-172-31-51-214.ec2.internal> * upd * upd * upd * fix * [Transfom] Mutable transform (#1833) * add nodesy * All three * Fix * lint * Add some test case * Fix * Fix * Fix * Fix * Fix * Fix * fix * triger * Fix * fix Co-authored-by: Ubuntu <ubuntu@ip-172-31-51-214.ec2.internal> * [Graph] Migrate Batch & Readout module to heterograph (#1836) * dgl.batch * unbatch * fix to device * reduce readout; segment reduce * change batch_num_nodes|edges to function * reduce readout/ softmax * broadcast * topk * fix * fix tf and mx * fix some ci * fix batch but unbatch differently * new checkk * upd * upd * upd * idtype behavior; code reorg * idtype behavior; code reorg * wip: test_basics * pass test_basics * WIP: from nx/ to nx * missing files * upd * pass test_basics:test_nx_conversion * Fix test * Fix inplace update * WIP: fixing tests * upd * pass test_transform cpu * pass gpu test_transform * pass test_batched_graph * GPU graph auto cast to int32 * missing file * stash * WIP: rgcn-hetero * Fix two datasety * upd * weird * Fix capsuley * fuck you * fuck matthias * Fix dgmg * fix bug in block degrees; pass rgcn-hetero * rgcn * gat and diffpool fix also fix ppi and tu dataset * Tree LSTM * pointcloud * rrn; wip: sgc * resolve conflicts * upd * sgc and reddit dataset * upd * Fix deepwalk, gindt and gcn * fix datasets and sign * optimization * optimization * upd * upd * Fix GIN * fix bug in add_nodes add_edges; tagcn * adaptive sampling and gcmc * upd * upd * fix geometric * fix * metapath2vec * fix agnn * fix pickling problem of block * fix utests * miss file * linegraph * upd * upd * upd * graphsage * stgcn_wave * fix hgt * on unittests * Fix transformer * Fix HAN * passed pytorch unittests * lint * fix * Fix cluster gcn * cluster-gcn is ready * on fixing block related codes * 2nd order derivative * Revert "2nd order derivative" This reverts commit 523bf6c249bee61b51b1ad1babf42aad4167f206. * passed torch utests again * fix all mxnet unittests * delete some useless tests * pass all tf cpu tests * disable * disable distributed unittest * fix * fix * lint * fix * fix * fix script * fix tutorial * fix apply edges bug * fix 2 basics * fix tutorial Co-authored-by: yzh119 <expye@outlook.com> Co-authored-by: xiang song(charlie.song) <classicxsong@gmail.com> Co-authored-by: Ubuntu <ubuntu@ip-172-31-51-214.ec2.internal> Co-authored-by: Ubuntu <ubuntu@ip-172-31-7-42.us-west-2.compute.internal> Co-authored-by: Ubuntu <ubuntu@ip-172-31-1-5.us-west-2.compute.internal> Co-authored-by: Ubuntu <ubuntu@ip-172-31-68-185.ec2.internal>
345 行
12 KiB
C++
345 行
12 KiB
C++
/*!
|
|
* Copyright (c) 2019 by Contributors
|
|
* \file test_unit_graph.cc
|
|
* \brief Test UnitGraph
|
|
*/
|
|
#include <gtest/gtest.h>
|
|
#include <dgl/array.h>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <dgl/immutable_graph.h>
|
|
#include "./common.h"
|
|
#include "./../src/graph/heterograph.h"
|
|
#include "../../src/graph/unit_graph.h"
|
|
|
|
using namespace dgl;
|
|
using namespace dgl::runtime;
|
|
|
|
template <typename IdType>
|
|
aten::CSRMatrix CSR1(DLContext ctx) {
|
|
/*
|
|
* G = [[0, 0, 1],
|
|
* [1, 0, 1],
|
|
* [0, 1, 0],
|
|
* [1, 0, 1]]
|
|
*/
|
|
IdArray g_indptr =
|
|
aten::VecToIdArray(std::vector<IdType>({0, 1, 3, 4, 6}), sizeof(IdType)*8, CTX);
|
|
IdArray g_indices =
|
|
aten::VecToIdArray(std::vector<IdType>({2, 0, 2, 1, 0, 2}), sizeof(IdType)*8, CTX);
|
|
|
|
const aten::CSRMatrix &csr_a = aten::CSRMatrix(
|
|
4,
|
|
3,
|
|
g_indptr,
|
|
g_indices,
|
|
aten::NullArray(),
|
|
false);
|
|
return csr_a;
|
|
}
|
|
|
|
template aten::CSRMatrix CSR1<int32_t>(DLContext ctx);
|
|
template aten::CSRMatrix CSR1<int64_t>(DLContext ctx);
|
|
|
|
template <typename IdType>
|
|
aten::COOMatrix COO1(DLContext ctx) {
|
|
/*
|
|
* G = [[1, 1, 0],
|
|
* [0, 1, 0]]
|
|
*/
|
|
IdArray g_row =
|
|
aten::VecToIdArray(std::vector<IdType>({0, 0, 1}), sizeof(IdType)*8, CTX);
|
|
IdArray g_col =
|
|
aten::VecToIdArray(std::vector<IdType>({0, 1, 1}), sizeof(IdType)*8, CTX);
|
|
const aten::COOMatrix &coo = aten::COOMatrix(
|
|
2,
|
|
3,
|
|
g_row,
|
|
g_col,
|
|
aten::NullArray(),
|
|
true,
|
|
true);
|
|
|
|
return coo;
|
|
}
|
|
|
|
template aten::COOMatrix COO1<int32_t>(DLContext ctx);
|
|
template aten::COOMatrix COO1<int64_t>(DLContext ctx);
|
|
|
|
template <typename IdType>
|
|
void _TestUnitGraph(DLContext ctx) {
|
|
const aten::CSRMatrix &csr = CSR1<IdType>(ctx);
|
|
const aten::COOMatrix &coo = COO1<IdType>(ctx);
|
|
|
|
auto g = CreateFromCSC(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
|
|
g = CreateFromCSR(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
|
|
g = CreateFromCOO(2, coo);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
|
|
auto src = aten::VecToIdArray<int64_t>({1, 2, 5, 3});
|
|
auto dst = aten::VecToIdArray<int64_t>({1, 6, 2, 6});
|
|
auto mg = dgl::UnitGraph::CreateFromCOO(2, 9, 8, src, dst, coo_code);
|
|
ASSERT_EQ(mg->GetCreatedFormats(), 1);
|
|
auto hmg = dgl::UnitGraph::CreateFromCOO(1, 8, 8, src, dst, coo_code);
|
|
auto img = std::dynamic_pointer_cast<ImmutableGraph>(hmg->AsImmutableGraph());
|
|
ASSERT_TRUE(img != nullptr);
|
|
mg = dgl::UnitGraph::CreateFromCOO(2, 9, 8, src, dst, csr_code | coo_code);
|
|
ASSERT_EQ(mg->GetCreatedFormats(), 1);
|
|
hmg = dgl::UnitGraph::CreateFromCOO(1, 8, 8, src, dst, csr_code | coo_code);
|
|
img = std::dynamic_pointer_cast<ImmutableGraph>(hmg->AsImmutableGraph());
|
|
ASSERT_TRUE(img != nullptr);
|
|
mg = dgl::UnitGraph::CreateFromCOO(2, 9, 8, src, dst, csc_code | coo_code);
|
|
ASSERT_EQ(mg->GetCreatedFormats(), 1);
|
|
hmg = dgl::UnitGraph::CreateFromCOO(1, 8, 8, src, dst, csc_code | coo_code);
|
|
img = std::dynamic_pointer_cast<ImmutableGraph>(hmg->AsImmutableGraph());
|
|
ASSERT_TRUE(img != nullptr);
|
|
|
|
g = CreateFromCSC(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
|
|
g = CreateFromCSR(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
|
|
g = CreateFromCOO(2, coo);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
}
|
|
|
|
template <typename IdType>
|
|
void _TestUnitGraph_GetInCSR(DLContext ctx) {
|
|
const aten::CSRMatrix &csr = CSR1<IdType>(ctx);
|
|
const aten::COOMatrix &coo = COO1<IdType>(ctx);
|
|
|
|
auto g = CreateFromCSC(2, csr);
|
|
auto in_csr_matrix = g->GetCSCMatrix(0);
|
|
ASSERT_EQ(in_csr_matrix.num_rows, csr.num_rows);
|
|
ASSERT_EQ(in_csr_matrix.num_cols, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
|
|
// test out csr
|
|
g = CreateFromCSR(2, csr);
|
|
auto g_ptr = g->GetGraphInFormat(csc_code);
|
|
in_csr_matrix = g_ptr->GetCSCMatrix(0);
|
|
ASSERT_EQ(in_csr_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(in_csr_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
in_csr_matrix = g->GetCSCMatrix(0);
|
|
ASSERT_EQ(in_csr_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(in_csr_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 6);
|
|
|
|
// test out coo
|
|
g = CreateFromCOO(2, coo);
|
|
g_ptr = g->GetGraphInFormat(csc_code);
|
|
in_csr_matrix = g_ptr->GetCSCMatrix(0);
|
|
ASSERT_EQ(in_csr_matrix.num_cols, coo.num_rows);
|
|
ASSERT_EQ(in_csr_matrix.num_rows, coo.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
|
|
in_csr_matrix = g->GetCSCMatrix(0);
|
|
ASSERT_EQ(in_csr_matrix.num_cols, coo.num_rows);
|
|
ASSERT_EQ(in_csr_matrix.num_rows, coo.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 5);
|
|
}
|
|
|
|
template <typename IdType>
|
|
void _TestUnitGraph_GetOutCSR(DLContext ctx) {
|
|
const aten::CSRMatrix &csr = CSR1<IdType>(ctx);
|
|
const aten::COOMatrix &coo = COO1<IdType>(ctx);
|
|
|
|
auto g = CreateFromCSC(2, csr);
|
|
auto g_ptr = g->GetGraphInFormat(csr_code);
|
|
auto out_csr_matrix = g_ptr->GetCSRMatrix(0);
|
|
ASSERT_EQ(out_csr_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(out_csr_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
out_csr_matrix = g->GetCSRMatrix(0);
|
|
ASSERT_EQ(out_csr_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(out_csr_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 6);
|
|
|
|
// test out csr
|
|
g = CreateFromCSR(2, csr);
|
|
out_csr_matrix = g->GetCSRMatrix(0);
|
|
ASSERT_EQ(out_csr_matrix.num_rows, csr.num_rows);
|
|
ASSERT_EQ(out_csr_matrix.num_cols, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
|
|
// test out coo
|
|
g = CreateFromCOO(2, coo);
|
|
g_ptr = g->GetGraphInFormat(csr_code);
|
|
out_csr_matrix = g_ptr->GetCSRMatrix(0);
|
|
ASSERT_EQ(out_csr_matrix.num_rows, coo.num_rows);
|
|
ASSERT_EQ(out_csr_matrix.num_cols, coo.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
|
|
out_csr_matrix = g->GetCSRMatrix(0);
|
|
ASSERT_EQ(out_csr_matrix.num_rows, coo.num_rows);
|
|
ASSERT_EQ(out_csr_matrix.num_cols, coo.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 3);
|
|
}
|
|
|
|
template <typename IdType>
|
|
void _TestUnitGraph_GetCOO(DLContext ctx) {
|
|
const aten::CSRMatrix &csr = CSR1<IdType>(ctx);
|
|
const aten::COOMatrix &coo = COO1<IdType>(ctx);
|
|
|
|
auto g = CreateFromCSC(2, csr);
|
|
auto g_ptr = g->GetGraphInFormat(coo_code);
|
|
auto out_coo_matrix = g_ptr->GetCOOMatrix(0);
|
|
ASSERT_EQ(out_coo_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(out_coo_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
out_coo_matrix = g->GetCOOMatrix(0);
|
|
ASSERT_EQ(out_coo_matrix.num_cols, csr.num_rows);
|
|
ASSERT_EQ(out_coo_matrix.num_rows, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 5);
|
|
|
|
// test out csr
|
|
g = CreateFromCSR(2, csr);
|
|
g_ptr = g->GetGraphInFormat(coo_code);
|
|
out_coo_matrix = g_ptr->GetCOOMatrix(0);
|
|
ASSERT_EQ(out_coo_matrix.num_rows, csr.num_rows);
|
|
ASSERT_EQ(out_coo_matrix.num_cols, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
out_coo_matrix = g->GetCOOMatrix(0);
|
|
ASSERT_EQ(out_coo_matrix.num_rows, csr.num_rows);
|
|
ASSERT_EQ(out_coo_matrix.num_cols, csr.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 3);
|
|
|
|
// test out coo
|
|
g = CreateFromCOO(2, coo);
|
|
out_coo_matrix = g->GetCOOMatrix(0);
|
|
ASSERT_EQ(out_coo_matrix.num_rows, coo.num_rows);
|
|
ASSERT_EQ(out_coo_matrix.num_cols, coo.num_cols);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
}
|
|
|
|
template <typename IdType>
|
|
void _TestUnitGraph_Reserve(DLContext ctx) {
|
|
const aten::CSRMatrix &csr = CSR1<IdType>(ctx);
|
|
const aten::COOMatrix &coo = COO1<IdType>(ctx);
|
|
|
|
auto g = CreateFromCSC(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 4);
|
|
auto r_g =
|
|
std::dynamic_pointer_cast<UnitGraph>(g->GetRelationGraph(0))->Reverse();
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 2);
|
|
aten::CSRMatrix g_in_csr = g->GetCSCMatrix(0);
|
|
aten::CSRMatrix r_g_out_csr = r_g->GetCSRMatrix(0);
|
|
ASSERT_TRUE(g_in_csr.indptr->data == r_g_out_csr.indptr->data);
|
|
ASSERT_TRUE(g_in_csr.indices->data == r_g_out_csr.indices->data);
|
|
aten::CSRMatrix g_out_csr = g->GetCSRMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 6);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 6);
|
|
aten::CSRMatrix r_g_in_csr = r_g->GetCSCMatrix(0);
|
|
ASSERT_TRUE(g_out_csr.indptr->data == r_g_in_csr.indptr->data);
|
|
ASSERT_TRUE(g_out_csr.indices->data == r_g_in_csr.indices->data);
|
|
aten::COOMatrix g_coo = g->GetCOOMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 7);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 6);
|
|
aten::COOMatrix r_g_coo = r_g->GetCOOMatrix(0);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 7);
|
|
ASSERT_EQ(g_coo.num_rows, r_g_coo.num_cols);
|
|
ASSERT_EQ(g_coo.num_cols, r_g_coo.num_rows);
|
|
ASSERT_TRUE(ArrayEQ<IdType>(g_coo.row, r_g_coo.col));
|
|
ASSERT_TRUE(ArrayEQ<IdType>(g_coo.col, r_g_coo.row));
|
|
|
|
// test out csr
|
|
g = CreateFromCSR(2, csr);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 2);
|
|
r_g = std::dynamic_pointer_cast<UnitGraph>(g->GetRelationGraph(0))->Reverse();
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 4);
|
|
g_out_csr = g->GetCSRMatrix(0);
|
|
r_g_in_csr = r_g->GetCSCMatrix(0);
|
|
ASSERT_TRUE(g_out_csr.indptr->data == r_g_in_csr.indptr->data);
|
|
ASSERT_TRUE(g_out_csr.indices->data == r_g_in_csr.indices->data);
|
|
g_in_csr = g->GetCSCMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 6);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 6);
|
|
r_g_out_csr = r_g->GetCSRMatrix(0);
|
|
ASSERT_TRUE(g_in_csr.indptr->data == r_g_out_csr.indptr->data);
|
|
ASSERT_TRUE(g_in_csr.indices->data == r_g_out_csr.indices->data);
|
|
g_coo = g->GetCOOMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 7);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 6);
|
|
r_g_coo = r_g->GetCOOMatrix(0);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 7);
|
|
ASSERT_EQ(g_coo.num_rows, r_g_coo.num_cols);
|
|
ASSERT_EQ(g_coo.num_cols, r_g_coo.num_rows);
|
|
ASSERT_TRUE(ArrayEQ<IdType>(g_coo.row, r_g_coo.col));
|
|
ASSERT_TRUE(ArrayEQ<IdType>(g_coo.col, r_g_coo.row));
|
|
|
|
// test out coo
|
|
g = CreateFromCOO(2, coo);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 1);
|
|
r_g = std::dynamic_pointer_cast<UnitGraph>(g->GetRelationGraph(0))->Reverse();
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 1);
|
|
g_coo = g->GetCOOMatrix(0);
|
|
r_g_coo = r_g->GetCOOMatrix(0);
|
|
ASSERT_EQ(g_coo.num_rows, r_g_coo.num_cols);
|
|
ASSERT_EQ(g_coo.num_cols, r_g_coo.num_rows);
|
|
ASSERT_TRUE(g_coo.row->data == r_g_coo.col->data);
|
|
ASSERT_TRUE(g_coo.col->data == r_g_coo.row->data);
|
|
g_in_csr = g->GetCSCMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 5);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 3);
|
|
r_g_out_csr = r_g->GetCSRMatrix(0);
|
|
ASSERT_TRUE(g_in_csr.indptr->data == r_g_out_csr.indptr->data);
|
|
ASSERT_TRUE(g_in_csr.indices->data == r_g_out_csr.indices->data);
|
|
g_out_csr = g->GetCSRMatrix(0);
|
|
ASSERT_EQ(g->GetCreatedFormats(), 7);
|
|
ASSERT_EQ(r_g->GetCreatedFormats(), 7);
|
|
r_g_in_csr = r_g->GetCSCMatrix(0);
|
|
ASSERT_TRUE(g_out_csr.indptr->data == r_g_in_csr.indptr->data);
|
|
ASSERT_TRUE(g_out_csr.indices->data == r_g_in_csr.indices->data);
|
|
}
|
|
|
|
TEST(UniGraphTest, TestUnitGraph_Create) {
|
|
_TestUnitGraph<int32_t>(CPU);
|
|
_TestUnitGraph<int64_t>(CPU);
|
|
#ifdef DGL_USE_CUDA
|
|
_TestUnitGraph<int32_t>(GPU);
|
|
_TestUnitGraph<int64_t>(GPU);
|
|
#endif
|
|
}
|
|
|
|
TEST(UniGraphTest, TestUnitGraph_GetInCSR) {
|
|
_TestUnitGraph_GetInCSR<int32_t>(CPU);
|
|
_TestUnitGraph_GetInCSR<int64_t>(CPU);
|
|
#ifdef DGL_USE_CUDA
|
|
_TestUnitGraph_GetInCSR<int32_t>(GPU);
|
|
_TestUnitGraph_GetInCSR<int64_t>(GPU);
|
|
#endif
|
|
}
|
|
|
|
TEST(UniGraphTest, TestUnitGraph_GetOutCSR) {
|
|
_TestUnitGraph_GetOutCSR<int32_t>(CPU);
|
|
_TestUnitGraph_GetOutCSR<int64_t>(CPU);
|
|
#ifdef DGL_USE_CUDA
|
|
_TestUnitGraph_GetOutCSR<int32_t>(GPU);
|
|
_TestUnitGraph_GetOutCSR<int64_t>(GPU);
|
|
#endif
|
|
}
|
|
|
|
TEST(UniGraphTest, TestUnitGraph_GetCOO) {
|
|
_TestUnitGraph_GetCOO<int32_t>(CPU);
|
|
_TestUnitGraph_GetCOO<int64_t>(CPU);
|
|
#ifdef DGL_USE_CUDA
|
|
_TestUnitGraph_GetCOO<int32_t>(GPU);
|
|
_TestUnitGraph_GetCOO<int64_t>(GPU);
|
|
#endif
|
|
}
|
|
|
|
TEST(UniGraphTest, TestUnitGraph_Reserve) {
|
|
_TestUnitGraph_Reserve<int32_t>(CPU);
|
|
_TestUnitGraph_Reserve<int64_t>(CPU);
|
|
#ifdef DGL_USE_CUDA
|
|
_TestUnitGraph_Reserve<int32_t>(GPU);
|
|
_TestUnitGraph_Reserve<int64_t>(GPU);
|
|
#endif
|
|
}
|