Commit 820c6b9e authored by Minjie Wang's avatar Minjie Wang
Browse files

Add lint script and fix cpplint errors

parent 3e76bcc0
......@@ -3,8 +3,8 @@
* \file file_util.h
* \brief Minimum file manipulation util for runtime.
*/
#ifndef TVM_RUNTIME_FILE_UTIL_H_
#define TVM_RUNTIME_FILE_UTIL_H_
#ifndef DGL_RUNTIME_FILE_UTIL_H_
#define DGL_RUNTIME_FILE_UTIL_H_
#include <string>
#include "meta_data.h"
......@@ -73,4 +73,4 @@ void LoadMetaDataFromFile(
std::unordered_map<std::string, FunctionInfo>* fmap);
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_FILE_UTIL_H_
#endif // DGL_RUNTIME_FILE_UTIL_H_
......@@ -3,8 +3,8 @@
* \file meta_data.h
* \brief Meta data related utilities
*/
#ifndef TVM_RUNTIME_META_DATA_H_
#define TVM_RUNTIME_META_DATA_H_
#ifndef DGL_RUNTIME_META_DATA_H_
#define DGL_RUNTIME_META_DATA_H_
#include <dmlc/json.h>
#include <dmlc/io.h>
......@@ -33,4 +33,4 @@ struct FunctionInfo {
namespace dmlc {
DMLC_DECLARE_TRAITS(has_saveload, ::tvm::runtime::FunctionInfo, true);
} // namespace dmlc
#endif // TVM_RUNTIME_META_DATA_H_
#endif // DGL_RUNTIME_META_DATA_H_
......@@ -3,8 +3,8 @@
* \file module_util.h
* \brief Helper utilities for module building
*/
#ifndef TVM_RUNTIME_MODULE_UTIL_H_
#define TVM_RUNTIME_MODULE_UTIL_H_
#ifndef DGL_RUNTIME_MODULE_UTIL_H_
#define DGL_RUNTIME_MODULE_UTIL_H_
#include <dgl/runtime/module.h>
#include <dgl/runtime/c_runtime_api.h>
......@@ -58,4 +58,4 @@ void InitContextFunctions(FLookup flookup) {
}
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_MODULE_UTIL_H_
#endif // DGL_RUNTIME_MODULE_UTIL_H_
......@@ -10,8 +10,8 @@
* union_32bit args[N], int num_args);
* - Pack buffer by address, pack rest parameter into 32bit union buffer.
*/
#ifndef TVM_RUNTIME_PACK_ARGS_H_
#define TVM_RUNTIME_PACK_ARGS_H_
#ifndef DGL_RUNTIME_PACK_ARGS_H_
#define DGL_RUNTIME_PACK_ARGS_H_
#include <dgl/runtime/c_runtime_api.h>
#include <vector>
......@@ -307,4 +307,4 @@ inline PackedFunc PackFuncPackedArg(F f, const std::vector<TVMType>& arg_types)
}
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_PACK_ARGS_H_
#endif // DGL_RUNTIME_PACK_ARGS_H_
......@@ -3,8 +3,8 @@
* \file runtime_base.h
* \brief Base of all C APIs
*/
#ifndef TVM_RUNTIME_RUNTIME_BASE_H_
#define TVM_RUNTIME_RUNTIME_BASE_H_
#ifndef DGL_RUNTIME_RUNTIME_BASE_H_
#define DGL_RUNTIME_RUNTIME_BASE_H_
#include <dgl/runtime/c_runtime_api.h>
#include <stdexcept>
......@@ -31,4 +31,4 @@ inline int TVMAPIHandleException(const std::runtime_error &e) {
return -1;
}
#endif // TVM_RUNTIME_RUNTIME_BASE_H_
#endif // DGL_RUNTIME_RUNTIME_BASE_H_
......@@ -3,8 +3,8 @@
* \file thread_storage_scope.h
* \brief Extract thread axis configuration from TVMArgs.
*/
#ifndef TVM_RUNTIME_THREAD_STORAGE_SCOPE_H_
#define TVM_RUNTIME_THREAD_STORAGE_SCOPE_H_
#ifndef DGL_RUNTIME_THREAD_STORAGE_SCOPE_H_
#define DGL_RUNTIME_THREAD_STORAGE_SCOPE_H_
#include <dgl/runtime/packed_func.h>
#include <string>
......@@ -204,4 +204,4 @@ struct hash<::tvm::runtime::StorageScope> {
}
};
} // namespace std
#endif // TVM_RUNTIME_THREAD_STORAGE_SCOPE_H_
#endif // DGL_RUNTIME_THREAD_STORAGE_SCOPE_H_
......@@ -3,8 +3,8 @@
* \file workspace_pool.h
* \brief Workspace pool utility.
*/
#ifndef TVM_RUNTIME_WORKSPACE_POOL_H_
#define TVM_RUNTIME_WORKSPACE_POOL_H_
#ifndef DGL_RUNTIME_WORKSPACE_POOL_H_
#define DGL_RUNTIME_WORKSPACE_POOL_H_
#include <dgl/runtime/device_api.h>
#include <vector>
......@@ -58,4 +58,4 @@ class WorkspacePool {
} // namespace runtime
} // namespace tvm
#endif // TVM_RUNTIME_WORKSPACE_POOL_H_
#endif // DGL_RUNTIME_WORKSPACE_POOL_H_
// DGL Scheduler implementation
/*!
* Copyright (c) 2018 by Contributors
* \file scheduler/scheduler.cc
* \brief DGL Scheduler implementation
*/
#include <dgl/scheduler.h>
#include <unordered_map>
#include <vector>
#include <dgl/scheduler.h>
namespace dgl {
namespace sched {
......@@ -19,7 +22,7 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
// bkt: deg->dsts
std::unordered_map<int64_t, std::vector<int64_t>> bkt;
for (auto& it: in_edges) {
for (const auto& it : in_edges) {
bkt[it.second.size()].push_back(it.first);
}
......@@ -38,15 +41,15 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
int64_t* msec_ptr = static_cast<int64_t*>(mid_section->data);
// fill in bucketing ordering
for (auto& it: bkt) { // for each bucket
int64_t deg = it.first;
int64_t n_dst = it.second.size();
for (const auto& it : bkt) { // for each bucket
const int64_t deg = it.first;
const int64_t n_dst = it.second.size();
*deg_ptr++ = deg;
*nsec_ptr++ = n_dst;
*msec_ptr++ = deg * n_dst;
for (auto dst: it.second) { // for each dst in this bucket
for (const auto dst : it.second) { // for each dst in this bucket
*nid_ptr++ = dst;
for (auto mid: in_edges[dst]) { // for each in edge of dst
for (const auto mid : in_edges[dst]) { // for each in edge of dst
*mid_ptr++ = mid;
}
}
......@@ -62,6 +65,6 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
return std::move(ret);
}
} // namespace sched
} // namespace sched
} // namespace dgl
} // namespace dgl
#include "../c_api_common.h"
/*!
* Copyright (c) 2018 by Contributors
* \file scheduler/scheduler_apis.cc
* \brief DGL scheduler APIs
*/
#include <dgl/graph.h>
#include <dgl/scheduler.h>
#include "../c_api_common.h"
using tvm::runtime::TVMArgs;
using tvm::runtime::TVMRetValue;
......@@ -18,8 +23,8 @@ TVM_REGISTER_GLOBAL("scheduler._CAPI_DGLDegreeBucketingFromGraph")
.set_body([] (TVMArgs args, TVMRetValue* rv) {
GraphHandle ghandle = args[0];
const Graph* gptr = static_cast<Graph*>(ghandle);
auto edges = gptr->Edges(false);
const auto& edges = gptr->Edges(false);
*rv = ConvertNDArrayVectorToPackedFunc(sched::DegreeBucketing(edges.dst));
});
} // namespace dgl
} // namespace dgl
#!/bin/sh
# cpplint
echo 'Checking code style of C++ codes...'
python3 third_party/dmlc-core/scripts/lint.py dgl cpp include src
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