Tags:
create new tag
view all tags

Using containers to work with older CMSSW versions on RHEL9

You can use the wrappers offered by the cmssw-osenv project that are already installed in CVMFS. /cvmfs/cms.cern.ch/common/cmssw-env. You can add additional directories that are to be mounted into the container using the -B /work,/scratch syntax.

Interactively installing a CMSSW release

Start up a container suitable for the CMSSW release you want to install. Ensure that /work is mounted into the container

/cvmfs/cms.cern.ch/common/cmssw-env -B /work --cmsos el7

Now, inside of the containerized environment just proceed to install CMSSW as usual

cd /work/feichtinger/CMSSW
source ${VO_CMS_SW_DIR}/cmsset_default.sh
export SCRAM_ARCH=slc7_amd64_gcc700   # override needed for this particular CMSSW version
cmsrel CMSSW_10_6_37

Running slurm jobs in a containerized environment

An example job based on creating a temporary payload file to be executed within the container

#!/bin/bash
#SBATCH --job-name=cmssw-job
#SBATCH --partition=standard
#SBATCH --ntasks=1
#SBATCH --time=08:00:00

echo "# starting Job at $(date) on node ${HOSTNAME}"
echo "###########################"
echo "# INITIAL ENVIRONMENT START"
echo "###########################"
env
echo "##########################"
echo "# INITIAL ENVIRONMENT END"
echo "##########################"

JOBSCRATCH=/scratch/${USER}/${SLURM_JOBID}
mkdir -p $JOBSCRATCH
payload=$(mktemp ${JOBSCRATCH}/apptainer-payload-XXXXXX.sh)

cat > "$payload" << EOF
# Adapt this based on your install directory
cd /work/feichtinger/CMSSW/CMSSW_10_6_37
source ${VO_CMS_SW_DIR}/cmsset_default.sh

#For this particular CMSSW version we need to override the ARCH
export SCRAM_ARCH=slc7_amd64_gcc700

cmsenv

# IMPLEMENT YOUR FUNCTIONALITY HERE!

EOF

chmod u+x "$payload"

# Launch the payload, make sure that /scratch and /work are available
# in the container

/cvmfs/cms.cern.ch/common/cmssw-env --cmsos el7 -B /scratch,/work \
                                    --command-to-run $payload

rm -rf "$JOBSCRATCH"
echo "# ending Job at $(date) "

References

-- DerekFeichtinger - 2025-05-22

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2025-05-27 - DerekFeichtinger
 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback