Jenkinsfile 22.3 KB
Newer Older
Lingfan Yu's avatar
Lingfan Yu committed
1
2
#!/usr/bin/env groovy

3
4
5
6
7
8
9
10
11
12
13
14
// CI tests are executed within Docker containers as the 'root' user. However,
// communications between Jenkins nodes are done with the 'ubuntu' user(login
// via root is disallowed on AWS EC2 instances). Therefore, we need to change
// the file permission to allow 'ubuntu' user to access the files created by
// the 'root' user. This is achieved by running 'chmod -R 777 .'.

// Summary of Jenkins nodes:
// - linux-benchmark-node: Linux CPU node for authentication and lint check.
//      number of nodes: 1
//      instance type: m5.2xlarge(8 vCPUs, 32 GB memory)
//      number of executors per node: 6
//      number of jobs running on this node per CI run: 3
15
// - dgl-ci-linux-cpu: Linux CPU node for building and testing.
16
17
18
19
//      number of nodes: 4
//      instance type: m6i.24xlarge(96 vCPUs, 384 GB memory)
//      number of executors per node: 6
//      number of jobs running on this node per CI run: 8
20
// - dgl-ci-linux-gpu: Linux GPU node for building and testing.
21
22
23
24
//      number of nodes: 4
//      instance type: g4dn.4xlarge(16 vCPUs, 64 GB memory, 1 GPU)
//      number of executors per node: 1
//      number of jobs running on this node per CI run: 4
25
26
27
// - dgl-ci-windows-cpu: Windows CPU node for building and testing.
//      number of nodes: 4
//      instance type: m6i.8xlarge(32 vCPUs, 128 GB memory)
28
29
30
//      number of executors per node: 2
//      number of jobs running on this node per CI run: 3

peizhou001's avatar
peizhou001 committed
31
dgl_linux_libs = 'build/libdgl.so, build/runUnitTests, python/dgl/_ffi/_cy3/core.cpython-*-x86_64-linux-gnu.so, build/tensoradapter/pytorch/*.so, build/dgl_sparse/*.so, build/graphbolt/*.so'
Minjie Wang's avatar
Minjie Wang committed
32
// Currently DGL on Windows is not working with Cython yet
peizhou001's avatar
peizhou001 committed
33
dgl_win64_libs = "build\\dgl.dll, build\\runUnitTests.exe, build\\tensoradapter\\pytorch\\*.dll, build\\dgl_sparse\\*.dll, build\\graphbolt\\*.dll"
Minjie Wang's avatar
Minjie Wang committed
34
35

def init_git() {
36
  sh "chmod -R 777 ." // Fix permission issue
37
  sh 'rm -rf *'
38
  sh "git config --global --add safe.directory '*'"
Minjie Wang's avatar
Minjie Wang committed
39
  checkout scm
40
  sh 'git submodule update --recursive --init'
Lingfan Yu's avatar
Lingfan Yu committed
41
42
}

Minjie Wang's avatar
Minjie Wang committed
43
44
def init_git_win64() {
  checkout scm
45
  bat 'git submodule update --recursive --init'
Lingfan Yu's avatar
Lingfan Yu committed
46
47
}

Minjie Wang's avatar
Minjie Wang committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// pack libraries for later use
def pack_lib(name, libs) {
  echo "Packing ${libs} into ${name}"
  stash includes: libs, name: name
}

// unpack libraries saved before
def unpack_lib(name, libs) {
  unstash name
  echo "Unpacked ${libs} from ${name}"
}

def build_dgl_linux(dev) {
  init_git()
62
  sh "bash tests/scripts/build_dgl.sh ${dev}"
63
  sh 'ls -lh /usr/lib/x86_64-linux-gnu/'
Minjie Wang's avatar
Minjie Wang committed
64
  pack_lib("dgl-${dev}-linux", dgl_linux_libs)
Lingfan Yu's avatar
Lingfan Yu committed
65
66
}

Minjie Wang's avatar
Minjie Wang committed
67
def build_dgl_win64(dev) {
68
69
  /* Assuming that Windows slaves are already configured with MSBuild VS2017,
   * CMake and Python/pip/setuptools etc. */
Minjie Wang's avatar
Minjie Wang committed
70
  init_git_win64()
71
  bat "CALL tests\\scripts\\build_dgl.bat"
Minjie Wang's avatar
Minjie Wang committed
72
  pack_lib("dgl-${dev}-win64", dgl_win64_libs)
73
74
}

75
def cpp_unit_test_linux(dev) {
Minjie Wang's avatar
Minjie Wang committed
76
  init_git()
77
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
78
  sh 'bash tests/scripts/task_cpp_unit_test.sh'
VoVAllen's avatar
VoVAllen committed
79
80
}

Minjie Wang's avatar
Minjie Wang committed
81
82
def cpp_unit_test_win64() {
  init_git_win64()
83
  unpack_lib('dgl-cpu-win64', dgl_win64_libs)
VoVAllen's avatar
VoVAllen committed
84
85
86
  bat "CALL tests\\scripts\\task_cpp_unit_test.bat"
}

Minjie Wang's avatar
Minjie Wang committed
87
def unit_test_linux(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
88
  init_git()
Minjie Wang's avatar
Minjie Wang committed
89
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
90
  timeout(time: 40, unit: 'MINUTES') {
91
    sh "bash tests/scripts/task_unit_test.sh ${backend} ${dev}"
Minjie Wang's avatar
Minjie Wang committed
92
  }
Lingfan Yu's avatar
Lingfan Yu committed
93
94
}

95
96
97
def unit_distributed_linux(backend, dev) {
  init_git()
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
98
  timeout(time: 40, unit: 'MINUTES') {
99
100
101
102
    sh "bash tests/scripts/task_distributed_test.sh ${backend} ${dev}"
  }
}

103
104
105
106
107
108
109
110
def unit_test_cugraph(backend, dev) {
  init_git()
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
  timeout(time: 15, unit: 'MINUTES') {
    sh "bash tests/scripts/cugraph_unit_test.sh ${backend}"
  }
}

111
def unit_test_win64(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
112
  init_git_win64()
Minjie Wang's avatar
Minjie Wang committed
113
  unpack_lib("dgl-${dev}-win64", dgl_win64_libs)
114
  timeout(time: 50, unit: 'MINUTES') {
115
    bat "CALL tests\\scripts\\task_unit_test.bat ${backend}"
Minjie Wang's avatar
Minjie Wang committed
116
  }
Da Zheng's avatar
Da Zheng committed
117
118
}

Minjie Wang's avatar
Minjie Wang committed
119
def example_test_linux(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
120
  init_git()
Minjie Wang's avatar
Minjie Wang committed
121
  unpack_lib("dgl-${dev}-linux", dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
122
123
  timeout(time: 20, unit: 'MINUTES') {
    sh "bash tests/scripts/task_example_test.sh ${dev}"
Minjie Wang's avatar
Minjie Wang committed
124
125
126
  }
}

127
def example_test_win64(backend, dev) {
Minjie Wang's avatar
Minjie Wang committed
128
  init_git_win64()
Minjie Wang's avatar
Minjie Wang committed
129
  unpack_lib("dgl-${dev}-win64", dgl_win64_libs)
Minjie Wang's avatar
Minjie Wang committed
130
131
  timeout(time: 20, unit: 'MINUTES') {
    bat "CALL tests\\scripts\\task_example_test.bat ${dev}"
132
133
134
  }
}

Minjie Wang's avatar
Minjie Wang committed
135
def tutorial_test_linux(backend) {
Minjie Wang's avatar
Minjie Wang committed
136
  init_git()
137
  unpack_lib('dgl-cpu-linux', dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
138
139
  timeout(time: 20, unit: 'MINUTES') {
    sh "bash tests/scripts/task_${backend}_tutorial_test.sh"
Minjie Wang's avatar
Minjie Wang committed
140
  }
Lingfan Yu's avatar
Lingfan Yu committed
141
142
}

Mufei Li's avatar
Mufei Li committed
143
144
145
def go_test_linux() {
  init_git()
  unpack_lib('dgl-cpu-linux', dgl_linux_libs)
Minjie Wang's avatar
Minjie Wang committed
146
  timeout(time: 20, unit: 'MINUTES') {
Mufei Li's avatar
Mufei Li committed
147
148
149
150
    sh "bash tests/scripts/task_go_test.sh"
  }
}

151
def is_authorized(name) {
152
153
154
155
156
157
158
159
  def devs = [
    // System:
    'dgl-bot', 'noreply',
    // Core:
    'Rhett-Ying', 'BarclayII', 'jermainewang', 'mufeili', 'isratnisa',
    'rudongyu', 'classicsong', 'HuXiangkun', 'hetong007', 'kylasa',
    'frozenbugs', 'peizhou001', 'zheng-da', 'czkkkkkk', 'thvasilo',
    // Intern:
yxy235's avatar
yxy235 committed
160
    'keli-wen', 'caojy1998', 'RamonZhou', 'xiangyuzhi', 'Skeleton003', 'yxy235',
161
    'hutiechuan',
162
163
164
    // Friends:
    'nv-dlasalle', 'yaox12', 'chang-l', 'Kh4L', 'VibhuJawa', 'kkranen',
    'bgawrych', 'itaraban', 'daniil-sizov', 'anko-intel', 'Kacper-Pietkun',
165
    'hankaj', 'agrabows', 'DominikaJedynak', 'RafLit', 'mfbalin',
166
167
168
    // Emeritus:
    'VoVAllen',
  ]
169
170
171
172
173
174
  return (name in devs)
}

def is_admin(name) {
  def admins = ['dgl-bot', 'Rhett-Ying', 'BarclayII', 'jermainewang']
  return (name in admins)
175
}
VoVAllen's avatar
VoVAllen committed
176

177
178
def regression_test_done = false

Minjie Wang's avatar
Minjie Wang committed
179
pipeline {
Jinjing Zhou's avatar
Jinjing Zhou committed
180
  agent any
181
  triggers {
Rhett Ying's avatar
Rhett Ying committed
182
        issueCommentTrigger('@dgl-bot.*')
183
  }
Minjie Wang's avatar
Minjie Wang committed
184
  stages {
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    // Below 2 stages are to authenticate the change/comment author.
    // Only core developers are allowed to trigger CI.
    // Such authentication protects CI from malicious code which may bring CI instances down.
    stage('Authentication') {
      agent {
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
        }
      }
      when { not { triggeredBy 'IssueCommentCause' } }
      steps {
        script {
          def author = env.CHANGE_AUTHOR
          def prOpenTriggerCause = currentBuild.getBuildCauses('jenkins.branch.BranchEventCause')
          def first_run = prOpenTriggerCause && env.BUILD_ID == '1'
          if (author && !is_authorized(author)) {
Rhett Ying's avatar
Rhett Ying committed
203
            pullRequest.comment("Not authorized to trigger CI. Please ask core developer to help trigger via issuing comment: \n - `@dgl-bot`")
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
            error("Authentication failed.")
          }
          if (first_run) {
            pullRequest.comment('To trigger regression tests: \n - `@dgl-bot run [instance-type] [which tests] [compare-with-branch]`; \n For example: `@dgl-bot run g4dn.4xlarge all dmlc/master` or `@dgl-bot run c5.9xlarge kernel,api dmlc/master`')
          }
        }
      }
    }
    stage('AuthenticationComment') {
      agent {
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
        }
      }
      when { triggeredBy 'IssueCommentCause' }
      steps {
        script {
          def author = env.GITHUB_COMMENT_AUTHOR
          if (!is_authorized(author)) {
            pullRequest.comment("Not authorized to trigger CI via issuing comment.")
            error("Authentication failed.")
          }
        }
      }
    }
    stage('Regression Test') {
232
      agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
233
234
235
236
        docker {
            label 'linux-benchmark-node'
            image 'dgllib/dgl-ci-lint'
            alwaysPull true
Jinjing Zhou's avatar
Jinjing Zhou committed
237
        }
VoVAllen's avatar
VoVAllen committed
238
      }
239
      when { triggeredBy 'IssueCommentCause' }
Minjie Wang's avatar
Minjie Wang committed
240
      steps {
Jinjing Zhou's avatar
Jinjing Zhou committed
241
242
          checkout scm
          script {
243
              def comment = env.GITHUB_COMMENT
Rhett Ying's avatar
Rhett Ying committed
244
245
246
247
248
249
250
251
252
              def command_lists = comment.split(' ')
              if (command_lists.size() == 1) {
                // CI command, not for regression
                return
              }
              if (command_lists.size() != 5) {
                pullRequest.comment('Cannot run the regression test due to unknown command')
                error('Unknown command')
              }
253
              def author = env.GITHUB_COMMENT_AUTHOR
254
255
              echo("${env.GIT_URL}")
              echo("${env}")
256
              if (!is_admin(author)) {
257
                error('Not authorized to launch regression tests')
258
259
              }
              dir('benchmark_scripts_repo') {
Jinjing Zhou's avatar
Jinjing Zhou committed
260
261
                checkout([$class: 'GitSCM', branches: [[name: '*/master']],
                        userRemoteConfigs: [[credentialsId: 'github', url: 'https://github.com/dglai/DGL_scripts.git']]])
262
263
264
              }
              sh('cp benchmark_scripts_repo/benchmark/* benchmarks/scripts/')
              def instance_type = command_lists[2].replace('.', '')
Jinjing Zhou's avatar
Jinjing Zhou committed
265
              pullRequest.comment("Start the Regression test. View at ${RUN_DISPLAY_URL}")
266
              def prNumber = env.BRANCH_NAME.replace('PR-', '')
267
268
              dir('benchmarks/scripts') {
                sh('python3 -m pip install boto3')
269
                sh("PYTHONUNBUFFERED=1 GIT_PR_ID=${prNumber} GIT_URL=${env.GIT_URL} GIT_BRANCH=${env.CHANGE_BRANCH} python3 run_reg_test.py --data-folder ${env.GIT_COMMIT}_${instance_type} --run-cmd '${comment}'")
270
271
272
              }
              pullRequest.comment("Finished the Regression test. Result table is at https://dgl-asv-data.s3-us-west-2.amazonaws.com/${env.GIT_COMMIT}_${instance_type}/results/result.csv. Jenkins job link is ${RUN_DISPLAY_URL}. ")
              currentBuild.result = 'SUCCESS'
273
              regression_test_done = true
Jinjing Zhou's avatar
Jinjing Zhou committed
274
          }
275
      }
Minjie Wang's avatar
Minjie Wang committed
276
    }
Jinjing Zhou's avatar
Jinjing Zhou committed
277
    stage('CI') {
278
      when { expression { !regression_test_done } }
Jinjing Zhou's avatar
Jinjing Zhou committed
279
      stages {
280
281
282
        stage('Abort Previous CI') {
          steps {
            script {
283
284
285
286
287
288
289
290
              if (env.BRANCH_NAME != "master") {
                // Jenkins will abort an older build if a newer build already
                // passed a higher milestone.
                // https://www.jenkins.io/doc/pipeline/steps/pipeline-milestone-step/
                def buildNumber = env.BUILD_NUMBER as int
                for (int i = 1; i <= buildNumber; i++) {
                  milestone(i)
                }
291
292
293
294
295
              }
            }
          }
        }

296
297
        stage('Lint Check') {
          agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
298
            docker {
299
              label "linux-benchmark-node"
Mufei Li's avatar
Mufei Li committed
300
              image "dgllib/dgl-ci-lint"
Jinjing Zhou's avatar
Jinjing Zhou committed
301
              alwaysPull true
VoVAllen's avatar
VoVAllen committed
302
303
            }
          }
Minjie Wang's avatar
Minjie Wang committed
304
          steps {
305
306
            init_git()
            sh 'bash tests/scripts/task_lint.sh'
VoVAllen's avatar
VoVAllen committed
307
          }
308
309
310
311
312
          post {
            always {
              cleanWs disableDeferredWipeout: true, deleteDirs: true
            }
          }
VoVAllen's avatar
VoVAllen committed
313
        }
Mufei Li's avatar
Mufei Li committed
314

315
316
317
318
        stage('Build') {
          parallel {
            stage('CPU Build') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
319
                docker {
320
                  label "dgl-ci-linux-cpu"
321
                  image "dgllib/dgl-ci-cpu:v240123_1000"
Jinjing Zhou's avatar
Jinjing Zhou committed
322
323
                  args "-u root"
                  alwaysPull true
324
                }
Jinjing Zhou's avatar
Jinjing Zhou committed
325
326
              }
              steps {
327
                build_dgl_linux('cpu')
Jinjing Zhou's avatar
Jinjing Zhou committed
328
              }
329
330
              post {
                always {
331
                  sh "chmod -R 777 ." // Fix permission issue
332
333
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
334
              }
Lingfan Yu's avatar
Lingfan Yu committed
335
            }
336
337
            stage('GPU Build') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
338
                docker {
339
                  label "dgl-ci-linux-cpu"
340
                  image "dgllib/dgl-ci-gpu:cu116_v240123_1000"
Jinjing Zhou's avatar
Jinjing Zhou committed
341
342
                  args "-u root"
                  alwaysPull true
343
                }
Minjie Wang's avatar
Minjie Wang committed
344
345
              }
              steps {
346
347
                // sh "nvidia-smi"
                build_dgl_linux('gpu')
Minjie Wang's avatar
Minjie Wang committed
348
              }
349
350
              post {
                always {
351
                  sh "chmod -R 777 ." // Fix permission issue
352
353
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
354
              }
355
            }
356
357
358
            stage('PyTorch Cugraph GPU Build') {
              agent {
                docker {
359
                  label "dgl-ci-linux-cpu"
360
                  image "rapidsai/cugraph_stable_torch-cuda:11.8-base-ubuntu20.04-py3.10-pytorch2.0.0-rapids23.04"
361
                  args "-u root"
362
                  alwaysPull true
363
364
365
366
367
368
369
                }
              }
              steps {
                build_dgl_linux('cugraph')
              }
              post {
                always {
370
                  sh "chmod -R 777 ." // Fix permission issue
371
372
373
374
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
375
            stage('CPU Build (Win64)') {
376
              agent { label 'dgl-ci-windows-cpu' }
Minjie Wang's avatar
Minjie Wang committed
377
              steps {
378
379
380
381
382
383
                build_dgl_win64('cpu')
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
384
              }
Lingfan Yu's avatar
Lingfan Yu committed
385
            }
386
          // Currently we don't have Windows GPU build machines
387
          }
Lingfan Yu's avatar
Lingfan Yu committed
388
        }
389
390
391
392
        stage('Test') {
          parallel {
            stage('C++ CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
393
                docker {
394
                  label "dgl-ci-linux-cpu"
395
                  image "dgllib/dgl-ci-cpu:v240123_1000"
396
                  args "-u root"
Jinjing Zhou's avatar
Jinjing Zhou committed
397
                  alwaysPull true
398
399
                }
              }
Minjie Wang's avatar
Minjie Wang committed
400
              steps {
401
402
403
404
                cpp_unit_test_linux('cpu')
              }
              post {
                always {
405
                  sh "chmod -R 777 ." // Fix permission issue
406
407
408
409
410
411
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
            stage('C++ GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
412
                docker {
413
                  label "dgl-ci-linux-gpu"
414
                  image "dgllib/dgl-ci-gpu:cu116_v240123_1000"
415
                  args "-u root --runtime nvidia"
Jinjing Zhou's avatar
Jinjing Zhou committed
416
                  alwaysPull true
417
418
419
420
                }
              }
              steps {
                cpp_unit_test_linux('gpu')
421
422
423
              }
              post {
                always {
424
                  sh "chmod -R 777 ." // Fix permission issue
425
426
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
427
428
              }
            }
429
            stage('C++ CPU (Win64)') {
430
              agent { label 'dgl-ci-windows-cpu' }
Minjie Wang's avatar
Minjie Wang committed
431
              steps {
432
433
434
435
436
437
                cpp_unit_test_win64()
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
Minjie Wang's avatar
Minjie Wang committed
438
              }
Minjie Wang's avatar
Minjie Wang committed
439
            }
440
441
            stage('Tensorflow CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
442
                docker {
443
                  label "dgl-ci-linux-cpu"
444
                  image "dgllib/dgl-ci-cpu:v230810"
445
                  args "-u root"
Jinjing Zhou's avatar
Jinjing Zhou committed
446
                  alwaysPull true
447
448
449
                }
              }
              stages {
450
                stage('Tensorflow CPU Unit test') {
451
452
453
                  steps {
                    unit_test_linux('tensorflow', 'cpu')
                  }
454
455
                  // Tensorflow is deprecated.
                  when { expression { false } }
456
457
458
459
                }
              }
              post {
                always {
460
                  sh "chmod -R 777 ." // Fix permission issue
461
462
463
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
464
            }
465
466
            stage('Tensorflow GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
467
                docker {
468
                  label "dgl-ci-linux-gpu"
469
                  image "dgllib/dgl-ci-gpu:cu116_v240123_1000"
470
                  args "-u root --runtime nvidia"
Jinjing Zhou's avatar
Jinjing Zhou committed
471
                  alwaysPull true
472
473
474
                }
              }
              stages {
475
                stage('Tensorflow GPU Unit test') {
476
477
478
                  steps {
                    unit_test_linux('tensorflow', 'gpu')
                  }
479
480
                  // Tensorflow does not support cuda 11.6 yet.
                  when { expression { false } }
481
482
483
484
                }
              }
              post {
                always {
485
                  sh "chmod -R 777 ." // Fix permission issue
486
487
488
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
VoVAllen's avatar
VoVAllen committed
489
            }
490
491
            stage('Torch CPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
492
                docker {
493
                  label "dgl-ci-linux-cpu"
494
                  image "dgllib/dgl-ci-cpu:v240123_1000"
495
                  args "-u root --shm-size=4gb"
Jinjing Zhou's avatar
Jinjing Zhou committed
496
                  alwaysPull true
497
498
499
                }
              }
              stages {
500
                stage('Torch CPU Unit test') {
501
502
503
504
                  steps {
                    unit_test_linux('pytorch', 'cpu')
                  }
                }
505
                stage('Torch CPU Example test') {
506
507
508
509
                  steps {
                    example_test_linux('pytorch', 'cpu')
                  }
                }
510
                stage('Torch CPU Tutorial test') {
511
512
513
514
515
516
517
                  steps {
                    tutorial_test_linux('pytorch')
                  }
                }
              }
              post {
                always {
518
                  sh "chmod -R 777 ." // Fix permission issue
519
520
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
VoVAllen's avatar
VoVAllen committed
521
              }
Da Zheng's avatar
Da Zheng committed
522
            }
523
            stage('Torch CPU (Win64)') {
524
              agent { label 'dgl-ci-windows-cpu' }
525
              stages {
526
                stage('Torch CPU (Win64) Unit test') {
527
528
529
530
                  steps {
                    unit_test_win64('pytorch', 'cpu')
                  }
                }
531
                stage('Torch CPU (Win64) Example test') {
532
533
534
535
536
537
538
539
540
541
                  steps {
                    example_test_win64('pytorch', 'cpu')
                  }
                }
              }
              post {
                always {
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
542
            }
543
544
            stage('Torch GPU') {
              agent {
Jinjing Zhou's avatar
Jinjing Zhou committed
545
                docker {
546
                  label "dgl-ci-linux-gpu"
547
                  image "dgllib/dgl-ci-gpu:cu116_v240123_1000"
548
                  args "-u root --runtime nvidia --shm-size=8gb"
Jinjing Zhou's avatar
Jinjing Zhou committed
549
                  alwaysPull true
550
551
552
                }
              }
              stages {
553
                stage('Torch GPU Unit test') {
554
555
556
557
558
                  steps {
                    sh 'nvidia-smi'
                    unit_test_linux('pytorch', 'gpu')
                  }
                }
559
                stage('Torch GPU Example test') {
560
561
562
563
564
565
566
                  steps {
                    example_test_linux('pytorch', 'gpu')
                  }
                }
              }
              post {
                always {
567
                  sh "chmod -R 777 ." // Fix permission issue
568
569
570
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
571
            }
572
573
574
            stage('Distributed') {
              agent {
                docker {
575
                  label "dgl-ci-linux-cpu"
576
                  image "dgllib/dgl-ci-cpu:v240123_1000"
577
                  args "-u root --shm-size=4gb"
578
579
580
581
582
583
584
585
586
587
588
589
                  alwaysPull true
                }
              }
              stages {
                stage('Distributed Torch CPU Unit test') {
                  steps {
                    unit_distributed_linux('pytorch', 'cpu')
                  }
                }
              }
              post {
                always {
590
                  sh "chmod -R 777 ." // Fix permission issue
591
592
593
594
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
595
596
597
            stage('PyTorch Cugraph GPU') {
              agent {
                docker {
598
                  label "dgl-ci-linux-gpu"
599
                  image "rapidsai/cugraph_stable_torch-cuda:11.8-base-ubuntu20.04-py3.10-pytorch2.0.0-rapids23.04"
600
                  args "-u root --runtime nvidia --shm-size=8gb"
601
                  alwaysPull true
602
603
604
605
606
607
608
609
610
611
612
613
                }
              }
              stages {
                stage('PyTorch Cugraph GPU Unit test') {
                  steps {
                    sh 'nvidia-smi'
                    unit_test_cugraph('pytorch', 'cugraph')
                  }
                }
              }
              post {
                always {
614
                  sh "chmod -R 777 ." // Fix permission issue
615
616
617
618
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
Minjie Wang's avatar
Minjie Wang committed
619
620
621
            stage('DGL-Go') {
              agent {
                docker {
622
                  label "dgl-ci-linux-cpu"
623
                  image "dgllib/dgl-ci-cpu:v240123_1000"
624
                  args "-u root"
Minjie Wang's avatar
Minjie Wang committed
625
626
627
628
629
630
631
632
633
634
635
636
                  alwaysPull true
                }
              }
              stages {
                stage('DGL-Go CPU test') {
                  steps {
                    go_test_linux()
                  }
                }
              }
              post {
                always {
637
                  sh "chmod -R 777 ." // Fix permission issue
Minjie Wang's avatar
Minjie Wang committed
638
639
640
641
                  cleanWs disableDeferredWipeout: true, deleteDirs: true
                }
              }
            }
642
643
          }
        }
Minjie Wang's avatar
Minjie Wang committed
644
      }
Minjie Wang's avatar
Minjie Wang committed
645
    }
Minjie Wang's avatar
Minjie Wang committed
646
  }
647
648
  post {
    always {
649
      script {
650
        node("dglci-post-linux") {
651
652
653
          docker.image('dgllib/dgl-ci-awscli:v220418').inside("--pull always --entrypoint=''") {
            sh("rm -rf ci_tmp")
            dir('ci_tmp') {
654
              sh("curl -k -o cireport.log ${BUILD_URL}consoleText")
Rhett Ying's avatar
Rhett Ying committed
655
656
              sh("curl -o report.py https://raw.githubusercontent.com/dmlc/dgl/master/tests/scripts/ci_report/report.py")
              sh("curl -o status.py https://raw.githubusercontent.com/dmlc/dgl/master/tests/scripts/ci_report/status.py")
657
              sh("curl -k -L ${BUILD_URL}wfapi")
658
659
660
661
662
              sh("cat status.py")
              sh("pytest --html=report.html --self-contained-html report.py || true")
              sh("aws s3 sync ./ s3://dgl-ci-result/${JOB_NAME}/${BUILD_NUMBER}/${BUILD_ID}/logs/  --exclude '*' --include '*.log' --acl public-read --content-type text/plain")
              sh("aws s3 sync ./ s3://dgl-ci-result/${JOB_NAME}/${BUILD_NUMBER}/${BUILD_ID}/logs/  --exclude '*.log' --acl public-read")

663
              def comment = sh(returnStdout: true, script: "python3 status.py --result ${currentBuild.currentResult}").trim()
664
              echo(comment)
665
666
667
              if ((env.BRANCH_NAME).startsWith('PR-')) {
                pullRequest.comment(comment)
              }
668
669
670
            }
          }
        }
671
        node('dgl-ci-windows-cpu') {
672
673
            bat(script: "rmvirtualenv ${BUILD_TAG}", returnStatus: true)
        }
674
675
676
      }
    }
  }
Minjie Wang's avatar
Minjie Wang committed
677
}