CMSSW

Here, an example on how to use CMSSW with the Slurm. We will simulate minimum bias events with CMS Phase-2 detector.

cmssw_template.slurm

#!/bin/tcsh
#
#SBATCH --qos=cu_htc
#SBATCH --partition=cpu
#SBATCH --job-name=cmssw
#SBATCH --output=Log_CMSSW_INPUT1.txt
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --time=08:00:00
#SBATCH --cpus-per-task=8
#SBATCH --mem-per-cpu=2G

module purge

#To handle ENV and PATHs
source /work/app/share_env/hepsw.csh
setenv MYCODEDIR /work/home/srimanob/Phase2SW/11_3_Production/CMSSW_11_3_0/src
setenv MYPROJOUTPUT /work/project/cms/srimanob/11_3_0/MinBias
echo "MYCODEDIR = "$MYCODEDIR
echo "TMPDIR = "$TMPDIR

#To run CMSSW program
cd $TMPDIR
cmsrel CMSSW_11_3_0
cd CMSSW_11_3_0/src
eval `scram runtime -csh`
cmsDriver.py MinBias_14TeV_pythia8_TuneCP5_cfi  --mc --conditions auto:phase2_realistic_T21 -n 100 --era Phase2C11M9 --eventcontent RAWSIM -s GEN,SIM --datatier GEN-SIM --beamspot HLLHC14TeV --geometr
y Extended2026D76 --python MinBias_14TeV_pythia8_TuneCP5_2026D76_GenSimHLBeamSpot14.py --nThreads 8 --no_exec --fileout file:minbias.root --customise_commands "from IOMC.RandomEngine.RandomServiceHelp
er import RandomNumberServiceHelper ; randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService) ; randSvc.populate() \n process.source.firstLuminosityBlock = cms.untracked.uint32(INPUT
1)"
cmsRun MinBias_14TeV_pythia8_TuneCP5_2026D76_GenSimHLBeamSpot14.py
cp -rf minbias.root $MYPROJOUTPUT/minbias_INPUT1.root

Submission script, to submit many jobs with the same driver.

#!/bin/tcsh

set lhe = 10
while ( $lhe < 18 )
    sed s/INPUT1/$lhe/g cmssw_template.slurm >! cmssw-$lhe.slurm
    sbatch cmssw-$lhe.slurm
    sleep 2s
    rm -rf cmssw-$lhe.slurm
    @ lhe++
end

exit

Last updated