Changes in / [692de479:396ee0a]
- Files:
-
- 3 edited
-
Jenkins/FullBuild (modified) (2 diffs)
-
Jenkinsfile (modified) (3 diffs)
-
src/benchmark/csv-data.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Jenkins/FullBuild
r692de479 r396ee0a 1 1 #!groovy 2 2 3 //===========================================================================================================4 // Main loop of the compilation5 //===========================================================================================================6 7 node ('master') {8 def err = null9 10 try {11 //Prevent the build from exceeding 30 minutes12 timeout(60) {13 14 //Wrap build to add timestamp to command line15 wrap([$class: 'TimestamperBuildWrapper']) {16 17 stage 'Build'18 19 results = [null, null]20 21 parallel (22 gcc_6_x64: { trigger_build( 'gcc-6', 'x64' ) },23 gcc_6_x86: { trigger_build( 'gcc-6', 'x86' ) },24 gcc_5_x64: { trigger_build( 'gcc-5', 'x64' ) },25 gcc_5_x86: { trigger_build( 'gcc-5', 'x86' ) },26 gcc_4_x64: { trigger_build( 'gcc-4', 'x64' ) },27 gcc_4_x86: { trigger_build( 'gcc-4', 'x86' ) },28 clang_x64: { trigger_build( 'clang', 'x64' ) },29 clang_x86: { trigger_build( 'clang', 'x86' ) },30 )31 32 //Push latest changes to do-lang repo33 push_build()34 }35 }36 }37 38 //If an exception is caught we need to change the status and remember to39 //attach the build log to the email40 catch (Exception caughtError) {41 echo('error caught')42 43 //rethrow error later44 err = caughtError45 46 //Store the result of the build log47 currentBuild.result = 'FAILURE'48 49 //Send email to notify the failure50 promote_failure_email()51 }52 53 finally {54 //Must re-throw exception to propagate error55 if (err) {56 throw err57 }58 }59 }60 3 //=========================================================================================================== 61 4 // Main compilation routines 62 5 //=========================================================================================================== 63 6 64 def trigger_build(String cc, Stringarch) {7 def trigger_build(String arch) { 65 8 def result = build job: 'Cforall/master', \ 66 9 parameters: [ \ 10 [$class: 'BooleanParameterValue', \ 11 name: 'isFullBuild', \ 12 value: true], \ 67 13 [$class: 'StringParameterValue', \ 68 name: 'pCompiler', \ 69 value: cc], \ 70 [$class: 'StringParameterValue', \ 71 name: 'pArchitecture', \ 72 value: arch], \ 73 [$class: 'BooleanParameterValue', \ 74 name: 'pRunAllTests', \ 75 value: true], \ 76 [$class: 'BooleanParameterValue', \ 77 name: 'pRunBenchmark', \ 78 value: true], \ 79 [$class: 'BooleanParameterValue', \ 80 name: 'pBuildDocumentation', \ 81 value: true], \ 82 [$class: 'BooleanParameterValue', \ 83 name: 'pPublish', \ 84 value: true], \ 85 [$class: 'BooleanParameterValue', \ 86 name: 'pSilent', \ 87 value: true], \ 14 name: 'buildArchitecture', \ 15 value: arch] \ 88 16 ], \ 89 17 propagate: false … … 141 69 142 70 //=========================================================================================================== 71 // Main loop of the compilation 72 //=========================================================================================================== 73 74 node ('master') { 75 def err = null 76 77 try { 78 //Prevent the build from exceeding 30 minutes 79 timeout(60) { 80 81 //Wrap build to add timestamp to command line 82 wrap([$class: 'TimestamperBuildWrapper']) { 83 84 stage 'Build' 85 86 results = [null, null] 87 88 parallel ( 89 x64: { 90 trigger_build('64-bit') 91 }, 92 x32: { 93 trigger_build('32-bit') 94 } 95 ) 96 97 //Push latest changes to do-lang repo 98 push_build() 99 } 100 } 101 } 102 103 //If an exception is caught we need to change the status and remember to 104 //attach the build log to the email 105 catch (Exception caughtError) { 106 echo('error caught') 107 108 //rethrow error later 109 err = caughtError 110 111 //Store the result of the build log 112 currentBuild.result = 'FAILURE' 113 114 //Send email to notify the failure 115 promote_failure_email() 116 } 117 118 finally { 119 //Must re-throw exception to propagate error 120 if (err) { 121 throw err 122 } 123 } 124 } 125 //=========================================================================================================== 143 126 //Routine responsible of sending the email notification once the build is completed 144 127 //=========================================================================================================== -
Jenkinsfile
r692de479 r396ee0a 2 2 3 3 //=========================================================================================================== 4 // Main compilation routines 5 //=========================================================================================================== 6 //Compilation script is done here but environnement set-up and error handling is done in main loop 7 def cfa_build(boolean full_build, String flags) { 8 build_stage 'Checkout' 9 def install_dir = pwd tmp: true 10 //checkout the source code and clean the repo 11 checkout scm 12 13 //Clean all temporary files to make sure no artifacts of the previous build remain 14 sh 'git clean -fdqx' 15 16 //Reset the git repo so no local changes persist 17 sh 'git reset --hard' 18 19 build_stage 'Build' 20 21 //Configure the conpilation (Output is not relevant) 22 //Use the current directory as the installation target so nothing 23 //escapes the sandbox 24 //Also specify the compiler by hand 25 sh "./configure CXX=${currentCC.cpp_cc} ${flags} --with-backend-compiler=${currentCC.cfa_backend_cc} --prefix=${install_dir} --enable-silent-rules --quiet" 26 27 //Compile the project 28 sh 'make -j 8 --no-print-directory V=0 install' 29 30 build_stage 'Test' 31 32 //Run the tests from the tests directory 33 if (full_build) { 34 sh 'make -C src/tests all-tests debug=yes' 35 sh 'make -C src/tests all-tests debug=no' 36 } 37 else { 38 sh 'make -C src/tests' 39 } 40 41 build_stage 'Cleanup' 42 43 //do a maintainer-clean to make sure we need to remake from scratch 44 sh 'make maintainer-clean > /dev/null' 45 } 46 47 def make_doc() { 48 def err = null 49 50 try { 51 sh 'make clean > /dev/null' 52 sh 'make > /dev/null 2>&1' 53 } 54 55 catch (Exception caughtError) { 56 //rethrow error later 57 err = caughtError 58 59 sh 'cat *.log' 60 } 61 62 finally { 63 /* Must re-throw exception to propagate error */ 64 if (err) { 65 throw err 66 } 67 } 68 } 69 70 def doc_build() { 71 stage 'Documentation' 72 73 status_prefix = 'Documentation' 74 75 dir ('doc/user') { 76 make_doc() 77 } 78 79 dir ('doc/refrat') { 80 make_doc() 81 } 82 } 83 84 def benchmark() { 85 stage 'Benchmark' 86 87 status_prefix = 'Documentation' 88 89 // //We can't just write to a file outside our repo 90 // //Copy the file locally using ssh 91 // sh 'scp plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv bench.csv' 92 93 // //Then append to the local file 94 // sh 'make -C src/benchmark csv-data >> bench.csv' 95 96 // //Then publish the file again 97 // sh 'scp bench.csv plg2.cs.uwaterloo.ca:/u/cforall/public_html/perf-history/concurrency.csv' 98 } 99 100 //=========================================================================================================== 101 // Helper classes/variables/routines to make the status and stage name easier to use 102 //=========================================================================================================== 103 //Description of a compiler (Must be serializable since pipelines are persistent) 104 class CC_Desc implements Serializable { 105 public String cc_name 106 public String cpp_cc 107 public String cfa_backend_cc 108 109 CC_Desc(String cc_name, String cpp_cc, String cfa_backend_cc) { 110 this.cc_name = cc_name 111 this.cpp_cc = cpp_cc 112 this.cfa_backend_cc = cfa_backend_cc 113 } 114 } 115 116 //Global Variables defining the compiler and at which point in the build we are 117 // These variables are used but can't be declared before hand because of wierd scripting rules 118 // @Field String currentCC 119 // @Field String status_prefix 120 121 //Wrapper to sync stage name and status name 122 def build_stage(String name) { 123 def stage_name = "${currentCC.cc_name} ${name}".trim() 124 stage stage_name 125 126 status_prefix = stage_name 127 } 128 129 //Helper routine to collect information about the git history 130 def collect_git_info() { 131 132 //create the temporary output directory in case it doesn't already exist 133 def out_dir = pwd tmp: true 134 sh "mkdir -p ${out_dir}" 135 136 //parse git logs to find what changed 137 gitRefName = env.BRANCH_NAME 138 dir("../${gitRefName}@script") { 139 sh "git reflog > ${out_dir}/GIT_COMMIT" 140 } 141 git_reflog = readFile("${out_dir}/GIT_COMMIT") 142 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1] 143 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2] 144 } 145 146 //=========================================================================================================== 4 147 // Main loop of the compilation 5 148 //=========================================================================================================== 6 149 node ('master'){ 7 150 8 boolean bIs Sandbox = env.BRANCH_NAME == "jenkins-sandbox"151 boolean bIsFullBuild 9 152 def err = null 10 153 def log_needed = false 11 12 compiler = null13 architecture = ''14 15 do_alltests = false16 do_benchmark = false17 do_doc = false18 do_publish = false19 do_sendemail = true20 21 154 currentBuild.result = "SUCCESS" 155 status_prefix = '' 22 156 23 157 try { 24 //Wrap build to add timestamp to command line 25 wrap([$class: 'TimestamperBuildWrapper']) { 26 27 //Prevent the build from exceeding 60 minutes 28 timeout(60) { 29 30 notify_server() 31 32 prepare_build() 33 34 checkout() 35 36 build() 37 38 test() 39 158 //Prevent the build from exceeding 30 minutes 159 timeout(60) { 160 161 //Wrap build to add timestamp to command line 162 wrap([$class: 'TimestamperBuildWrapper']) { 163 164 collect_git_info() 165 166 properties ([ \ 167 [$class: 'ParametersDefinitionProperty', \ 168 parameterDefinitions: [ \ 169 [$class: 'BooleanParameterDefinition', \ 170 defaultValue: false, \ 171 description: 'If true, the build will be promoted to the do-lang git repository (on successful builds only)', \ 172 name: 'isFullBuild' \ 173 ], \ 174 [$class: 'ChoiceParameterDefinition', \ 175 choices: '64-bit\n32-bit', \ 176 defaultValue: '64-bit', \ 177 description: 'The architecture to use for compilation', \ 178 name: 'buildArchitecture' \ 179 ]] \ 180 ]]) 181 182 bIsSandbox = env.BRANCH_NAME == "jenkins-sandbox" 183 bIsFullBuild = isFullBuild == 'true' 184 architectureFlag = '' 185 if (buildArchitecture == '64-bit') { 186 architectureFlag = '--host=x86_64 CXXFLAGS="-m64" CFAFLAGS="-m64"' 187 } else if (buildArchitecture == '32-bit'){ 188 architectureFlag = '--host=i386 CXXFLAGS="-m32" CFAFLAGS="-m32"' 189 } else { 190 architectureFlag = 'ERROR' 191 } 192 193 echo "FULL BUILD = ${isFullBuild}\nArchitecture = ${buildArchitecture} (flag ${architectureFlag})" 194 195 //Compile using gcc-4.9 196 currentCC = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9') 197 cfa_build(bIsFullBuild, architectureFlag) 198 199 //Compile latex documentation 200 doc_build() 201 202 //Run benchmark and save result 40 203 benchmark() 41 204 42 clean() 43 44 build_doc() 45 46 publish() 47 48 notify_server() 205 if( bIsFullBuild ) { 206 //Compile using gcc-5 207 currentCC = new CC_Desc('gcc-5', 'g++-5', 'gcc-5') 208 cfa_build(true, architectureFlag) 209 210 //Compile using gcc-4.9 211 currentCC = new CC_Desc('gcc-6', 'g++-6', 'gcc-6') 212 cfa_build(true, architectureFlag) 213 } 49 214 } 50 215 } … … 68 233 69 234 //Send email with final results if this is not a full build 70 if( ! do_sendemail&& !bIsSandbox ) {235 if( !bIsFullBuild && !bIsSandbox ) { 71 236 echo 'Notifying users of result' 72 237 email(currentBuild.result, log_needed) … … 78 243 } 79 244 } 80 }81 82 //===========================================================================================================83 // Helper classes/variables/routines84 //===========================================================================================================85 //Helper routine to collect information about the git history86 def collect_git_info() {87 88 //create the temporary output directory in case it doesn't already exist89 def out_dir = pwd tmp: true90 sh "mkdir -p ${out_dir}"91 92 //parse git logs to find what changed93 gitRefName = env.BRANCH_NAME94 dir("../${gitRefName}@script") {95 sh "git reflog > ${out_dir}/GIT_COMMIT"96 }97 git_reflog = readFile("${out_dir}/GIT_COMMIT")98 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]99 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]100 }101 102 def prepare_build() {103 properties ([ \104 [$class: 'ParametersDefinitionProperty', \105 parameterDefinitions: [ \106 [$class: 'ChoiceParameterDefinition', \107 description: 'Which compiler to use', \108 name: 'pCompiler', \109 choices: 'gcc-6\ngcc-5\ngcc-4.9\nclang', \110 defaultValue: 'gcc-6', \111 ], \112 [$class: 'ChoiceParameterDefinition', \113 description: 'The target architecture', \114 name: 'pArchitecture', \115 choices: 'x64\nx86', \116 defaultValue: 'x64', \117 ], \118 [$class: 'BooleanParameterDefinition', \119 description: 'If false, only the quick test suite is ran', \120 name: 'pRunAllTests', \121 defaultValue: false, \122 ], \123 [$class: 'BooleanParameterDefinition', \124 description: 'If true, jenkins also runs benchmarks', \125 name: 'pRunBenchmark', \126 defaultValue: true, \127 ], \128 [$class: 'BooleanParameterDefinition', \129 description: 'If true, jenkins also builds documentation', \130 name: 'pBuildDocumentation', \131 defaultValue: true, \132 ], \133 [$class: 'BooleanParameterDefinition', \134 description: 'If true, jenkins also publishes results', \135 name: 'pPublish', \136 defaultValue: true, \137 ], \138 [$class: 'BooleanParameterDefinition', \139 description: 'If true, jenkins will not send emails', \140 name: 'pSilent', \141 defaultValue: false, \142 ], \143 ],144 ]])145 146 compiler = compiler_from_params( pCompiler )147 architecture = architecture_from_params( pArchitecture )148 149 do_alltests = (pRunAllTests == 'true')150 do_benchmark = (pRunBenchmark == 'true')151 do_doc = (pBuildDocumentation == 'true')152 do_publish = (pPublish == 'true')153 do_sendemail = ! (pSilent == 'true')154 155 echo """Compiler : ${compiler.cc_name} (${compiler.cpp_cc}/${compiler.cfa_cc})156 Architecture : ${architecture}157 Run All Tests : ${ pRunAllTests.toString() }158 Run Benchmark : ${ pRunBenchmark.toString() }159 Build Documentation : ${ pBuildDocumentation.toString() }160 Publish : ${ pPublish.toString() }161 Silent : ${ pSilent.toString() }162 """163 164 collect_git_info()165 }166 167 def notify_server() {168 sh 'curl --silent -X POST http://plg2:8082/jenkins/notify > /dev/null'169 return170 }171 172 def make_doc() {173 def err = null174 try {175 sh 'make clean > /dev/null'176 sh 'make > /dev/null 2>&1'177 }178 catch (Exception caughtError) {179 err = caughtError //rethrow error later180 sh 'cat *.log'181 }182 finally {183 if (err) throw err // Must re-throw exception to propagate error184 }185 }186 187 //Description of a compiler (Must be serializable since pipelines are persistent)188 class CC_Desc implements Serializable {189 public String cc_name190 public String cpp_cc191 public String cfa_cc192 193 CC_Desc(String cc_name, String cpp_cc, String cfa_cc) {194 this.cc_name = cc_name195 this.cpp_cc = cpp_cc196 this.cfa_cc = cfa_cc197 }198 }199 200 def compiler_from_params(cc) {201 switch( cc ) {202 case 'gcc-6':203 return new CC_Desc('gcc-6', 'g++-6', 'gcc-6')204 break205 case 'gcc-5':206 return new CC_Desc('gcc-5', 'g++-5', 'gcc-5')207 break208 case 'gcc-4.9':209 return new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9')210 break211 case 'clang':212 return new CC_Desc('clang', 'clang++', 'gcc-6')213 break214 default :215 error "Unhandled compiler : ${cc}"216 }217 }218 219 def architecture_from_params( arch ) {220 switch( arch ) {221 case 'x64':222 return '--host=x86_64 CXXFLAGS="-m64" CFAFLAGS="-m64"'223 break224 case 'x86':225 return '--host=i386 CXXFLAGS="-m32" CFAFLAGS="-m32"'226 break227 default :228 error "Unhandled architecture : ${arch}"229 }230 }231 232 //===========================================================================================================233 // Main compilation routines234 //===========================================================================================================235 //Compilation script is done here but environnement set-up and error handling is done in main loop236 def checkout() {237 stage 'Checkout'238 //checkout the source code and clean the repo239 checkout scm240 241 //Clean all temporary files to make sure no artifacts of the previous build remain242 sh 'git clean -fdqx'243 244 //Reset the git repo so no local changes persist245 sh 'git reset --hard'246 }247 248 def build() {249 stage 'Build'250 251 def install_dir = pwd tmp: true252 253 //Configure the conpilation (Output is not relevant)254 //Use the current directory as the installation target so nothing255 //escapes the sandbox256 //Also specify the compiler by hand257 sh "./configure CXX=${compiler.cpp_cc} ${architecture} --with-backend-compiler=${compiler.cfa_cc} --prefix=${install_dir} --enable-silent-rules --quiet"258 259 //Compile the project260 sh 'make -j 8 --no-print-directory V=0 install'261 }262 263 def test() {264 stage 'Test'265 266 //Run the tests from the tests directory267 if ( do_alltests ) {268 sh 'make -C src/tests all-tests debug=yes'269 sh 'make -C src/tests all-tests debug=no'270 }271 else {272 sh 'make -C src/tests'273 }274 }275 276 def benchmark() {277 stage 'Benchmark'278 279 if( !do_benchmark ) return280 281 //Write the commit id to Benchmark282 writeFile file: 'bench.csv', text:'data=' + gitRefNewValue + ','283 284 //Append bench results285 sh 'make -C src/benchmark --no-print-directory csv-data >> bench.csv'286 }287 288 def clean() {289 stage 'Cleanup'290 291 //do a maintainer-clean to make sure we need to remake from scratch292 sh 'make maintainer-clean > /dev/null'293 }294 295 def build_doc() {296 stage 'Documentation'297 298 if( !do_doc ) return299 300 dir ('doc/user') {301 make_doc()302 }303 304 dir ('doc/refrat') {305 make_doc()306 }307 }308 309 def publish() {310 stage 'Publish'311 312 if( !do_publish ) return313 314 //Then publish the results315 sh 'curl --silent --data @bench.csv http://plg2:8082/jenkins/publish > /dev/null'316 245 } 317 246 -
src/benchmark/csv-data.c
r692de479 r396ee0a 84 84 int main() 85 85 { 86 sout | time(NULL) | ',' | measure_coroutine() | ','| measure_thread() | endl;86 sout | time(NULL) | "," | measure_coroutine() | "," | measure_thread() | endl; 87 87 }
Note:
See TracChangeset
for help on using the changeset viewer.