Skip to content

Commit 10d2b84

Browse files
committed
Merge branch 'master' into 0.4.x
2 parents 263656f + f1a8f92 commit 10d2b84

File tree

285 files changed

+17368
-3085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+17368
-3085
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ endif()
2525
dgl_option(USE_CUDA "Build with CUDA" OFF)
2626
dgl_option(USE_OPENMP "Build with OpenMP" ON)
2727
dgl_option(BUILD_CPP_TEST "Build cpp unittest executables" OFF)
28+
# Set debug compile option for gdb, only happens when -DCMAKE_BUILD_TYPE=DEBUG
29+
if (NOT MSVC)
30+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3 -ggdb")
31+
endif(NOT MSVC)
2832

2933
if(USE_CUDA)
3034
message(STATUS "Build with CUDA support")
@@ -83,7 +87,6 @@ endif(USE_OPENMP)
8387

8488
# configure minigun
8589
add_definitions(-DENABLE_PARTIAL_FRONTIER=0) # disable minigun partial frontier compile
86-
8790
# Source file lists
8891
file(GLOB DGL_SRC
8992
src/*.cc

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Contributors
1919
* [Aymen Waheb](https://github.com/aymenwah): APPNP in Pytorch
2020
* [Chengqiang Lu](https://github.com/geekinglcq): MGCN, SchNet and MPNN in PyTorch
2121
* [Gongze Cao](https://github.com/Zardinality): Cluster GCN
22+
* [Yicheng Wu](https://github.com/MilkshakeForReal): RotatE in Pytorch
2223

2324
Other improvement
2425
* [Brett Koonce](https://github.com/brettkoonce)

Jenkinsfile

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env groovy
22

3-
dgl_linux_libs = "build/libdgl.so, build/runUnitTests, python/dgl/_ffi/_cy3/core.cpython-35m-x86_64-linux-gnu.so"
3+
dgl_linux_libs = "build/libdgl.so, build/runUnitTests, python/dgl/_ffi/_cy3/core.cpython-36m-x86_64-linux-gnu.so"
44
// Currently DGL on Windows is not working with Cython yet
55
dgl_win64_libs = "build\\dgl.dll, build\\runUnitTests.exe"
66

@@ -56,7 +56,7 @@ def cpp_unit_test_win64() {
5656
def unit_test_linux(backend, dev) {
5757
init_git()
5858
unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
59-
timeout(time: 5, unit: 'MINUTES') {
59+
timeout(time: 10, unit: 'MINUTES') {
6060
sh "bash tests/scripts/task_unit_test.sh ${backend} ${dev}"
6161
}
6262
}
@@ -101,11 +101,17 @@ def tutorial_test_linux(backend) {
101101
}
102102
}
103103

104+
104105
pipeline {
105106
agent any
106107
stages {
107108
stage("Lint Check") {
108-
agent { docker { image "dgllib/dgl-ci-lint" } }
109+
agent {
110+
docker {
111+
label "linux-cpu-node"
112+
image "dgllib/dgl-ci-lint"
113+
}
114+
}
109115
steps {
110116
init_git()
111117
sh "bash tests/scripts/task_lint.sh"
@@ -119,7 +125,12 @@ pipeline {
119125
stage("Build") {
120126
parallel {
121127
stage("CPU Build") {
122-
agent { docker { image "dgllib/dgl-ci-cpu" } }
128+
agent {
129+
docker {
130+
label "linux-cpu-node"
131+
image "dgllib/dgl-ci-cpu:conda"
132+
}
133+
}
123134
steps {
124135
build_dgl_linux("cpu")
125136
}
@@ -132,8 +143,9 @@ pipeline {
132143
stage("GPU Build") {
133144
agent {
134145
docker {
135-
image "dgllib/dgl-ci-gpu"
136-
args "--runtime nvidia"
146+
label "linux-cpu-node"
147+
image "dgllib/dgl-ci-gpu:conda"
148+
args "-u root"
137149
}
138150
}
139151
steps {
@@ -165,7 +177,12 @@ pipeline {
165177
stage("Test") {
166178
parallel {
167179
stage("C++ CPU") {
168-
agent { docker { image "dgllib/dgl-ci-cpu" } }
180+
agent {
181+
docker {
182+
label "linux-cpu-node"
183+
image "dgllib/dgl-ci-cpu:conda"
184+
}
185+
}
169186
steps {
170187
cpp_unit_test_linux()
171188
}
@@ -186,8 +203,54 @@ pipeline {
186203
}
187204
}
188205
}
206+
stage("Tensorflow CPU") {
207+
agent {
208+
docker {
209+
label "linux-cpu-node"
210+
image "dgllib/dgl-ci-cpu:conda"
211+
}
212+
}
213+
stages {
214+
stage("Unit test") {
215+
steps {
216+
unit_test_linux("tensorflow", "cpu")
217+
}
218+
}
219+
}
220+
post {
221+
always {
222+
cleanWs disableDeferredWipeout: true, deleteDirs: true
223+
}
224+
}
225+
}
226+
stage("Tensorflow GPU") {
227+
agent {
228+
docker {
229+
label "linux-gpu-node"
230+
image "dgllib/dgl-ci-gpu:conda"
231+
args "--runtime nvidia"
232+
}
233+
}
234+
stages {
235+
stage("Unit test") {
236+
steps {
237+
unit_test_linux("tensorflow", "gpu")
238+
}
239+
}
240+
}
241+
post {
242+
always {
243+
cleanWs disableDeferredWipeout: true, deleteDirs: true
244+
}
245+
}
246+
}
189247
stage("Torch CPU") {
190-
agent { docker { image "dgllib/dgl-ci-cpu" } }
248+
agent {
249+
docker {
250+
label "linux-cpu-node"
251+
image "dgllib/dgl-ci-cpu:conda"
252+
}
253+
}
191254
stages {
192255
stage("Unit test") {
193256
steps {
@@ -234,7 +297,8 @@ pipeline {
234297
stage("Torch GPU") {
235298
agent {
236299
docker {
237-
image "dgllib/dgl-ci-gpu"
300+
label "linux-gpu-node"
301+
image "dgllib/dgl-ci-gpu:conda"
238302
args "--runtime nvidia"
239303
}
240304
}
@@ -258,7 +322,12 @@ pipeline {
258322
}
259323
}
260324
stage("MXNet CPU") {
261-
agent { docker { image "dgllib/dgl-ci-cpu" } }
325+
agent {
326+
docker {
327+
label "linux-cpu-node"
328+
image "dgllib/dgl-ci-cpu:conda"
329+
}
330+
}
262331
stages {
263332
stage("Unit test") {
264333
steps {
@@ -280,7 +349,8 @@ pipeline {
280349
stage("MXNet GPU") {
281350
agent {
282351
docker {
283-
image "dgllib/dgl-ci-gpu"
352+
label "linux-gpu-node"
353+
image "dgllib/dgl-ci-gpu:conda"
284354
args "--runtime nvidia"
285355
}
286356
}
@@ -303,7 +373,12 @@ pipeline {
303373
stage("App") {
304374
parallel {
305375
stage("Knowledge Graph CPU") {
306-
agent { docker { image "dgllib/dgl-ci-cpu:torch-1.2.0" } }
376+
agent {
377+
docker {
378+
label "linux-cpu-node"
379+
image "dgllib/dgl-ci-cpu:conda"
380+
}
381+
}
307382
stages {
308383
stage("Torch test") {
309384
steps {
@@ -325,7 +400,8 @@ pipeline {
325400
stage("Knowledge Graph GPU") {
326401
agent {
327402
docker {
328-
image "dgllib/dgl-ci-gpu:torch-1.2.0"
403+
label "linux-gpu-node"
404+
image "dgllib/dgl-ci-gpu:conda"
329405
args "--runtime nvidia"
330406
}
331407
}

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ All model examples can be found [here](https://github.com/dmlc/dgl/tree/master/e
1818
A summary of part of the model accuracy and training speed with the Pytorch backend (on Amazon EC2 p3.2x instance (w/ V100 GPU)), as compared with the best open-source implementations:
1919

2020
| Model | Reported <br> Accuracy | DGL <br> Accuracy | Author's training speed (epoch time) | DGL speed (epoch time) | Improvement |
21-
| ----- | ----------------- | ------------ | ------------------------------------ | ---------------------- | ----------- |
21+
| ---------------------------------------------------------------- | ---------------------- | ----------------- | ----------------------------------------------------------------------------- | ---------------------- | ----------- |
2222
| [GCN](https://arxiv.org/abs/1609.02907) | 81.5% | 81.0% | [0.0051s (TF)](https://github.com/tkipf/gcn) | 0.0031s | 1.64x |
2323
| [GAT](https://arxiv.org/abs/1710.10903) | 83.0% | 83.9% | [0.0982s (TF)](https://github.com/PetarV-/GAT) | 0.0113s | 8.69x |
2424
| [SGC](https://arxiv.org/abs/1902.07153) | 81.0% | 81.9% | n/a | 0.0008s | n/a |
@@ -28,6 +28,7 @@ A summary of part of the model accuracy and training speed with the Pytorch back
2828
| [JTNN](https://arxiv.org/abs/1802.04364) | 96.44% | 96.44% | [1826s (Pytorch)](https://github.com/wengong-jin/icml18-jtnn) | 743s | 2.5x |
2929
| [LGNN](https://arxiv.org/abs/1705.08415) | 94% | 94% | n/a | 1.45s | n/a |
3030
| [DGMG](https://arxiv.org/pdf/1803.03324.pdf) | 84% | 90% | n/a | 238s | n/a |
31+
| [GraphWriter](https://www.aclweb.org/anthology/N19-1238.pdf) | 14.3(BLEU) | 14.31(BLEU) | [1970s (PyTorch)](https://github.com/rikdz/GraphWriter) | 1192s | 1.65x |
3132

3233
With the MXNet/Gluon backend , we scaled a graph of 50M nodes and 150M edges on a P3.8xlarge instance,
3334
with 160s per epoch, on SSE ([Stochastic Steady-state Embedding](https://www.cc.gatech.edu/~hdai8/pdf/equilibrium_embedding.pdf)),
@@ -69,16 +70,19 @@ conda install -c dglteam dgl # cpu version
6970
conda install -c dglteam dgl-cuda9.0 # CUDA 9.0
7071
conda install -c dglteam dgl-cuda9.2 # CUDA 9.2
7172
conda install -c dglteam dgl-cuda10.0 # CUDA 10.0
73+
conda install -c dglteam dgl-cuda10.1 # CUDA 10.1
7274
```
7375

7476
### Using pip
7577

76-
```
77-
pip install dgl # cpu version
78-
pip install dgl-cu90 # CUDA 9.0
79-
pip install dgl-cu92 # CUDA 9.2
80-
pip install dgl-cu100 # CUDA 10.0
81-
```
78+
79+
| | Latest Nightly Build Version | Stable Version |
80+
|-----------|-------------------------------|-------------------------|
81+
| CPU | `pip install --pre dgl` | `pip install dgl` |
82+
| CUDA 9.0 | `pip install --pre dgl-cu90` | `pip install dgl-cu90` |
83+
| CUDA 9.2 | `pip install --pre dgl-cu92` | `pip install dgl-cu92` |
84+
| CUDA 10.0 | `pip install --pre dgl-cu100` | `pip install dgl-cu100` |
85+
| CUDA 10.1 | `pip install --pre dgl-cu101` | `pip install dgl-cu101` |
8286

8387
### From source
8488

@@ -188,7 +192,7 @@ If you use DGL in a scientific publication, we would appreciate citations to the
188192
@article{wang2019dgl,
189193
title={Deep Graph Library: Towards Efficient and Scalable Deep Learning on Graphs},
190194
url={https://arxiv.org/abs/1909.01315},
191-
author={{Wang, Minjie and Yu, Lingfan and Zheng, Da and Gan, Quan and Gai, Yu and Ye, Zihao and Li, Mufei and Zhou, Jinjing and Huang, Qi and Ma, Chao and Huang, Ziyue and Guo, Qipeng and Zhang, Hao and Lin, Haibin and Zhao, Junbo and Li, Jinyang and Smola, Alexander J and Zhang, Zheng},
195+
author={Wang, Minjie and Yu, Lingfan and Zheng, Da and Gan, Quan and Gai, Yu and Ye, Zihao and Li, Mufei and Zhou, Jinjing and Huang, Qi and Ma, Chao and Huang, Ziyue and Guo, Qipeng and Zhang, Hao and Lin, Haibin and Zhao, Junbo and Li, Jinyang and Smola, Alexander J and Zhang, Zheng},
192196
journal={ICLR Workshop on Representation Learning on Graphs and Manifolds},
193197
year={2019}
194198
}

apps/kg/README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ takes a couple of hours on Freebase, which has hundreds of millions of edges.
1515

1616
DGL-KE includes the following knowledge graph embedding models:
1717

18-
- TransE
18+
- TransE (TransE_l1 with L1 distance and TransE_l2 with L2 distance)
1919
- DistMult
2020
- ComplEx
2121
- RESCAL
2222
- TransR
23+
- RotatE
2324

2425
It will add other popular models in the future.
2526

@@ -61,39 +62,43 @@ The speed is measured with 16 CPU cores and one Nvidia V100 GPU.
6162

6263
The speed on FB15k
6364

64-
| Models | TransE | DistMult | ComplEx | RESCAL | TransR |
65-
|---------|--------|----------|---------|--------|--------|
66-
|MAX_STEPS| 20000 | 100000 | 100000 | 30000 | 100000 |
67-
|TIME | 411s | 690s | 806s | 1800s | 7627s |
65+
| Models | TransE_l1 | TransE_l2 | DistMult | ComplEx | RESCAL | TransR | RotatE |
66+
|---------|-----------|-----------|----------|---------|--------|--------|--------|
67+
|MAX_STEPS| 20000 | 30000 |100000 | 100000 | 30000 | 100000 | 100000 |
68+
|TIME | 411s | 329s |690s | 806s | 1800s | 7627s | 4327s |
6869

6970
The accuracy on FB15k
7071

71-
| Models | MR | MRR | HITS@1 | HITS@3 | HITS@10 |
72-
|----------|-------|-------|--------|--------|---------|
73-
| TransE | 69.12 | 0.656 | 0.567 | 0.718 | 0.802 |
74-
| DistMult | 43.35 | 0.783 | 0.713 | 0.837 | 0.897 |
75-
| ComplEx | 51.99 | 0.785 | 0.720 | 0.832 | 0.889 |
76-
| RESCAL | 130.89| 0.668 | 0.597 | 0.720 | 0.800 |
77-
| TransR | 138.7 | 0.501 | 0.274 | 0.704 | 0.801 |
72+
| Models | MR | MRR | HITS@1 | HITS@3 | HITS@10 |
73+
|-----------|-------|-------|--------|--------|---------|
74+
| TransE_l1 | 69.12 | 0.656 | 0.567 | 0.718 | 0.802 |
75+
| TransE_l2 | 35.86 | 0.570 | 0.400 | 0.708 | 0.834 |
76+
| DistMult | 43.35 | 0.783 | 0.713 | 0.837 | 0.897 |
77+
| ComplEx | 51.99 | 0.785 | 0.720 | 0.832 | 0.889 |
78+
| RESCAL | 130.89| 0.668 | 0.597 | 0.720 | 0.800 |
79+
| TransR | 138.7 | 0.501 | 0.274 | 0.704 | 0.801 |
80+
| RotatE | 39.6 | 0.725 | 0.628 | 0.802 | 0.875 |
7881

7982
In comparison, GraphVite uses 4 GPUs and takes 14 minutes. Thus, DGL-KE trains TransE on FB15k twice as fast as GraphVite while using much few resources. More performance information on GraphVite can be found [here](https://github.com/DeepGraphLearning/graphvite).
8083

8184
The speed on wn18
8285

83-
| Models | TransE | DistMult | ComplEx | RESCAL | TransR |
84-
|---------|--------|----------|---------|--------|--------|
85-
|MAX_STEPS| 40000 | 10000 | 20000 | 20000 | 20000 |
86-
|TIME | 719s | 126s | 266s | 333s | 1547s |
86+
| Models | TransE_l1 | TransE_l2 | DistMult | ComplEx | RESCAL | TransR | RotatE |
87+
|---------|-----------|-----------|----------|---------|--------|--------|--------|
88+
|MAX_STEPS| 40000 | 20000 | 10000 | 20000 | 20000 | 20000 | 20000 |
89+
|TIME | 719s | 254s | 126s | 266s | 333s | 1547s | 786s |
8790

8891
The accuracy on wn18
8992

90-
| Models | MR | MRR | HITS@1 | HITS@3 | HITS@10 |
91-
|----------|--------|-------|--------|--------|---------|
92-
| TransE | 321.35 | 0.760 | 0.652 | 0.850 | 0.940 |
93-
| DistMult | 271.09 | 0.769 | 0.639 | 0.892 | 0.949 |
94-
| ComplEx | 276.37 | 0.935 | 0.916 | 0.950 | 0.960 |
95-
| RESCAL | 579.54 | 0.846 | 0.791 | 0.898 | 0.931 |
96-
| TransR | 615.56 | 0.606 | 0.378 | 0.826 | 0.890 |
93+
| Models | MR | MRR | HITS@1 | HITS@3 | HITS@10 |
94+
|-----------|--------|-------|--------|--------|---------|
95+
| TransE_l1 | 321.35 | 0.760 | 0.652 | 0.850 | 0.940 |
96+
| TransE_l2 | 181.57 | 0.570 | 0.322 | 0.802 | 0.944 |
97+
| DistMult | 271.09 | 0.769 | 0.639 | 0.892 | 0.949 |
98+
| ComplEx | 276.37 | 0.935 | 0.916 | 0.950 | 0.960 |
99+
| RESCAL | 579.54 | 0.846 | 0.791 | 0.898 | 0.931 |
100+
| TransR | 615.56 | 0.606 | 0.378 | 0.826 | 0.890 |
101+
| RotatE | 367.64 | 0.931 | 0.924 | 0.935 | 0.944 |
97102

98103
The speed on Freebase
99104

apps/kg/config/best_config.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ DGLBACKEND=pytorch python3 train.py --model ComplEx --dataset FB15k --batch_size
1010
--neg_sample_size 256 --hidden_dim 2000 --gamma 500.0 --lr 0.2 --max_step 100000 \
1111
--batch_size_eval 16 --gpu 0 --valid --test -adv
1212

13-
DGLBACKEND=pytorch python3 train.py --model TransE --dataset FB15k --batch_size 1024 \
13+
DGLBACKEND=pytorch python3 train.py --model TransE_l1 --dataset FB15k --batch_size 1024 \
1414
--neg_sample_size 256 --hidden_dim 2000 --gamma 24.0 --lr 0.01 --max_step 20000 \
1515
--batch_size_eval 16 --gpu 0 --valid --test -adv
1616

17+
DGLBACKEND=pytorch python3 train.py --model TransE_l2 --dataset FB15k --batch_size 1024 \
18+
--neg_sample_size 256 --hidden_dim 2000 --gamma 12.0 --lr 0.1 --max_step 30000 \
19+
--batch_size_eval 16 --gpu 0 --valid --test -adv --regularization_coef=2e-7
20+
1721
DGLBACKEND=pytorch python3 train.py --model RESCAL --dataset FB15k --batch_size 1024 \
1822
--neg_sample_size 256 --hidden_dim 500 --gamma 24.0 --lr 0.03 --max_step 30000 \
1923
--batch_size_eval 16 --gpu 0 --valid --test -adv
@@ -22,13 +26,21 @@ DGLBACKEND=pytorch python3 train.py --model TransR --dataset FB15k --batch_size
2226
--neg_sample_size 256 --hidden_dim 500 --gamma 24.0 --lr 0.01 --max_step 30000 \
2327
--batch_size_eval 16 --gpu 0 --valid --test -adv
2428

29+
DGLBACKEND=pytorch python3 train.py --model RotatE --dataset FB15k --batch_size 1024 \
30+
--neg_sample_size 256 --hidden_dim 400 --gamma 12.0 --lr 0.01 --max_step 30000 \
31+
--batch_size_eval 16 --gpu 0 --valid --test -adv -de --regularization_coef=1e-4
32+
2533
# for wn18
2634

27-
DGLBACKEND=pytorch python3 train.py --model TransE --dataset wn18 --batch_size 1024 \
35+
DGLBACKEND=pytorch python3 train.py --model TransE_l1 --dataset wn18 --batch_size 1024 \
2836
--neg_sample_size 512 --hidden_dim 500 --gamma 12.0 --adversarial_temperature 0.5 \
2937
--lr 0.01 --max_step 40000 --batch_size_eval 16 --gpu 0 --valid --test -adv \
3038
--regularization_coef 0.00001
3139

40+
DGLBACKEND=pytorch python3 train.py --model TransE_l2 --dataset wn18 --batch_size 1024 \
41+
--neg_sample_size 512 --hidden_dim 500 --gamma 6.0 --lr 0.1 --max_step 20000 \
42+
--batch_size_eval 16 --gpu 0 --valid --test -adv --regularization_coef 0.0000001
43+
3244
DGLBACKEND=pytorch python3 train.py --model DistMult --dataset wn18 --batch_size 1024 \
3345
--neg_sample_size 1024 --hidden_dim 1000 --gamma 200.0 --lr 0.1 --max_step 10000 \
3446
--batch_size_eval 16 --gpu 0 --valid --test -adv --regularization_coef 0.00001
@@ -45,6 +57,10 @@ DGLBACKEND=pytorch python3 train.py --model TransR --dataset wn18 --batch_size 1
4557
--neg_sample_size 256 --hidden_dim 500 --gamma 16.0 --lr 0.1 --max_step 30000 \
4658
--batch_size_eval 16 --gpu 0 --valid --test -adv
4759

60+
DGLBACKEND=pytorch python3 train.py --model RotatE --dataset wn18 --batch_size 1024 \
61+
--neg_sample_size 256 --hidden_dim 400 --gamma 12.0 --lr 0.02 --max_step 20000 \
62+
--batch_size_eval 16 --gpu 0 --valid --test -adv -de
63+
4864
# for Freebase
4965

5066
DGLBACKEND=pytorch python3 train.py --model ComplEx --dataset Freebase --batch_size 1024 \

0 commit comments

Comments
 (0)