Skip to content

Commit 3ac7b31

Browse files
authored
Merge pull request #1955 from stan-dev/separate-cicd-gpu-async
OpenCL now can run both sync/async gpu tests.
2 parents 7a800b6 + a578d45 commit 3ac7b31

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

Jenkinsfile

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def deleteDirWin() {
2626
}
2727

2828
def skipRemainingStages = false
29+
def runGpuAsync = false
30+
def openClGpuLabel = "gpu"
2931

3032
def utils = new org.stan.Utils()
3133

@@ -45,13 +47,10 @@ String stan_pr() { params.stan_pr ?: ( env.CHANGE_TARGET == "master" ? "downstre
4547
pipeline {
4648
agent none
4749
parameters {
48-
string(defaultValue: '', name: 'cmdstan_pr',
49-
description: 'PR to test CmdStan upstream against e.g. PR-630')
50-
string(defaultValue: '', name: 'stan_pr',
51-
description: 'PR to test Stan upstream against e.g. PR-630')
52-
booleanParam(defaultValue: false, description:
53-
'Run additional distribution tests on RowVectors (takes 5x as long)',
54-
name: 'withRowVector')
50+
string(defaultValue: '', name: 'cmdstan_pr', description: 'PR to test CmdStan upstream against e.g. PR-630')
51+
string(defaultValue: '', name: 'stan_pr', description: 'PR to test Stan upstream against e.g. PR-630')
52+
booleanParam(defaultValue: false, name: 'withRowVector', description: 'Run additional distribution tests on RowVectors (takes 5x as long)')
53+
booleanParam(defaultValue: false, name: 'gpu_async', description: 'Run the OpenCL tests on both a sync (AMD) GPU and an async (NVIDIA) one.')
5554
}
5655
options {
5756
skipDefaultCheckout()
@@ -157,6 +156,14 @@ pipeline {
157156

158157
def paths = ['stan', 'make', 'lib', 'test', 'runTests.py', 'runChecks.py', 'makefile', 'Jenkinsfile', '.clang-format'].join(" ")
159158
skipRemainingStages = utils.verifyChanges(paths)
159+
160+
if(!utils.verifyChanges(["stan/math/opencl", "test/unit/math/opencl"].join(" ")) || params.gpu_async){
161+
runGpuAsync = true
162+
openClGpuLabel = "gpu-no-async"
163+
}
164+
else{
165+
runGpuAsync = false
166+
}
160167
}
161168
}
162169
}
@@ -222,7 +229,32 @@ pipeline {
222229
post { always { retry(3) { deleteDir() } } }
223230
}
224231
stage('OpenCL tests') {
225-
agent { label "gpu" }
232+
agent { label openClGpuLabel }
233+
steps {
234+
deleteDir()
235+
unstash 'MathSetup'
236+
sh "echo CXX=${env.CXX} -Werror > make/local"
237+
sh "echo STAN_OPENCL=true>> make/local"
238+
sh "echo OPENCL_PLATFORM_ID=0>> make/local"
239+
sh "echo OPENCL_DEVICE_ID=${OPENCL_DEVICE_ID}>> make/local"
240+
sh "make -j${env.PARALLEL} test-headers"
241+
runTests("test/unit/math/opencl")
242+
runTests("test/unit/math/prim/fun/gp_exp_quad_cov_test")
243+
runTests("test/unit/math/prim/fun/mdivide_left_tri_test")
244+
runTests("test/unit/math/prim/fun/mdivide_right_tri_test")
245+
runTests("test/unit/math/prim/fun/multiply_test")
246+
runTests("test/unit/math/rev/fun/mdivide_left_tri_test")
247+
runTests("test/unit/math/rev/fun/multiply_test")
248+
}
249+
post { always { retry(3) { deleteDir() } } }
250+
}
251+
stage('OpenCL tests async') {
252+
agent { label "gpu-async" }
253+
when {
254+
expression {
255+
runGpuAsync
256+
}
257+
}
226258
steps {
227259
deleteDir()
228260
unstash 'MathSetup'

0 commit comments

Comments
 (0)