@@ -26,6 +26,8 @@ def deleteDirWin() {
2626}
2727
2828def skipRemainingStages = false
29+ def runGpuAsync = false
30+ def openClGpuLabel = " gpu"
2931
3032def utils = new org.stan.Utils ()
3133
@@ -45,13 +47,10 @@ String stan_pr() { params.stan_pr ?: ( env.CHANGE_TARGET == "master" ? "downstre
4547pipeline {
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