Unverified Commit 33a2d9e1 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Misc] clang-format auto fix. (#4812)



* [Misc] clang-format auto fix.

* manual
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 360e6cb4
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
#include <dgl/array.h> #include <dgl/array.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <time.h> #include <time.h>
#include <random> #include <random>
#include "./common.h" #include "./common.h"
using namespace dgl; using namespace dgl;
......
...@@ -3,16 +3,18 @@ ...@@ -3,16 +3,18 @@
* \file test_unit_graph.cc * \file test_unit_graph.cc
* \brief Test UnitGraph * \brief Test UnitGraph
*/ */
#include "../../src/graph/unit_graph.h"
#include "./../src/graph/heterograph.h"
#include "./common.h"
#include <dgl/array.h> #include <dgl/array.h>
#include <dgl/immutable_graph.h> #include <dgl/immutable_graph.h>
#include <dgl/runtime/device_api.h> #include <dgl/runtime/device_api.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "../../src/graph/unit_graph.h"
#include "./../src/graph/heterograph.h"
#include "./common.h"
using namespace dgl; using namespace dgl;
using namespace dgl::runtime; using namespace dgl::runtime;
...@@ -24,18 +26,13 @@ aten::CSRMatrix CSR1(DGLContext ctx) { ...@@ -24,18 +26,13 @@ aten::CSRMatrix CSR1(DGLContext ctx) {
* [0, 1, 0], * [0, 1, 0],
* [1, 0, 1]] * [1, 0, 1]]
*/ */
IdArray g_indptr = IdArray g_indptr = aten::VecToIdArray(
aten::VecToIdArray(std::vector<IdType>({0, 1, 3, 4, 6}), sizeof(IdType)*8, CTX); std::vector<IdType>({0, 1, 3, 4, 6}), sizeof(IdType) * 8, CTX);
IdArray g_indices = IdArray g_indices = aten::VecToIdArray(
aten::VecToIdArray(std::vector<IdType>({2, 0, 2, 1, 0, 2}), sizeof(IdType)*8, CTX); std::vector<IdType>({2, 0, 2, 1, 0, 2}), sizeof(IdType) * 8, CTX);
const aten::CSRMatrix &csr_a = aten::CSRMatrix( const aten::CSRMatrix &csr_a =
4, aten::CSRMatrix(4, 3, g_indptr, g_indices, aten::NullArray(), false);
3,
g_indptr,
g_indices,
aten::NullArray(),
false);
return csr_a; return csr_a;
} }
...@@ -48,18 +45,12 @@ aten::COOMatrix COO1(DGLContext ctx) { ...@@ -48,18 +45,12 @@ aten::COOMatrix COO1(DGLContext ctx) {
* G = [[1, 1, 0], * G = [[1, 1, 0],
* [0, 1, 0]] * [0, 1, 0]]
*/ */
IdArray g_row = IdArray g_row = aten::VecToIdArray(
aten::VecToIdArray(std::vector<IdType>({0, 0, 1}), sizeof(IdType)*8, CTX); std::vector<IdType>({0, 0, 1}), sizeof(IdType) * 8, CTX);
IdArray g_col = IdArray g_col = aten::VecToIdArray(
aten::VecToIdArray(std::vector<IdType>({0, 1, 1}), sizeof(IdType)*8, CTX); std::vector<IdType>({0, 1, 1}), sizeof(IdType) * 8, CTX);
const aten::COOMatrix &coo = aten::COOMatrix( const aten::COOMatrix &coo =
2, aten::COOMatrix(2, 3, g_row, g_col, aten::NullArray(), true, true);
3,
g_row,
g_col,
aten::NullArray(),
true,
true);
return coo; return coo;
} }
...@@ -67,7 +58,8 @@ aten::COOMatrix COO1(DGLContext ctx) { ...@@ -67,7 +58,8 @@ aten::COOMatrix COO1(DGLContext ctx) {
template aten::COOMatrix COO1<int32_t>(DGLContext ctx); template aten::COOMatrix COO1<int32_t>(DGLContext ctx);
template aten::COOMatrix COO1<int64_t>(DGLContext ctx); template aten::COOMatrix COO1<int64_t>(DGLContext ctx);
template <typename IdType> void _TestUnitGraph_InOutDegrees(DGLContext ctx) { template <typename IdType>
void _TestUnitGraph_InOutDegrees(DGLContext ctx) {
/* /*
InDegree(s) is available only if COO or CSC formats permitted. InDegree(s) is available only if COO or CSC formats permitted.
OutDegree(s) is available only if COO or CSR formats permitted. OutDegree(s) is available only if COO or CSR formats permitted.
...@@ -346,8 +338,8 @@ void _TestUnitGraph_Reserve(DGLContext ctx) { ...@@ -346,8 +338,8 @@ void _TestUnitGraph_Reserve(DGLContext ctx) {
} }
template <typename IdType> template <typename IdType>
void _TestUnitGraph_CopyTo(const DGLContext &src_ctx, void _TestUnitGraph_CopyTo(
const DGLContext &dst_ctx) { const DGLContext &src_ctx, const DGLContext &dst_ctx) {
const aten::CSRMatrix &csr = CSR1<IdType>(src_ctx); const aten::CSRMatrix &csr = CSR1<IdType>(src_ctx);
const aten::COOMatrix &coo = COO1<IdType>(src_ctx); const aten::COOMatrix &coo = COO1<IdType>(src_ctx);
......
#include <chrono> #include <chrono>
#include <cstdlib>
#include <fstream> #include <fstream>
#include <stdexcept> #include <stdexcept>
#include <thread> #include <thread>
#include <vector> #include <vector>
#include <cstdlib>
#include "rpc_base.h" #include "rpc_base.h"
class RPCClient { class RPCClient {
public: public:
explicit RPCClient(const std::string &ip_config) : ip_config_(ip_config) { explicit RPCClient(const std::string &ip_config) : ip_config_(ip_config) {
ParseIPs(); ParseIPs();
} }
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
} }
} }
private: private:
void ParseIPs() { void ParseIPs() {
std::ifstream ifs(ip_config_); std::ifstream ifs(ip_config_);
if (!ifs) { if (!ifs) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "rpc_base.h" #include "rpc_base.h"
class RPCServer { class RPCServer {
public: public:
explicit RPCServer(const std::string &ip, int num_machines) explicit RPCServer(const std::string &ip, int num_machines)
: ip_(ip), num_machines_(num_machines) {} : ip_(ip), num_machines_(num_machines) {}
void run() { void run() {
...@@ -19,7 +19,7 @@ public: ...@@ -19,7 +19,7 @@ public:
} }
} }
private: private:
void StartServer(int id) { void StartServer(int id) {
dgl::rpc::TPReceiver receiver(InitTPContext()); dgl::rpc::TPReceiver receiver(InitTPContext());
std::string ip_addr = std::string ip_addr =
......
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