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
820c6b9e
Commit
820c6b9e
authored
Oct 18, 2018
by
Minjie Wang
Browse files
Add lint script and fix cpplint errors
parent
3e76bcc0
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
35 deletions
+48
-35
src/runtime/file_util.h
src/runtime/file_util.h
+3
-3
src/runtime/meta_data.h
src/runtime/meta_data.h
+3
-3
src/runtime/module_util.h
src/runtime/module_util.h
+3
-3
src/runtime/pack_args.h
src/runtime/pack_args.h
+3
-3
src/runtime/runtime_base.h
src/runtime/runtime_base.h
+3
-3
src/runtime/thread_storage_scope.h
src/runtime/thread_storage_scope.h
+3
-3
src/runtime/workspace_pool.h
src/runtime/workspace_pool.h
+3
-3
src/scheduler/scheduler.cc
src/scheduler/scheduler.cc
+14
-11
src/scheduler/scheduler_apis.cc
src/scheduler/scheduler_apis.cc
+8
-3
tests/scripts/task_lint.sh
tests/scripts/task_lint.sh
+5
-0
No files found.
src/runtime/file_util.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file file_util.h
* \file file_util.h
* \brief Minimum file manipulation util for runtime.
* \brief Minimum file manipulation util for runtime.
*/
*/
#ifndef
TVM
_RUNTIME_FILE_UTIL_H_
#ifndef
DGL
_RUNTIME_FILE_UTIL_H_
#define
TVM
_RUNTIME_FILE_UTIL_H_
#define
DGL
_RUNTIME_FILE_UTIL_H_
#include <string>
#include <string>
#include "meta_data.h"
#include "meta_data.h"
...
@@ -73,4 +73,4 @@ void LoadMetaDataFromFile(
...
@@ -73,4 +73,4 @@ void LoadMetaDataFromFile(
std
::
unordered_map
<
std
::
string
,
FunctionInfo
>*
fmap
);
std
::
unordered_map
<
std
::
string
,
FunctionInfo
>*
fmap
);
}
// namespace runtime
}
// namespace runtime
}
// namespace tvm
}
// namespace tvm
#endif //
TVM
_RUNTIME_FILE_UTIL_H_
#endif //
DGL
_RUNTIME_FILE_UTIL_H_
src/runtime/meta_data.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file meta_data.h
* \file meta_data.h
* \brief Meta data related utilities
* \brief Meta data related utilities
*/
*/
#ifndef
TVM
_RUNTIME_META_DATA_H_
#ifndef
DGL
_RUNTIME_META_DATA_H_
#define
TVM
_RUNTIME_META_DATA_H_
#define
DGL
_RUNTIME_META_DATA_H_
#include <dmlc/json.h>
#include <dmlc/json.h>
#include <dmlc/io.h>
#include <dmlc/io.h>
...
@@ -33,4 +33,4 @@ struct FunctionInfo {
...
@@ -33,4 +33,4 @@ struct FunctionInfo {
namespace
dmlc
{
namespace
dmlc
{
DMLC_DECLARE_TRAITS
(
has_saveload
,
::
tvm
::
runtime
::
FunctionInfo
,
true
);
DMLC_DECLARE_TRAITS
(
has_saveload
,
::
tvm
::
runtime
::
FunctionInfo
,
true
);
}
// namespace dmlc
}
// namespace dmlc
#endif //
TVM
_RUNTIME_META_DATA_H_
#endif //
DGL
_RUNTIME_META_DATA_H_
src/runtime/module_util.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file module_util.h
* \file module_util.h
* \brief Helper utilities for module building
* \brief Helper utilities for module building
*/
*/
#ifndef
TVM
_RUNTIME_MODULE_UTIL_H_
#ifndef
DGL
_RUNTIME_MODULE_UTIL_H_
#define
TVM
_RUNTIME_MODULE_UTIL_H_
#define
DGL
_RUNTIME_MODULE_UTIL_H_
#include <dgl/runtime/module.h>
#include <dgl/runtime/module.h>
#include <dgl/runtime/c_runtime_api.h>
#include <dgl/runtime/c_runtime_api.h>
...
@@ -58,4 +58,4 @@ void InitContextFunctions(FLookup flookup) {
...
@@ -58,4 +58,4 @@ void InitContextFunctions(FLookup flookup) {
}
}
}
// namespace runtime
}
// namespace runtime
}
// namespace tvm
}
// namespace tvm
#endif //
TVM
_RUNTIME_MODULE_UTIL_H_
#endif //
DGL
_RUNTIME_MODULE_UTIL_H_
src/runtime/pack_args.h
View file @
820c6b9e
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
* union_32bit args[N], int num_args);
* union_32bit args[N], int num_args);
* - Pack buffer by address, pack rest parameter into 32bit union buffer.
* - Pack buffer by address, pack rest parameter into 32bit union buffer.
*/
*/
#ifndef
TVM
_RUNTIME_PACK_ARGS_H_
#ifndef
DGL
_RUNTIME_PACK_ARGS_H_
#define
TVM
_RUNTIME_PACK_ARGS_H_
#define
DGL
_RUNTIME_PACK_ARGS_H_
#include <dgl/runtime/c_runtime_api.h>
#include <dgl/runtime/c_runtime_api.h>
#include <vector>
#include <vector>
...
@@ -307,4 +307,4 @@ inline PackedFunc PackFuncPackedArg(F f, const std::vector<TVMType>& arg_types)
...
@@ -307,4 +307,4 @@ inline PackedFunc PackFuncPackedArg(F f, const std::vector<TVMType>& arg_types)
}
}
}
// namespace runtime
}
// namespace runtime
}
// namespace tvm
}
// namespace tvm
#endif //
TVM
_RUNTIME_PACK_ARGS_H_
#endif //
DGL
_RUNTIME_PACK_ARGS_H_
src/runtime/runtime_base.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file runtime_base.h
* \file runtime_base.h
* \brief Base of all C APIs
* \brief Base of all C APIs
*/
*/
#ifndef
TVM
_RUNTIME_RUNTIME_BASE_H_
#ifndef
DGL
_RUNTIME_RUNTIME_BASE_H_
#define
TVM
_RUNTIME_RUNTIME_BASE_H_
#define
DGL
_RUNTIME_RUNTIME_BASE_H_
#include <dgl/runtime/c_runtime_api.h>
#include <dgl/runtime/c_runtime_api.h>
#include <stdexcept>
#include <stdexcept>
...
@@ -31,4 +31,4 @@ inline int TVMAPIHandleException(const std::runtime_error &e) {
...
@@ -31,4 +31,4 @@ inline int TVMAPIHandleException(const std::runtime_error &e) {
return
-
1
;
return
-
1
;
}
}
#endif //
TVM
_RUNTIME_RUNTIME_BASE_H_
#endif //
DGL
_RUNTIME_RUNTIME_BASE_H_
src/runtime/thread_storage_scope.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file thread_storage_scope.h
* \file thread_storage_scope.h
* \brief Extract thread axis configuration from TVMArgs.
* \brief Extract thread axis configuration from TVMArgs.
*/
*/
#ifndef
TVM
_RUNTIME_THREAD_STORAGE_SCOPE_H_
#ifndef
DGL
_RUNTIME_THREAD_STORAGE_SCOPE_H_
#define
TVM
_RUNTIME_THREAD_STORAGE_SCOPE_H_
#define
DGL
_RUNTIME_THREAD_STORAGE_SCOPE_H_
#include <dgl/runtime/packed_func.h>
#include <dgl/runtime/packed_func.h>
#include <string>
#include <string>
...
@@ -204,4 +204,4 @@ struct hash<::tvm::runtime::StorageScope> {
...
@@ -204,4 +204,4 @@ struct hash<::tvm::runtime::StorageScope> {
}
}
};
};
}
// namespace std
}
// namespace std
#endif //
TVM
_RUNTIME_THREAD_STORAGE_SCOPE_H_
#endif //
DGL
_RUNTIME_THREAD_STORAGE_SCOPE_H_
src/runtime/workspace_pool.h
View file @
820c6b9e
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* \file workspace_pool.h
* \file workspace_pool.h
* \brief Workspace pool utility.
* \brief Workspace pool utility.
*/
*/
#ifndef
TVM
_RUNTIME_WORKSPACE_POOL_H_
#ifndef
DGL
_RUNTIME_WORKSPACE_POOL_H_
#define
TVM
_RUNTIME_WORKSPACE_POOL_H_
#define
DGL
_RUNTIME_WORKSPACE_POOL_H_
#include <dgl/runtime/device_api.h>
#include <dgl/runtime/device_api.h>
#include <vector>
#include <vector>
...
@@ -58,4 +58,4 @@ class WorkspacePool {
...
@@ -58,4 +58,4 @@ class WorkspacePool {
}
// namespace runtime
}
// namespace runtime
}
// namespace tvm
}
// namespace tvm
#endif //
TVM
_RUNTIME_WORKSPACE_POOL_H_
#endif //
DGL
_RUNTIME_WORKSPACE_POOL_H_
src/scheduler/scheduler.cc
View file @
820c6b9e
// DGL Scheduler implementation
/*!
* Copyright (c) 2018 by Contributors
* \file scheduler/scheduler.cc
* \brief DGL Scheduler implementation
*/
#include <dgl/scheduler.h>
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include <dgl/scheduler.h>
namespace
dgl
{
namespace
dgl
{
namespace
sched
{
namespace
sched
{
...
@@ -19,7 +22,7 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
...
@@ -19,7 +22,7 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
// bkt: deg->dsts
// bkt: deg->dsts
std
::
unordered_map
<
int64_t
,
std
::
vector
<
int64_t
>>
bkt
;
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
);
bkt
[
it
.
second
.
size
()].
push_back
(
it
.
first
);
}
}
...
@@ -38,15 +41,15 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
...
@@ -38,15 +41,15 @@ std::vector<IdArray> DegreeBucketing(const IdArray& vids) {
int64_t
*
msec_ptr
=
static_cast
<
int64_t
*>
(
mid_section
->
data
);
int64_t
*
msec_ptr
=
static_cast
<
int64_t
*>
(
mid_section
->
data
);
// fill in bucketing ordering
// fill in bucketing ordering
for
(
auto
&
it
:
bkt
)
{
// for each bucket
for
(
const
auto
&
it
:
bkt
)
{
// for each bucket
int64_t
deg
=
it
.
first
;
const
int64_t
deg
=
it
.
first
;
int64_t
n_dst
=
it
.
second
.
size
();
const
int64_t
n_dst
=
it
.
second
.
size
();
*
deg_ptr
++
=
deg
;
*
deg_ptr
++
=
deg
;
*
nsec_ptr
++
=
n_dst
;
*
nsec_ptr
++
=
n_dst
;
*
msec_ptr
++
=
deg
*
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
;
*
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
;
*
mid_ptr
++
=
mid
;
}
}
}
}
...
...
src/scheduler/scheduler_apis.cc
View file @
820c6b9e
#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/graph.h>
#include <dgl/scheduler.h>
#include <dgl/scheduler.h>
#include "../c_api_common.h"
using
tvm
::
runtime
::
TVMArgs
;
using
tvm
::
runtime
::
TVMArgs
;
using
tvm
::
runtime
::
TVMRetValue
;
using
tvm
::
runtime
::
TVMRetValue
;
...
@@ -18,7 +23,7 @@ TVM_REGISTER_GLOBAL("scheduler._CAPI_DGLDegreeBucketingFromGraph")
...
@@ -18,7 +23,7 @@ TVM_REGISTER_GLOBAL("scheduler._CAPI_DGLDegreeBucketingFromGraph")
.
set_body
([]
(
TVMArgs
args
,
TVMRetValue
*
rv
)
{
.
set_body
([]
(
TVMArgs
args
,
TVMRetValue
*
rv
)
{
GraphHandle
ghandle
=
args
[
0
];
GraphHandle
ghandle
=
args
[
0
];
const
Graph
*
gptr
=
static_cast
<
Graph
*>
(
ghandle
);
const
Graph
*
gptr
=
static_cast
<
Graph
*>
(
ghandle
);
auto
edges
=
gptr
->
Edges
(
false
);
const
auto
&
edges
=
gptr
->
Edges
(
false
);
*
rv
=
ConvertNDArrayVectorToPackedFunc
(
sched
::
DegreeBucketing
(
edges
.
dst
));
*
rv
=
ConvertNDArrayVectorToPackedFunc
(
sched
::
DegreeBucketing
(
edges
.
dst
));
});
});
...
...
tests/scripts/task_lint.sh
0 → 100755
View file @
820c6b9e
#!/bin/sh
# cpplint
echo
'Checking code style of C++ codes...'
python3 third_party/dmlc-core/scripts/lint.py dgl cpp include src
Prev
1
2
Next
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