|
| 1 | +#!groovy |
| 2 | + |
| 3 | +def buildbadge = addEmbeddableBadgeConfiguration(id: "Jenkins", subject: "Jenkins Tests", status: "skipped") |
| 4 | + |
| 5 | +if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { |
| 6 | + print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} triggered by branch indexing..." |
| 7 | + if (env.BRANCH_NAME != "master") { |
| 8 | + if (env.BUILD_NUMBER != "1") { // Always execute first build to load this configuration and thus the triggers |
| 9 | + print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} skipped due being triggered by Branch Indexing instead of SCM change!" |
| 10 | + buildbadge.setStatus('skipped') |
| 11 | + currentBuild.result = 'ABORTED' |
| 12 | + return // early exit to avoid redundant builds |
| 13 | + } |
| 14 | + } |
| 15 | +} else { |
| 16 | + print "INFO: Build on ${env.BRANCH_NAME}/${env.BUILD_NUMBER} triggered by SCM change..." |
| 17 | + print "Proceeding!" |
| 18 | +} |
| 19 | + |
| 20 | + |
| 21 | +pipeline { |
| 22 | + agent { label 'argon-fs'} |
| 23 | + |
| 24 | + options { |
| 25 | + buildDiscarder( |
| 26 | + logRotator( |
| 27 | + daysToKeepStr: "21", |
| 28 | + numToKeepStr: "50", |
| 29 | + artifactDaysToKeepStr: "21", |
| 30 | + artifactNumToKeepStr: "50" |
| 31 | + ) |
| 32 | + ) |
| 33 | + } |
| 34 | + |
| 35 | + triggers { |
| 36 | + githubPush() // Trigger by push to respective github branch |
| 37 | + pollSCM 'H/15 * * * *' // Fallback polling solution as some pushes are somehow lost |
| 38 | + } |
| 39 | + |
| 40 | + environment { |
| 41 | + GITHUB_TOKEN = credentials('GITHUB_TOKEN') |
| 42 | + BRANCH_NAME = "${env.BRANCH_NAME}" |
| 43 | + } |
| 44 | + |
| 45 | + stages { |
| 46 | + stage('init') { |
| 47 | + steps { |
| 48 | + sh ''' |
| 49 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 50 | + curl --verbose\ |
| 51 | + --request POST \ |
| 52 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 53 | + --header "Content-Type: application/json" \ |
| 54 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 55 | + --data "{ |
| 56 | + \\"state\\": \\"pending\\", |
| 57 | + \\"context\\": \\"jenkins-ctest-multigpu\\", |
| 58 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-multigpu\\", |
| 59 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-Multigpu/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 60 | + }" |
| 61 | + ''' |
| 62 | + } |
| 63 | + } |
| 64 | + stage('checkout') { |
| 65 | + steps { |
| 66 | + sh ''' |
| 67 | + srun -w argon-gtx -N 1 -n 1 -t 03:00:00 -D /scratch bash -c "\ |
| 68 | + cd /scratch && \ |
| 69 | + mkdir -p jenkins && cd jenkins; \ |
| 70 | + if [[ ! -d spack ]]; then git clone --depth 1 https://github.com/spack/spack.git;fi; \ |
| 71 | + source spack/share/spack/setup-env.sh && \ |
| 72 | + spack compiler find && \ |
| 73 | + spack install [email protected] && \ |
| 74 | + spack load [email protected] && echo 'Successfully installed/loaded spack cmake'" |
| 75 | + ''' |
| 76 | + sh ''' |
| 77 | + srun -w argon-gtx -N 1 -n 1 -t 0:05:00 -D /scratch bash -c "\ |
| 78 | + cd /scratch && \ |
| 79 | + mkdir -p jenkins && cd jenkins; \ |
| 80 | + mkdir -p plssvm/${BUILD_TAG} && cd plssvm/${BUILD_TAG} && \ |
| 81 | + rm -rf PLSSVM && \ |
| 82 | + git clone [email protected]:SC-SGS/PLSSVM.git PLSSVM && \ |
| 83 | + cd PLSSVM && \ |
| 84 | + pwd && \ |
| 85 | + git checkout ${GIT_COMMIT}" |
| 86 | + ''' |
| 87 | + sh ''' |
| 88 | + mkdir ${BUILD_TAG} |
| 89 | + ''' |
| 90 | + } |
| 91 | + } |
| 92 | + stage('setup python'){ |
| 93 | + steps{ |
| 94 | + sh ''' |
| 95 | + /usr/bin/python3.8 -m pip install --user arff |
| 96 | + /usr/bin/python3.8 -m pip install --user pandas |
| 97 | + /usr/bin/python3.8 -m pip install --user sklearn |
| 98 | + /usr/bin/python3.8 -m pip install --user argparse |
| 99 | + ''' |
| 100 | + } |
| 101 | + } |
| 102 | + stage('build and test'){ |
| 103 | + parallel { |
| 104 | + stage('OpenMP, OpenCL, CUDA'){ |
| 105 | + stages{ |
| 106 | + stage('build plssvm Release') { |
| 107 | + steps { |
| 108 | + dir('plssvm') { |
| 109 | + sh ''' |
| 110 | + srun -w argon-gtx -N 1 -n 1 -t 00:05:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM bash -c "\ |
| 111 | + source /scratch/jenkins/spack/share/spack/setup-env.sh && spack load [email protected] &&\ |
| 112 | + module load cuda &&\ |
| 113 | + mkdir -p build/Release &&\ |
| 114 | + cd build/Release &&\ |
| 115 | + rm -rf * &&\ |
| 116 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS='cpu;nvidia:61' -DPLSSVM_ENABLE_ASSERTS=ON -S ../../ &&\ |
| 117 | + make -j4" |
| 118 | + ''' |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + stage('run tests Release') { |
| 123 | + steps { |
| 124 | + dir('plssvm') { |
| 125 | + warnError('Release tests failed!') { |
| 126 | + sh ''' |
| 127 | + srun -w argon-gtx -N 1 -n 1 -t 01:00:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM --gres=gpu:2 bash -c "\ |
| 128 | + module load cuda &&\ |
| 129 | + cd build/Release &&\ |
| 130 | + ctest -j4 --no-compress-output -T Test --timeout 1200; \ |
| 131 | + returncode=$? && \ |
| 132 | + cp -r Testing /data/argon-fs/sgs/jenkins/workspace/$(basename ${WORKSPACE})/${BUILD_TAG}/Testing &&\ |
| 133 | + exit $returncode" |
| 134 | + ''' |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + } |
| 140 | + } |
| 141 | + stage('hipSYCL'){ |
| 142 | + stages{ |
| 143 | + stage('build plssvm hipSYCL Release') { |
| 144 | + steps { |
| 145 | + dir('plssvm') { |
| 146 | + sh ''' |
| 147 | + srun -w argon-gtx -N 1 -n 1 -t 00:05:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM bash -c "\ |
| 148 | + source /scratch/jenkins/spack/share/spack/setup-env.sh && spack load [email protected] &&\ |
| 149 | + module load cuda &&\ |
| 150 | + module use /home/breyerml/.modulefiles/ &&\ |
| 151 | + module load pcsgs05/hipsycl &&\ |
| 152 | + mkdir -p build/Release_hip &&\ |
| 153 | + cd build/Release_hip &&\ |
| 154 | + rm -rf * &&\ |
| 155 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS='cpu;nvidia:sm_61' -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON -S ../../ &&\ |
| 156 | + make -j4 " |
| 157 | + ''' |
| 158 | + } |
| 159 | + } |
| 160 | + } |
| 161 | + stage('run tests hipSYCL Release') { |
| 162 | + steps { |
| 163 | + dir('plssvm') { |
| 164 | + warnError('hipSYCL Release tests failed!') { |
| 165 | + sh ''' |
| 166 | + srun -w argon-gtx -N 1 -n 1 -t 01:00:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM --gres=gpu:2 bash -c "\ |
| 167 | + module load cuda &&\ |
| 168 | + module use /home/breyerml/.modulefiles/ &&\ |
| 169 | + module load pcsgs05/hipsycl &&\ |
| 170 | + cd build/Release_hip &&\ |
| 171 | + ctest -j4 --no-compress-output -T Test --timeout 1200; \ |
| 172 | + returncode=$? && \ |
| 173 | + cp -r Testing /data/argon-fs/sgs/jenkins/workspace/$(basename ${WORKSPACE})/${BUILD_TAG}/Testing_hip && \ |
| 174 | + exit $returncode" |
| 175 | + ''' |
| 176 | + } |
| 177 | + } |
| 178 | + } |
| 179 | + } |
| 180 | + } |
| 181 | + } |
| 182 | + stage('DPC++'){ |
| 183 | + stages{ |
| 184 | + stage('build plssvm DPC++ Release') { |
| 185 | + steps { |
| 186 | + dir('plssvm') { |
| 187 | + sh ''' |
| 188 | + srun -w argon-gtx -N 1 -n 1 -t 00:05:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM bash -c "\ |
| 189 | + source /scratch/jenkins/spack/share/spack/setup-env.sh && spack load [email protected] &&\ |
| 190 | + module load cuda &&\ |
| 191 | + module use /home/breyerml/.modulefiles/ &&\ |
| 192 | + module load pcsgs05/dpcpp_rt &&\ |
| 193 | + mkdir -p build/Release_dpcpp &&\ |
| 194 | + cd build/Release_dpcpp &&\ |
| 195 | + rm -rf * &&\ |
| 196 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS='cpu;nvidia:sm_61' -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=ON -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON -DPLSSVM_ENABLE_LTO=OFF -S ../../ &&\ |
| 197 | + make -j4 " |
| 198 | + ''' |
| 199 | + } |
| 200 | + } |
| 201 | + } |
| 202 | + stage('run tests DPC++ Release') { |
| 203 | + steps { |
| 204 | + dir('plssvm') { |
| 205 | + warnError('DPC++ Release tests failed!') { |
| 206 | + sh ''' |
| 207 | + srun -w argon-gtx -N 1 -n 1 -t 01:00:00 -D /scratch/jenkins/plssvm/${BUILD_TAG}/PLSSVM --gres=gpu:2 bash -c "\ |
| 208 | + module load cuda &&\ |
| 209 | + module use /home/breyerml/.modulefiles/ &&\ |
| 210 | + module load pcsgs05/dpcpp_rt &&\ |
| 211 | + cd build/Release_dpcpp &&\ |
| 212 | + ctest -j4 --no-compress-output -T Test --timeout 1200; \ |
| 213 | + returncode=$? && \ |
| 214 | + cp -r Testing /data/argon-fs/sgs/jenkins/workspace/$(basename ${WORKSPACE})/${BUILD_TAG}/Testing_dpcpp &&\ |
| 215 | + exit $returncode" |
| 216 | + ''' |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | + } |
| 221 | + } |
| 222 | + } |
| 223 | + } |
| 224 | + } |
| 225 | + } |
| 226 | + post { |
| 227 | + always { |
| 228 | + // Process the CTest xml output with the xUnit plugin |
| 229 | + xunit ( |
| 230 | + testTimeMargin: '3000', |
| 231 | + thresholdMode: 1, |
| 232 | + thresholds: [ |
| 233 | + skipped(failureThreshold: '0'), |
| 234 | + failed(failureThreshold: '0') |
| 235 | + ], |
| 236 | + tools: [CTest( |
| 237 | + pattern: '${BUILD_TAG}/Testing*/**/*.xml', |
| 238 | + deleteOutputFiles: true, |
| 239 | + failIfNotNew: false, |
| 240 | + skipNoTestFiles: true, |
| 241 | + stopProcessingIfError: true |
| 242 | + )] |
| 243 | + ) |
| 244 | + sh ''' |
| 245 | + srun -w argon-gtx -n 1 -t 00:05:00 bash -c "rm -rf /data/scratch/jenkins/plssvm/${BUILD_TAG}" |
| 246 | + rm -rf ${BUILD_TAG} |
| 247 | + ''' |
| 248 | + } |
| 249 | + success { |
| 250 | + script { |
| 251 | + buildbadge.setStatus('success') |
| 252 | + } |
| 253 | + sh ''' |
| 254 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 255 | + curl --verbose\ |
| 256 | + --request POST \ |
| 257 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 258 | + --header "Content-Type: application/json" \ |
| 259 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 260 | + --data "{ |
| 261 | + \\"state\\": \\"success\\", |
| 262 | + \\"context\\": \\"jenkins-ctest-multigpu\\", |
| 263 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-multigpu\\", |
| 264 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-Multigpu/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 265 | + }" |
| 266 | + ''' |
| 267 | + } |
| 268 | + failure { |
| 269 | + script { |
| 270 | + buildbadge.setStatus('failing') |
| 271 | + } |
| 272 | + sh ''' |
| 273 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 274 | + curl --verbose\ |
| 275 | + --request POST \ |
| 276 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 277 | + --header "Content-Type: application/json" \ |
| 278 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 279 | + --data "{ |
| 280 | + \\"state\\": \\"failure\\", |
| 281 | + \\"context\\": \\"jenkins-ctest-multigpu\\", |
| 282 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-multigpu\\", |
| 283 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-Multigpu/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 284 | + }" |
| 285 | + ''' |
| 286 | + } |
| 287 | + aborted { |
| 288 | + script { |
| 289 | + buildbadge.setStatus('aborted') |
| 290 | + } |
| 291 | + sh ''' |
| 292 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 293 | + curl --verbose\ |
| 294 | + --request POST \ |
| 295 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 296 | + --header "Content-Type: application/json" \ |
| 297 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 298 | + --data "{ |
| 299 | + \\"state\\": \\"error\\", |
| 300 | + \\"context\\": \\"jenkins-ctest-multigpu\\", |
| 301 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-multigpu\\", |
| 302 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-Multigpu/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 303 | + }" |
| 304 | + ''' |
| 305 | + } |
| 306 | + } |
| 307 | +} |
0 commit comments