diff --git a/.github/workflows/README.md b/.github/workflows/README.md index ff2dedc0d913..6e5c4df6c220 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -20,15 +20,12 @@ locmap --enable cvmfs locmap --configure all ``` -## Docker +## Singularity/Apptainer -``` -yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo -dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin - -usermod -aG docker runner +Run `cmssw-xxx` commands from `/cvmfs/cms.cern.ch/common`. -systemctl enable --now docker.service +``` +dnf install apptainer ``` ## Gitlab runner diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 868ad513321a..f0fdae9bef04 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,14 +30,23 @@ jobs: strategy: matrix: proc: [hvq] - cmssw_release: [CMSSW_10_6_30, CMSSW_11_0_1, CMSSW_12_3_1] + cmssw_release: [CMSSW_10_6_30, CMSSW_11_0_1, CMSSW_12_3_1, CMSSW_13_0_13, CMSSW_13_3_0] include: - cmssw_release: CMSSW_10_6_30 scram_arch: slc7_amd64_gcc700 + os: cc7 - cmssw_release: CMSSW_11_0_1 scram_arch: slc7_amd64_gcc820 + os: cc7 - cmssw_release: CMSSW_12_3_1 scram_arch: slc7_amd64_gcc10 + os: cc7 + - cmssw_release: CMSSW_13_0_13 + scram_arch: el8_amd64_gcc11 + os: el8 + - cmssw_release: CMSSW_13_3_0 + scram_arch: el8_amd64_gcc12 + os: el8 fail-fast: false # The type of runner that the job will run on runs-on: [self-hosted, linux, x64] @@ -51,8 +60,8 @@ jobs: rm -rf ./.??* || true ls -la ./ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -62,19 +71,19 @@ jobs: - '.github/workflows/**' - name: Build gridpack if: steps.filter.outputs.powheg1 == 'true' || steps.filter.outputs.workflow == 'true' - uses: nick-fields/retry@v2 + uses: nick-fields/retry@v3 with: max_attempts: 5 timeout_minutes: 60 retry_on_exit_code: 111 # failed CMSSW setup, likely due to cvmfs connectivity - command: docker run --rm -v /cvmfs:/cvmfs -v $PWD:$PWD -w $PWD gitlab-registry.cern.ch/cms-cloud/cmssw-docker/cc7-cms bash bin/Powheg/test/test_build.sh -r ${{ matrix.cmssw_release }} -a ${{ matrix.scram_arch }} -p ${{ matrix.proc }} + command: /cvmfs/cms.cern.ch/common/cmssw-${{ matrix.os }} -- bash bin/Powheg/test/test_build.sh -r ${{ matrix.cmssw_release }} -a ${{ matrix.scram_arch }} -p ${{ matrix.proc }} - name: Check pwg-stat.dat if: steps.filter.outputs.powheg1 == 'true' || steps.filter.outputs.workflow == 'true' run: git diff --exit-code bin/Powheg/test/pwg-stat.dat.${{ matrix.proc }}_${{ matrix.scram_arch }}_${{ matrix.cmssw_release }} - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: commit-message: Automated addition ${{ matrix.proc }}_${{ matrix.scram_arch }}_${{ matrix.cmssw_release }} branch: create-pull-request/${{ matrix.proc }}_${{ matrix.scram_arch }}_${{ matrix.cmssw_release }} @@ -98,8 +107,8 @@ jobs: rm -rf ./.??* || true ls -la ./ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | diff --git a/bin/Powheg/Templates/createTarBall_template.sh b/bin/Powheg/Templates/createTarBall_template.sh index f2e243c83f2a..17b71fb61b3d 100644 --- a/bin/Powheg/Templates/createTarBall_template.sh +++ b/bin/Powheg/Templates/createTarBall_template.sh @@ -152,15 +152,15 @@ fi if [ $$keepTop == '1' ]; then echo 'Keeping validation plots.' echo 'Packing...' $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' - tar zcf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' * --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* $$exclude_extra + tar --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* $$exclude_extra -zcf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' * else if [ $$process == 'WWJ' ]; then echo 'Preparing WWJ gridpack' echo 'Packing...' $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tar.xz' - tar -cJpsf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tar.xz' * --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.top --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* + tar --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.top --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* -cJpsf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tar.xz' * else echo 'Packing...' $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' - tar zcf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' * --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.top --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* $$exclude_extra + tar --exclude=POWHEG-BOX --exclude=powhegbox*.tar.gz --exclude=*.top --exclude=*.lhe --exclude=run_*.sh --exclude=*temp --exclude=pwgbtlupb-*.dat --exclude=pwgrmupb-*.dat --exclude=run_*.out --exclude=run_*.err --exclude=run_*.log --exclude=minlo-run --exclude=dynnlo* $$exclude_extra -zcf $${WORKDIR}'/'$${process}'_'$${SCRAM_ARCH}'_'$${CMSSW_VERSION}'_'$${folderName}'.tgz' * fi fi diff --git a/bin/Powheg/Templates/runGetSource_template.sh b/bin/Powheg/Templates/runGetSource_template.sh index f10416915e10..c18048a8ad6d 100644 --- a/bin/Powheg/Templates/runGetSource_template.sh +++ b/bin/Powheg/Templates/runGetSource_template.sh @@ -49,7 +49,7 @@ grep -q "MGcosa" powheg.input; test $$? -eq 1 || forX0jj=1 cd $$WORKDIR cd $${name} -python ../make_rwl.py $${is5FlavorScheme} $${defaultPDF} $${forMiNNLO} $${forX0jj} $${period} +python3 ../make_rwl.py $${is5FlavorScheme} $${defaultPDF} $${forMiNNLO} $${forX0jj} $${period} if [ -s ../JHUGen.input ]; then cp -p ../JHUGen.input JHUGen.input diff --git a/bin/Powheg/dag_wrapper.sh b/bin/Powheg/dag_wrapper.sh new file mode 100644 index 000000000000..7837ff9f9cd8 --- /dev/null +++ b/bin/Powheg/dag_wrapper.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# cannot submit condor DAG from within CMSSW environment +eval `scram unsetenv -sh` +condor_submit_dag $1 diff --git a/bin/Powheg/make_rwl.py b/bin/Powheg/make_rwl.py index f58e28d6dfb0..9ca80385c978 100644 --- a/bin/Powheg/make_rwl.py +++ b/bin/Powheg/make_rwl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Script for POWHEG weighting calculation @@ -11,8 +11,8 @@ if len(sys.argv) < 3: print(""" ERROR: Please specify if the Flavor scheme for which you want to define the weights is 5F (1) or 4F (0), and the central PDF -Example of usage for 5F: python make_rwl.py 1 325300 -Example of usage for 4F: python make_rwl.py 0 325500 +Example of usage for 5F: python3 make_rwl.py 1 325300 +Example of usage for 4F: python3 make_rwl.py 0 325500 """) sys.exit(1) diff --git a/bin/Powheg/run_pwg_condor.py b/bin/Powheg/run_pwg_condor.py index 4071c1f4dab0..0dd20f8a0dd8 100755 --- a/bin/Powheg/run_pwg_condor.py +++ b/bin/Powheg/run_pwg_condor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Script for POWHEG generator production @@ -6,7 +6,7 @@ Based on Yuan Chao's script ''' -import commands +import subprocess import fileinput import argparse import sys @@ -23,7 +23,14 @@ rootfolder = os.getcwd() - +scram_arch = os.environ['SCRAM_ARCH'] +scram_os = scram_arch.split('_')[0] +want_os = { # https://batchdocs.web.cern.ch/local/submit.html#os-selection-via-containers + 'slc6': 'el7', + 'slc7': 'el7', + 'el8': 'el8', + 'el9': 'el9', +} def runCommand(command, printIt = False, doIt = 1) : if args.fordag and 'condor_submit' in command: @@ -32,21 +39,18 @@ def runCommand(command, printIt = False, doIt = 1) : if TESTING : printIt = 1 doIt = 0 - if printIt : print ('> ' + command) + if printIt : print(('> ' + command)) if doIt : - commandOutput = commands.getstatusoutput(command) - if printIt : print commandOutput[1] + commandOutput = subprocess.getstatusoutput(command) + if printIt : print(commandOutput[1]) return commandOutput[0] else : print (' jobs not submitted') return 1 # ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -def prepareCondorScript( tag, i, folderName, queue, SCALE = '0', njobs = 0, runInBatchDir = False, slc6 = 0): +def prepareCondorScript( tag, i, folderName, queue, SCALE = '0', njobs = 0, runInBatchDir = False): '''prepare the Condor submission script''' - - if (slc6): - print('Preparing to run in slc6 using singularity') filename = 'run_' + folderName + '_' + tag + '.condorConf' execname = 'run_' + tag @@ -58,7 +62,8 @@ def prepareCondorScript( tag, i, folderName, queue, SCALE = '0', njobs = 0, runI f = open(filename, 'w') if (i == 'multiple') : - if (slc6) : + if (scram_os == 'slc6') : + print('Preparing to run in slc6 using singularity') f.write('executable = %s/slc6wrapper.sh \n' % rootfolder) f.write('arguments = ' + execname + '_$(ProcId).sh \n') else: @@ -76,7 +81,7 @@ def prepareCondorScript( tag, i, folderName, queue, SCALE = '0', njobs = 0, runI f.write('initialdir = ' + rootfolder + '/' + folderName + '\n') f.write('+JobFlavour = "'+ queue +'" \n') - + f.write('MY.WantOS = "%s" \n' % want_os[scram_os]) f.write('periodic_remove = JobStatus == 5 \n') f.write('WhenToTransferOutput = ON_EXIT_OR_EVICT \n') f.write('transfer_output_files = "" \n') @@ -142,7 +147,7 @@ def prepareJobForEvents (tag, i, folderName, EOSfolder) : def runParallelXgrid(parstage, xgrid, folderName, nEvents, njobs, powInputName, jobtag, rndSeed, process) : # parstage, xgrid are strings! - print 'Running parallel jobs for grid' + print('Running parallel jobs for grid') #print folderName inputName = folderName + "/powheg.input" @@ -150,7 +155,7 @@ def runParallelXgrid(parstage, xgrid, folderName, nEvents, njobs, powInputName, sedcommand = 'sed -i "s/NEVENTS/'+nEvents+'/ ; s/SEED/'+rndSeed+'/ ; s/.*parallelstage.*/parallelstage '+parstage+'/ ; s/.*xgriditeration.*/xgriditeration '+xgrid+'/ ; s/.*manyseeds.*/manyseeds 1/ ; s/fakevirt.*// " '+inputName with open(os.path.join(folderName, "pwgseeds.dat"), "w") as f: - for i in xrange(njobs): + for i in range(njobs): f.write(str(int(rndSeed) + i)+"\n") #print sedcommand @@ -194,7 +199,7 @@ def runParallelXgrid(parstage, xgrid, folderName, nEvents, njobs, powInputName, os.system('chmod 755 '+filename) if QUEUE == 'none': - print 'Direct running... #'+str(i)+' \n' + print('Direct running... #'+str(i)+' \n') os.system('cd '+rootfolder+'/'+folderName) for i in range (0, njobs) : @@ -202,14 +207,14 @@ def runParallelXgrid(parstage, xgrid, folderName, nEvents, njobs, powInputName, os.system('bash run_'+jobID+'.sh &') else: - print 'Submitting to condor queues: \n' - condorfile = prepareCondorScript(jobtag, 'multiple', args.folderName, QUEUE, njobs=njobs, runInBatchDir=True, slc6=args.slc6) + print('Submitting to condor queues: \n') + condorfile = prepareCondorScript(jobtag, 'multiple', args.folderName, QUEUE, njobs=njobs, runInBatchDir=True) runCommand ('condor_submit ' + condorfile) # ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- def runSingleXgrid(parstage, xgrid, folderName, nEvents, powInputName, seed, process, scriptName) : - print 'Running single job for grid' + print('Running single job for grid') inputName = folderName + "/powheg.input" @@ -253,7 +258,7 @@ def runSingleXgrid(parstage, xgrid, folderName, nEvents, powInputName, seed, pro for line in open(inputName) : if 'ncall2' in line : m_ncall2 = line.split(" ")[2] - print "The original ncall2 is :", m_ncall2 + print("The original ncall2 is :", m_ncall2) f.write('sed -i "s/ncall2.*/ncall2 0/g" powheg.input \n') f.write('sed -i "s/fakevirt.*/fakevirt 1 ! number of calls for computing the integral and finding upper bound/g" powheg.input \n') @@ -275,7 +280,7 @@ def runSingleXgrid(parstage, xgrid, folderName, nEvents, powInputName, seed, pro def runGetSource(parstage, xgrid, folderName, powInputName, process, noPdfCheck, tagName, svnRev, ion) : # parstage, xgrid are strings! - print 'Getting and compiling POWHEG source...' + print('Getting and compiling POWHEG source...') #prepareJob(tagName, '', '.',args.prcName) @@ -330,7 +335,7 @@ def runGetSource(parstage, xgrid, folderName, powInputName, process, noPdfCheck, def runEvents(parstage, folderName, EOSfolder, njobs, powInputName, jobtag, process, seed) : - print 'run : submitting jobs' + print('run : submitting jobs') inputName = folderName + "/powheg.input" sedcommand = 'sed -i "s/NEVENTS/2000/ ; s/iseed.*/iseed '+str(seed)+'/" '+inputName @@ -352,7 +357,7 @@ def runEvents(parstage, folderName, EOSfolder, njobs, powInputName, jobtag, proc runCommand('cp -p ' + folderName + '/powheg.input ' + folderName + '/powheg.input.' + parstage) with open(os.path.join(folderName, "pwgseeds.dat"), "w") as f: - for i in xrange(njobs): + for i in range(njobs): f.write(str(int(seed) + i)+"\n") for i in range (0, njobs) : @@ -384,7 +389,7 @@ def runEvents(parstage, folderName, EOSfolder, njobs, powInputName, jobtag, proc os.system('chmod 755 '+filename) if QUEUE == 'none': - print 'Direct running... #'+str(i)+' \n' + print('Direct running... #'+str(i)+' \n') os.system('cd '+rootfolder+'/'+folderName) for i in range (0, njobs) : @@ -392,16 +397,16 @@ def runEvents(parstage, folderName, EOSfolder, njobs, powInputName, jobtag, proc os.system('bash run_'+jobID+'.sh &') else: - print 'Submitting to condor queues: \n' - condorfile = prepareCondorScript(jobtag, 'multiple', args.folderName, QUEUE, njobs=njobs, runInBatchDir=True, slc6=args.slc6) + print('Submitting to condor queues: \n') + condorfile = prepareCondorScript(jobtag, 'multiple', args.folderName, QUEUE, njobs=njobs, runInBatchDir=True) runCommand ('condor_submit ' + condorfile) # ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- def createTarBall(parstage, folderName, prcName, keepTop, seed, scriptName) : - print 'Creating tarball distribution for '+args.folderName+'_'+prcName+'.tgz' - print + print('Creating tarball distribution for '+args.folderName+'_'+prcName+'.tgz') + print() #inputName = folderName + "/powheg.input" @@ -446,9 +451,9 @@ def runhnnlo(folderName, njobs, QUEUE): helpers.fillTemplatedFile(template_file, filename, template_dict, "w") os.chmod(filename, 0o755) - print 'Submitting to condor queues \n' + print('Submitting to condor queues \n') tagName = 'hnnlo_%s' % scale - condorfile = prepareCondorScript(tagName, 'hnnlo', folderName, QUEUE, njobs=njobs, runInBatchDir=scale, slc6=args.slc6) + condorfile = prepareCondorScript(tagName, 'hnnlo', folderName, QUEUE, njobs=njobs, runInBatchDir=scale) runCommand ('condor_submit ' + condorfile) @@ -477,7 +482,6 @@ def runhnnlo(folderName, njobs, QUEUE): parser.add_argument('-k', '--keepTop' , dest="keepTop", default= '0', help='Keep the validation top draw plots [0]') parser.add_argument('-d', '--noPdfCheck' , dest="noPdfCheck", default= '0', help='If 1, deactivate automatic PDF check [0]') parser.add_argument('--fordag' , dest="fordag", default= 0, help='If 1, deactivate submission, expect condor DAG file to be created [0]') - parser.add_argument('--slc6' , dest="slc6", default= 0, help='If 1, use slc6 singularity [0]') parser.add_argument('--svn' , dest="svnRev", default= 0, help='SVN revision. If 0, use tarball [0]') parser.add_argument('--ion' , dest="ion", default= '', help='Ion type. Options: Pb []') @@ -493,27 +497,27 @@ def runhnnlo(folderName, njobs, QUEUE): QUEUE = args.doQueue EOSfolder = args.folderName - print - print 'RUNNING PARAMS: parstage = ' + args.parstage + ' , xgrid = ' + args.xgrid + ' , folderName = ' + args.folderName - print ' Total Events = ' + args.totEvents - print ' Number of Events = ' + args.numEvents - print ' powheg input cfg file : ' + args.inputTemplate - print ' powheg process name : ' + args.prcName - print ' working folder : ' + args.folderName - print ' EOS folder (stages 4,7,8) : ' + args.eosFolder + '/' + EOSfolder - print ' base folder : ' + rootfolder - print ' forDAG : ' + str(args.fordag) - print ' SLC6 : ' + str(args.slc6) - print ' SVN : ' + str(args.svnRev) - print + print() + print('RUNNING PARAMS: parstage = ' + args.parstage + ' , xgrid = ' + args.xgrid + ' , folderName = ' + args.folderName) + print(' Total Events = ' + args.totEvents) + print(' Number of Events = ' + args.numEvents) + print(' powheg input cfg file : ' + args.inputTemplate) + print(' powheg process name : ' + args.prcName) + print(' working folder : ' + args.folderName) + print(' EOS folder (stages 4,7,8) : ' + args.eosFolder + '/' + EOSfolder) + print(' base folder : ' + rootfolder) + print(' forDAG : ' + str(args.fordag)) + print(' scram_arch (set from environment) : ' + scram_arch) + print(' SVN : ' + str(args.svnRev)) + print() if (TESTING == 1) : - print ' --- TESTING, NO submissions will happen --- ' - print + print(' --- TESTING, NO submissions will happen --- ') + print() if (args.fordag) : - print ' --- Submissions will be done by DAG --- ' - print + print(' --- Submissions will be done by DAG --- ') + print() res = os.path.exists(rootfolder+'/'+args.folderName) @@ -522,20 +526,20 @@ def runhnnlo(folderName, njobs, QUEUE): POWHEG_SOURCE="powhegboxV2_rev3624_date20190117.tar.gz" if args.parstage == '1' and args.xgrid == '1' and (not res) : - print 'Creating working folder ' + args.folderName + '...' + print('Creating working folder ' + args.folderName + '...') # Assuming the generator binaries are in the current folder. os.system('mkdir '+rootfolder+'/'+args.folderName) if os.path.exists(rootfolder+'/pwhg_main') : - print 'Copy pwhg_main' + print('Copy pwhg_main') os.system('cp -p pwhg_main '+args.folderName+'/.') if os.path.exists(rootfolder+'JHUGen') : - print 'Copy JHUGen' + print('Copy JHUGen') os.system('cp -p JHUGen '+args.folderName+'/.') if args.parstage == '1' and args.xgrid == '1' : if not os.path.exists(args.folderName) : - print 'Creating working folder ' + args.folderName + '...' + print('Creating working folder ' + args.folderName + '...') # Assuming the generator binaries are in the current folder. os.system('mkdir '+args.folderName) if os.path.exists('pwhg_main') : @@ -639,8 +643,8 @@ def runhnnlo(folderName, njobs, QUEUE): if args.noPdfCheck == '0' : raise RuntimeError(message) else: - print "WARNING:", message - print "FORCING A DIFFERENT PDF SET FOR CENTRAL VALUE\n" + print("WARNING:", message) + print("FORCING A DIFFERENT PDF SET FOR CENTRAL VALUE\n") if args.parstage == '0' : @@ -653,12 +657,12 @@ def runhnnlo(folderName, njobs, QUEUE): powInputName, args.prcName, args.noPdfCheck, tagName, args.svnRev, args.ion) if QUEUE == 'none': - print 'Direct compiling... \n' + print('Direct compiling... \n') os.system('bash '+filename+' 2>&1 | tee '+filename.split('.sh')[0]+'.log') else: - print 'Submitting to condor queues \n' - condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1, slc6=args.slc6) + print('Submitting to condor queues \n') + condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1) runCommand ('condor_submit ' + condorfile) elif args.parstage == '1' : @@ -681,12 +685,12 @@ def runhnnlo(folderName, njobs, QUEUE): args.prcName, scriptName) if QUEUE == 'none': - print 'Direct running single grid... \n' + print('Direct running single grid... \n') os.system('bash '+scriptName+' >& '+scriptName.split('.sh')[0]+'.log &') else: - print 'Submitting to condor queues \n' - condorfile = prepareCondorScript(tagName, '', args.folderName, QUEUE, njobs=1, runInBatchDir=True, slc6=args.slc6) + print('Submitting to condor queues \n') + condorfile = prepareCondorScript(tagName, '', args.folderName, QUEUE, njobs=1, runInBatchDir=True) runCommand ('condor_submit ' + condorfile) elif args.parstage == '0123' or args.parstage == 'a' : # compile & run @@ -704,12 +708,12 @@ def runhnnlo(folderName, njobs, QUEUE): args.prcName, scriptName) if QUEUE == 'none': - print 'Direct compiling and running... \n' + print('Direct compiling and running... \n') os.system('bash '+scriptName+' >& '+ scriptName.split('.sh')[0]+'.log &') else: - print 'Submitting to condor queues \n' - condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1, runInBatchDir=True, slc6=args.slc6) + print('Submitting to condor queues \n') + condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1, runInBatchDir=True) runCommand ('condor_submit ' + condorfile) elif args.parstage == '01239' or args.parstage == 'f' : # full single grid in oneshot @@ -728,16 +732,16 @@ def runhnnlo(folderName, njobs, QUEUE): args.keepTop, args.rndSeed, scriptName) if QUEUE == 'none': - print 'Direct running in one shot... \n' + print('Direct running in one shot... \n') os.system('bash '+scriptName+' | tee '+ scriptName.split('.sh')[0]+'.log') else: - print 'Submitting to condor queues \n' - condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1, runInBatchDir=True, slc6=args.slc6) + print('Submitting to condor queues \n') + condorfile = prepareCondorScript(tagName, '', '.', QUEUE, njobs=1, runInBatchDir=True) runCommand ('condor_submit ' + condorfile) elif args.parstage == '7' : - print "preparing for NNLO reweighting" + print("preparing for NNLO reweighting") if args.prcName == "HJ": runhnnlo(args.folderName, njobs, QUEUE) diff --git a/bin/Powheg/run_pwg_parallel_condor.py b/bin/Powheg/run_pwg_parallel_condor.py index e3dba1bdf65d..f47f7bb47258 100755 --- a/bin/Powheg/run_pwg_parallel_condor.py +++ b/bin/Powheg/run_pwg_parallel_condor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # EXAMPLE ON HOW TO RUN # python ./run_pwg_parallel.py -i powheg_Zj.input -m Zj -f my_Zj -q 1nd -j 10 @@ -6,7 +6,7 @@ import argparse import os import sys -import commands +import subprocess import re import datetime from time import sleep @@ -43,7 +43,6 @@ def flush(self): parser.add_argument('-m', '--prcName' , dest="prcName", default= 'DMGG', help='POWHEG process name [DMGG]') parser.add_argument( '--step3pilot' , dest="step3pilot", default= False, help='do a pilot job to combine the grids, calculate upper bounds afterwards (otherwise afs jobs might fail)', action='store_true') parser.add_argument( '--dry-run' , dest="dryrun", default= False, help='show commands only, do not submit', action='store_true') - parser.add_argument( '--slc' , dest="slc", default='7', help='If 6, run in slc6 using singularity') parser.add_argument( '--svn' , dest="svnRev", default= 0, help='SVN revision. If 0, use tarball [0]') args = parser.parse_args () @@ -51,21 +50,20 @@ def flush(self): QUEUE = args.doQueue EOSfolder = args.folderName - print - print 'RUNNING PARAMS: ' - print ' parstage = ' + args.parstage - print ' folderName = ' + args.folderName - print ' eosFolder = ' + args.eosFolder - print ' Number of jobs = ' + args.numJobs - print ' Number of xgrid iter = ' + args.numX - print ' Condor Job flavor = ' + args.doQueue - print ' powheg input cfg file = ' + args.inputTemplate - print ' powheg process name = ' + args.prcName - print ' do step 3 pilot run = ' + str(args.step3pilot) - print ' dry run = ' + str(args.dryrun) - print ' SLC = ' + str(args.slc) - print ' SVN = ' + str(args.svnRev) - print + print() + print('RUNNING PARAMS: ') + print(' parstage = ' + args.parstage) + print(' folderName = ' + args.folderName) + print(' eosFolder = ' + args.eosFolder) + print(' Number of jobs = ' + args.numJobs) + print(' Number of xgrid iter = ' + args.numX) + print(' Condor Job flavor = ' + args.doQueue) + print(' powheg input cfg file = ' + args.inputTemplate) + print(' powheg process name = ' + args.prcName) + print(' do step 3 pilot run = ' + str(args.step3pilot)) + print(' dry run = ' + str(args.dryrun)) + print(' SVN = ' + str(args.svnRev)) + print() # parse differe @@ -96,15 +94,13 @@ def flush(self): (9, 'grid production 9', '-p 9 -k 1','null')) for istep,step,extraOpt,condorFile in steps: - print '*'*50,step,'*'*5,extraOpt,'*'*50 + print('*'*50,step,'*'*5,extraOpt,'*'*50) njobs = args.numJobs if 'pilot' in step: njobs = '1' commonOpts='-i '+args.inputTemplate+' -m '+args.prcName+' -f '+args.folderName+' -j '+njobs+' --fordag 1' commonOpts+=' --svn %i' % args.svnRev - if args.slc == '6': - commonOpts+=' --slc6 1 ' if args.eosFolder != 'NONE': commonOpts+=' -e '+args.eosFolder if extraOpt!='-p 0' and extraOpt!='-p 9 -k 1': @@ -112,11 +108,12 @@ def flush(self): commonOpts = commonOpts+' -q '+queues[istep] else: commonOpts = commonOpts+' -q '+args.doQueue - command = 'python ./run_pwg_condor.py %s %s'%(extraOpt,commonOpts) - print command - # if args.dryrun: continue - command_out = commands.getstatusoutput(command)[1] - print command_out + command = 'python3 ./run_pwg_condor.py %s %s'%(extraOpt,commonOpts) + print(command) + if args.dryrun: + continue + command_out = subprocess.getstatusoutput(command)[1] + print(command_out) dagfilename = 'run_' + args.folderName + '.dag' dagfile = open(dagfilename, 'w') @@ -137,8 +134,8 @@ def flush(self): dagfile.write('\n') dagfile.close() - command = 'condor_submit_dag %s'%(dagfilename) - print command + command = 'sh dag_wrapper.sh %s'%(dagfilename) + print(command) if not args.dryrun: - command_out = commands.getstatusoutput(command)[1] - print command_out + command_out = subprocess.getstatusoutput(command)[1] + print(command_out) diff --git a/bin/Powheg/source/test_source_compilation_condor.sh b/bin/Powheg/source/test_source_compilation_condor.sh index 079e8a5d4c43..77289539724f 100755 --- a/bin/Powheg/source/test_source_compilation_condor.sh +++ b/bin/Powheg/source/test_source_compilation_condor.sh @@ -110,8 +110,8 @@ do process="${file%.*}" echo "compiling $process" echo ${PWD} - echo "python ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1" - python ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1 + echo "python3 ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1" + python3 ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1 echo "=========== LAST 10 COMPILATION LINES FOR PROCESS ${process} ===========" >> ${topdir}/compile_report_-_${source_name}_-_${scram_arch_version}_-_${cmssw_version}.log echo "" >> ${topdir}/compile_report_-_${source_name}_-_${scram_arch_version}_-_${cmssw_version}.log tail run_src_my_${process}.log >> ${topdir}/compile_report_-_${source_name}_-_${scram_arch_version}_-_${cmssw_version}.log diff --git a/bin/Powheg/source/test_source_compilation_single.sh b/bin/Powheg/source/test_source_compilation_single.sh index afa711d6f6f8..185d27cabd4e 100755 --- a/bin/Powheg/source/test_source_compilation_single.sh +++ b/bin/Powheg/source/test_source_compilation_single.sh @@ -113,8 +113,8 @@ rm ${topdir}/compile_report_-_${process}_-_${scram_arch_version}_-_${cmssw_versi # Loop on the processes, compile and fetch the last lines of the compilation log echo "compiling ${process}" echo ${PWD} -echo "python ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1" -python ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1 +echo "python3 ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1" +python3 ./run_pwg_condor.py -p 0 -i powheg.input -m ${process} -f my_${process} -d 1 echo "=========== LAST 30 COMPILATION LINES FOR PROCESS ${process} ===========" >> ${topdir}/compile_report_-_${process}_-_${scram_arch_version}_-_${cmssw_version}.log echo "" >> ${topdir}/compile_report_-_${process}_-_${scram_arch_version}_-_${cmssw_version}.log tail -n 30 run_src_my_${process}.log >> ${topdir}/compile_report_-_${process}_-_${scram_arch_version}_-_${cmssw_version}.log diff --git a/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc11_CMSSW_13_0_13 b/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc11_CMSSW_13_0_13 new file mode 100644 index 000000000000..0936718962aa --- /dev/null +++ b/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc11_CMSSW_13_0_13 @@ -0,0 +1,6 @@ + btilde pos. weights: 641.59145692350342 +- 0.50054283119647269 + btilde |neg.| weights: 2.7265049524141034 +- 6.5743352602013944E-002 + btilde Total (pos.-|neg.|): 638.86495197108934 +- 0.51034726481231429 + Remnant cross section in pb 48.209050346881355 +- 8.5434566147203267E-002 + total (btilde+remnants) cross section in pb 687.07400231797067 +- 0.51744893061457886 + negative weight fraction: 3.9370376957035364E-003 diff --git a/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc12_CMSSW_13_3_0 b/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc12_CMSSW_13_3_0 new file mode 100644 index 000000000000..0936718962aa --- /dev/null +++ b/bin/Powheg/test/pwg-stat.dat.hvq_el8_amd64_gcc12_CMSSW_13_3_0 @@ -0,0 +1,6 @@ + btilde pos. weights: 641.59145692350342 +- 0.50054283119647269 + btilde |neg.| weights: 2.7265049524141034 +- 6.5743352602013944E-002 + btilde Total (pos.-|neg.|): 638.86495197108934 +- 0.51034726481231429 + Remnant cross section in pb 48.209050346881355 +- 8.5434566147203267E-002 + total (btilde+remnants) cross section in pb 687.07400231797067 +- 0.51744893061457886 + negative weight fraction: 3.9370376957035364E-003 diff --git a/bin/Powheg/test/test_build.sh b/bin/Powheg/test/test_build.sh index 37afe5d655c8..65eb98fdcb22 100644 --- a/bin/Powheg/test/test_build.sh +++ b/bin/Powheg/test/test_build.sh @@ -48,7 +48,7 @@ cd $CMSSW_RELEASE/src eval `/cvmfs/cms.cern.ch/common/scramv1 runtime -sh` ln -s $POWHEG_DIR/* . # run Powheg -python run_pwg_condor.py -p f -i $INPUT -m $PROC -d 1 +python3 run_pwg_condor.py -p f -i $INPUT -m $PROC -d 1 cp testProd/pwg-stat.dat test/pwg-stat.dat.${PROC}_${SCRAM_ARCH}_${CMSSW_RELEASE} GRIDPACK=${PROC}_${SCRAM_ARCH}_${CMSSW_RELEASE}_testProd.tgz