The following tutorial shows how to pack a specific CMSSW framework releases to use it on your jobs.
Quick Start
To create a sandbox file from a CMSSW release directory, you can use the cmssw-sandbox tool. For example:
$ ls
$ CMSSW_7_2_3/
$ cmssw-sandbox create CMSSW_7_2_3
INFO:root:packing sandbox into ./sandbox-CMSSW_7_2_3-7b812c1.tar.bz2
Optionally, you can specify a directory to write the sandbox file with
-o. Sandboxes for the same CMSSW release will not be overwritten by default, so you can use
-U when creating to update your sandbox file.
The following wrapper shows how to use the sandbox. You can transfer cmssw_setup.sh with your job to use the the sandbox on the worker node.
$ source /etc/ciconnect/templates/cmssw_setup.sh
$ cmssw_setup sandbox-CMSSW_7_2_3-7b812c1.tar.bz2
>>> preparing sandbox release CMSSW_7_2_3
[2016-11-23 13:38:46] wrapper ready
current directory: /home/khurtado/releases/slc6/tmp
/home/khurtado/releases/slc6/tmp/cmssw-tmp/CMSSW_7_2_3
Introduction
The analysis code a user needs to run often depends on the CMSSW framework. This usually requires:
- Setting up a specific CMSSW release
- Getting and compiling some user-specific code
The second step can take some time and not always be that straightforward. Rather than having every single job systematically doing this, you can do it interactively once and package it in a file that gets transferred to the worker node instead.
This tool allows you to easily create a sandbox file from a CMSSW directory, it takes such directory as the input and you can specify a directory to put the sandbox, the sandbox name will have the version release and a hash.
cmsw-sandbox
$ cmssw-sandbox create -h
usage: cmssw-sandbox create [-h] [-o OUTDIR] [-U] [-a] [-i INCLUDE_DIR] indir
positional arguments:
indir CMSSW framework release directory to sandbox
optional arguments:
-h, --help show this help message and exit
-o OUTDIR, --outdir OUTDIR
Sandbox output directory
-U, --update Update old sandbox file.
-a, --include_all Include the whole src directory.
-i INCLUDE_DIR, --include_dir INCLUDE_DIR
Include this directory in $CMSSW_BASE/src recursively.
Ignored if -a is used. data, interface and python
included by default.
Use-case example
Let's assume we want to setup CMSSW 7.2.3 and then checkout some code from git:
cmssw-release
SCRAM_ARCH=slc6_amd64_gcc481
cmsrel CMSSW_7_2_3
cd CMSSW_7_2_3/src/
cmsenv
git cms-merge-topic HuguesBrun:trigElecIdInCommonIsoSelection720
git clone https://github.com/cms-ttH/MiniAOD
cd MiniAOD
git checkout 0181312365929129567455eeca5b5d3f1732dc21
cd ..
git clone https://github.com/cms-ttH/ttH-13TeVMultiLeptons
cd ttH-13TeVMultiLeptons
git checkout 08de8b5bfc05770410dbc5481fb47be89f3e7e94
# compile, do additional work on this release
Now, we can simply run the tool:
$ cmssw-sandbox create CMSSW_7_2_3
INFO:root:packing sandbox into ./sandbox-CMSSW_7_2_3-1f7f983.tar.bz2
The above command will copy the directories needed in the CMSSW framework area (bin, cfipython, config, lib, module, python), plus all data, interface, python subdirectories in $CMSSW_BASE/src recursively. To copy all content in src, you can type instead:
$ cmssw-sandbox create -a CMSSW_7_2_3
or to include some additional, but not all subdirectories in $CMSSW_BASE/src, use option -i. For example, if we want to include src and test subdirectories in $CMSSW_BASE/src recursively
$ cmssw-sandbox create -i src -i test CMSSW_7_2_3
To use the sandbox, you will need a wrapper, available in /etc/ciconnect/templates/cmssw_setup.sh