|
| 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 'sgs_amd_gpu_node' } |
| 23 | + |
| 24 | + options { |
| 25 | + buildDiscarder( |
| 26 | + logRotator( |
| 27 | + daysToKeepStr: "21", |
| 28 | + numToKeepStr: "50", |
| 29 | + artifactDaysToKeepStr: "21", |
| 30 | + artifactNumToKeepStr: "50" |
| 31 | + ) |
| 32 | + ) |
| 33 | + disableConcurrentBuilds() |
| 34 | + } |
| 35 | + |
| 36 | + triggers { |
| 37 | + githubPush() // Trigger by push to respective github branch |
| 38 | + pollSCM 'H/30 * * * *' // Fallback polling solution as some pushes are somehow lost |
| 39 | + } |
| 40 | + |
| 41 | + environment { |
| 42 | + GITHUB_TOKEN = credentials('GITHUB_TOKEN') |
| 43 | + BRANCH_NAME = "${env.BRANCH_NAME}" |
| 44 | + } |
| 45 | + |
| 46 | + stages { |
| 47 | + stage('init') { |
| 48 | + steps { |
| 49 | + dir('plssvm') { |
| 50 | + sh ''' |
| 51 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 52 | + curl --verbose\ |
| 53 | + --request POST \ |
| 54 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 55 | + --header "Content-Type: application/json" \ |
| 56 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 57 | + --data "{ |
| 58 | + \\"state\\": \\"pending\\", |
| 59 | + \\"context\\": \\"jenkins-ctest-amd\\", |
| 60 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\", |
| 61 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 62 | + }" |
| 63 | + ''' |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | + stage('checkout') { |
| 68 | + steps { |
| 69 | + dir('plssvm') { |
| 70 | + checkout scm |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + stage('setup python'){ |
| 75 | + steps{ |
| 76 | + sh ''' |
| 77 | + /usr/bin/python3.8 -m pip install --user arff |
| 78 | + /usr/bin/python3.8 -m pip install --user pandas |
| 79 | + /usr/bin/python3.8 -m pip install --user sklearn |
| 80 | + /usr/bin/python3.8 -m pip install --user argparse |
| 81 | + ''' |
| 82 | + } |
| 83 | + } |
| 84 | + stage('build plssvm Release') { |
| 85 | + steps { |
| 86 | + dir('plssvm') { |
| 87 | + sh ''' |
| 88 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 89 | + module use /home/breyerml/.modulefiles/ |
| 90 | + module load plssvm/pcsgs09/hip |
| 91 | + module load plssvm/pcsgs09/dpcpp |
| 92 | + module load cmake-3.22.2-gcc-9.3.0-wi6mnc2 |
| 93 | + mkdir -p build/Release |
| 94 | + cd build/Release |
| 95 | + rm -rf * |
| 96 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_HIP_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON -DPLSSVM_ENABLE_SYCL_BACKEND=OFF ../../ |
| 97 | + make -j4 |
| 98 | + ''' |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + stage('run tests Release') { |
| 103 | + steps { |
| 104 | + dir('plssvm') { |
| 105 | + warnError('Release tests failed!') { |
| 106 | + sh ''' |
| 107 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 108 | + module use /home/breyerml/.modulefiles/ |
| 109 | + module load plssvm/pcsgs09/hip |
| 110 | + module load plssvm/pcsgs09/dpcpp |
| 111 | + cd build/Release |
| 112 | + ctest -j4 --no-compress-output -T Test |
| 113 | + ''' |
| 114 | + } |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | + stage('build plssvm hipSYCL Release') { |
| 119 | + steps { |
| 120 | + dir('plssvm') { |
| 121 | + sh ''' |
| 122 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 123 | + module use /home/breyerml/.modulefiles/ |
| 124 | + module load plssvm/pcsgs09/hipsycl |
| 125 | + module load cmake-3.22.2-gcc-9.3.0-wi6mnc2 |
| 126 | + mkdir -p build/Release_hip |
| 127 | + cd build/Release_hip |
| 128 | + rm -rf * |
| 129 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_HIP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON ../../ |
| 130 | + make -j4 |
| 131 | + ''' |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + stage('run tests hipSYCL Release') { |
| 136 | + steps { |
| 137 | + dir('plssvm') { |
| 138 | + warnError('hipSYCL Release tests failed!') { |
| 139 | + sh ''' |
| 140 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 141 | + module use /home/breyerml/.modulefiles/ |
| 142 | + module load plssvm/pcsgs09/hipsycl |
| 143 | + cd build/Release_hip |
| 144 | + ctest -j4 --no-compress-output -T Test |
| 145 | + ''' |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | + } |
| 150 | + stage('build plssvm DPC++ Release') { |
| 151 | + steps { |
| 152 | + dir('plssvm') { |
| 153 | + sh ''' |
| 154 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 155 | + module use /home/breyerml/.modulefiles/ |
| 156 | + module load plssvm/pcsgs09/dpcpp |
| 157 | + module load cmake-3.22.2-gcc-9.3.0-wi6mnc2 |
| 158 | + mkdir -p build/Release_dpcpp |
| 159 | + cd build/Release_dpcpp |
| 160 | + rm -rf * |
| 161 | + cmake -DCMAKE_BUILD_TYPE=Release -DPLSSVM_TARGET_PLATFORMS="amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_HIP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON -DPLSSVM_ENABLE_ASSERTS=ON ../../ |
| 162 | + make -j4 |
| 163 | + ''' |
| 164 | + } |
| 165 | + } |
| 166 | + } |
| 167 | + stage('run tests DPC++ Release') { |
| 168 | + steps { |
| 169 | + dir('plssvm') { |
| 170 | + warnError('DPC++ Release tests failed!') { |
| 171 | + sh ''' |
| 172 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 173 | + module use /home/breyerml/.modulefiles/ |
| 174 | + module load plssvm/pcsgs09/dpcpp |
| 175 | + cd build/Release_dpcpp |
| 176 | + ctest -j4 --no-compress-output -T Test |
| 177 | + ''' |
| 178 | + } |
| 179 | + } |
| 180 | + } |
| 181 | + } |
| 182 | + stage('build plssvm Debug') { |
| 183 | + steps { |
| 184 | + dir('plssvm') { |
| 185 | + sh ''' |
| 186 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 187 | + module use /home/breyerml/.modulefiles/ |
| 188 | + module load plssvm/pcsgs09/hip |
| 189 | + module load plssvm/pcsgs09/dpcpp |
| 190 | + module load cmake-3.22.2-gcc-9.3.0-wi6mnc2 |
| 191 | + mkdir -p build/Debug_cov |
| 192 | + cd build/Debug_cov |
| 193 | + rm -rf * |
| 194 | + cmake -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_SYCL_BACKEND=OFF ../../ |
| 195 | + make -j4 |
| 196 | + ''' |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | + stage('build plssvm hipSYCL Debug') { |
| 201 | + steps { |
| 202 | + dir('plssvm') { |
| 203 | + sh ''' |
| 204 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 205 | + module use /home/breyerml/.modulefiles/ |
| 206 | + module load plssvm/pcsgs09/hipsycl |
| 207 | + module load cmake-3.22.2-gcc-9.3.0-wi6mnc2 |
| 208 | + mkdir -p build/Debug_hip |
| 209 | + cd build/Debug_hip |
| 210 | + rm -rf * |
| 211 | + cmake -DCMAKE_BUILD_TYPE=Debug -DPLSSVM_TARGET_PLATFORMS="cpu:avx2;amd:gfx906" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=OFF -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON ../../ |
| 212 | + make -j4 |
| 213 | + ''' |
| 214 | + } |
| 215 | + } |
| 216 | + } |
| 217 | +/* |
| 218 | + stage('build plssvm DPC++ Debug') { |
| 219 | + steps { |
| 220 | + dir('plssvm') { |
| 221 | + sh ''' |
| 222 | + source /import/sgs.local/scratch/breyerml/spack/share/spack/setup-env.sh |
| 223 | + module use /home/breyerml/.modulefiles/ |
| 224 | + module load plssvm/pcsgs09/dpcpp |
| 225 | + mkdir -p build/Debug_dpcpp |
| 226 | + cd build/Debug_dpcpp |
| 227 | + rm -rf * |
| 228 | + cmake -DCMAKE_BUILD_TYPE=Debug -DPLSSVM_TARGET_PLATFORMS="nvidia:sm_80" -DCMAKE_CXX_COMPILER=clang++ -DPLSSVM_ENABLE_OPENMP_BACKEND=OFF -DPLSSVM_ENABLE_CUDA_BACKEND=ON -DPLSSVM_ENABLE_OPENCL_BACKEND=OFF -DPLSSVM_ENABLE_SYCL_BACKEND=ON ../../ |
| 229 | + make -j4 |
| 230 | + ''' |
| 231 | + } |
| 232 | + } |
| 233 | + } |
| 234 | +*/ |
| 235 | + } |
| 236 | + post { |
| 237 | + always { |
| 238 | + // Process the CTest xml output with the xUnit plugin |
| 239 | + xunit ( |
| 240 | + testTimeMargin: '3000', |
| 241 | + thresholdMode: 1, |
| 242 | + thresholds: [ |
| 243 | + skipped(failureThreshold: '0'), |
| 244 | + failed(failureThreshold: '0') |
| 245 | + ], |
| 246 | + tools: [CTest( |
| 247 | + pattern: 'plssvm/build/*/Testing/**/*.xml', |
| 248 | + deleteOutputFiles: true, |
| 249 | + failIfNotNew: false, |
| 250 | + skipNoTestFiles: true, |
| 251 | + stopProcessingIfError: true |
| 252 | + )] |
| 253 | + ) |
| 254 | + |
| 255 | + } |
| 256 | + success { |
| 257 | + script { |
| 258 | + buildbadge.setStatus('success') |
| 259 | + } |
| 260 | + sh ''' |
| 261 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 262 | + curl --verbose\ |
| 263 | + --request POST \ |
| 264 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 265 | + --header "Content-Type: application/json" \ |
| 266 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 267 | + --data "{ |
| 268 | + \\"state\\": \\"success\\", |
| 269 | + \\"context\\": \\"jenkins-ctest-amd\\", |
| 270 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\", |
| 271 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 272 | + }" |
| 273 | + ''' |
| 274 | + } |
| 275 | + failure { |
| 276 | + script { |
| 277 | + buildbadge.setStatus('failing') |
| 278 | + } |
| 279 | + sh ''' |
| 280 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 281 | + curl --verbose\ |
| 282 | + --request POST \ |
| 283 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 284 | + --header "Content-Type: application/json" \ |
| 285 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 286 | + --data "{ |
| 287 | + \\"state\\": \\"failure\\", |
| 288 | + \\"context\\": \\"jenkins-ctest-amd\\", |
| 289 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\", |
| 290 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 291 | + }" |
| 292 | + ''' |
| 293 | + } |
| 294 | + aborted { |
| 295 | + script { |
| 296 | + buildbadge.setStatus('aborted') |
| 297 | + } |
| 298 | + sh ''' |
| 299 | + gitlab_token=$(echo ${GITHUB_TOKEN} | cut -f2 -d':') |
| 300 | + curl --verbose\ |
| 301 | + --request POST \ |
| 302 | + --url "https://api.github.com/repos/SC-SGS/PLSSVM/statuses/$GIT_COMMIT" \ |
| 303 | + --header "Content-Type: application/json" \ |
| 304 | + --header "authorization: Bearer ${gitlab_token}" \ |
| 305 | + --data "{ |
| 306 | + \\"state\\": \\"error\\", |
| 307 | + \\"context\\": \\"jenkins-ctest-amd\\", |
| 308 | + \\"description\\": \\"Jenkins CI Job: jenkins-ctest-amd\\", |
| 309 | + \\"target_url\\": \\"https://simsgs.informatik.uni-stuttgart.de/jenkins/view/PLSSVM/job/PLSSVM/job/Github-AMD/job/${BRANCH_NAME}/$BUILD_NUMBER\\" |
| 310 | + }" |
| 311 | + ''' |
| 312 | + } |
| 313 | + } |
| 314 | +} |
0 commit comments