forked from apt-sim/AdePT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
138 lines (129 loc) · 4.78 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//----------------------------------------------------------------------------------------------------------------------
// This declarative Jenkins pipeline encodes all the steps required for the nightly/continuous of a single platform.
// Other jobs may call this pipeline to execute the build, test and installation of a set platforms.
//
// Author: Pere Mato
// SPDX-FileCopyrightText: 2020 CERN
// SPDX-License-Identifier: Apache-2.0
//----------------------------------------------------------------------------------------------------------------------
pipeline {
parameters {
string(name: 'EXTERNALS', defaultValue: 'devAdePT/latest', description: 'LCG software stack in CVMFS')
choice(name: 'MODEL', choices: ['experimental', 'nightly', 'continuous'], description: 'CDash model')
choice(name: 'COMPILER', choices: ['gcc8', 'gcc10', 'clang10', 'native'])
choice(name: 'BUILDTYPE', choices: ['Release', 'Debug'])
string(name: 'LABEL', defaultValue: 'TeslaT4', description: 'Jenkins label for physical nodes or container image for docker')
string(name: 'ExtraCMakeOptions', defaultValue: '', description: 'CMake extra configuration options')
string(name: 'DOCKER_LABEL', defaultValue: 'docker-host-noafs', description: 'Label for the the nodes able to launch docker images')
string(name: 'ghprbPullAuthorLogin', description: 'Author of the Pull Request (provided by GitHub)')
string(name: 'ghprbPullId', description: 'Pull Request id (provided by GitHub)')
}
environment {
CMAKE_SOURCE_DIR = 'AdePT'
CMAKE_BINARY_DIR = 'build'
CMAKE_INSTALL_PREFIX = 'install'
}
agent none
stages {
//------------------------------------------------------------------------------------------------------------------
//---Build & Test stages--------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
stage('Environment'){
steps {
setJobName()
}
}
stage('InDocker') {
when {
beforeAgent true
expression { params.LABEL =~ 'centos|ubuntu' }
}
agent {
docker {
image "gitlab-registry.cern.ch/sft/docker/$LABEL"
label "$DOCKER_LABEL"
args """-v /cvmfs:/cvmfs
-v /ec:/ec
-e SHELL
-e ghprbPullAuthorLogin
-e ghprbPullId
--net=host
--hostname ${LABEL}-docker
"""
}
}
stages {
stage('Build&Test') {
steps {
buildAndTest()
}
post {
success {
deleteDir()
}
}
}
}
}
stage('InBareMetal') {
when {
beforeAgent true
expression { params.LABEL =~ 'cuda|physical|TeslaT4' }
}
agent {
label "$LABEL"
}
stages {
stage('PreCheckNode') {
steps {
preCheckNode()
}
}
stage('Build&Test') {
steps {
buildAndTest()
}
post {
success {
deleteDir()
}
}
}
}
}
}
}
//----------------------------------------------------------------------------------------------------------------------
//---Common Functions---------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
def CUDA_CAPABILITY = '75' // Default is 7.5
def setJobName() {
if (params.ghprbPullId) {
currentBuild.displayName = "#${BUILD_NUMBER}" + '-' + params.ghprbPullAuthorLogin + '#' + params.ghprbPullId + '-' + params.COMPILER + '-' + params.BUILDTYPE
}
else {
currentBuild.displayName = "#${BUILD_NUMBER}" + ' ' + params.COMPILER + '-' + params.BUILDTYPE
}
}
def preCheckNode() {
def deviceQuery = '/usr/local/cuda/extras/demo_suite/deviceQuery'
sh (script: '/usr/bin/nvidia-smi')
if (fileExists(deviceQuery)) {
dev_out = sh (script: deviceQuery, returnStdout: true)
CUDA_CAPABILITY = ( dev_out =~ 'CUDA Capability.*([0-9]+[.][0-9]+)')[0][1].replace('.','')
print('Cuda capability version is = ' + CUDA_CAPABILITY)
}
}
def buildAndTest() {
dir('AdePT') {
sh 'git submodule update --init'
}
sh label: 'build_and_test', script: """
set +x
source /cvmfs/sft.cern.ch/lcg/views/${EXTERNALS}/x86_64-centos7-${COMPILER}-opt/setup.sh
set -x
export CUDA_CAPABILITY=${CUDA_CAPABILITY}
env | sort | sed 's/:/:? /g' | tr '?' '\n'
ctest -V --output-on-failure -S AdePT/jenkins/adept-ctest.cmake,$MODEL
"""
}