Skip to content
Snippets Groups Projects
Commit f33e7304 authored by Patrick Louis S Connor's avatar Patrick Louis S Connor
Browse files

updating instructions to install with CMake on Alma9 (partly addresses #19) [skip ci]

parent 3d236e33
No related branches found
No related tags found
No related merge requests found
Pipeline #7693695 skipped
......@@ -15,7 +15,7 @@ The `Campaigns` subgroup contains actual repos corresponding to different analys
In the following, we provide two alternative methods to install the framework.
### Method #1: From scratch with the default installer
### Method \#1: From scratch with the default installer
In general, it is recommended that you install the software on a fast disk to ensure fast compilation (e.g. AFS), but that you process the heavy n-tuples on a dedicated area (e.g. NFS at DESY, EOS at CERN). Keeping the software neat and clean is important for reproducibility.
......@@ -25,21 +25,21 @@ git clone https://gitlab.cern.ch/cms-analysis/general/DasAnalysisSystem/gitlab-p
cd DasAnalysisSystem
source ./setup
```
It is currently working at CERN (CH), at DESY (DE), at IIHE (BE), and for GitLab CI. Feel free to make a merge request to include your favourite facility.
The `setup` is necessary at CERN (CH), at DESY (DE), at IIHE (BE), and for GitLab CI, but may not be necessary on all platforms (e.g. your private laptop).
2. Run the installation:
```
./install.sh
```
*Remark*: if a CMSSW release has already been sourced, it will use that one instead of installing a new one.
3. Then change to the directory of the CMSSW release (by default, it is created in the local directory) and compile as follows:
3. After a few minutes, you get back to the prompt. You only have to set up the newly compiled environment:
```
cmsenv
scram b -j$(nproc)
source tools/setup.sh
```
4. After a few minutes, you get back to the prompt. You have to rerun `cmsenv` to actually see the commands in the shell. Then you're all set.
### Method #2: By hand, step by step
### Method \#2: By hand, step by step
*Work in progress*
<!---
In the following, we explain the installation of the framework step by step. A few packages external to CMSSW are necessary (e.g. TUnfold), which you will need to tell CMSSW how to find them with `scram setup`.
First source your CMSSW release and close to a directory where you want to install the external packages.
......@@ -73,10 +73,11 @@ cd $CMSSW_BASE/src/JMEAnalysis/JetToolbox
patch -p1 $OLDPWD/jetToolbox_120X.patch
```
5. Clone the `Tables` wherever you like and the `Core` in CMSSW, and compile as usual with `scram b -j`.
-->
## Setting up the environment
First source the minimal environment for CMSSW with `source ./setup`, then just source the CMSSW release as usual with `cmsenv`.
First source the minimal environment with `source ./setup`, then `source ./tools/setup.sh`.
To run CRAB jobs, you will also need to set up a valid [grid certificate](https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookStartingGrid#ObtainingCert). If you already have done so, this will enable it:
```
......@@ -85,6 +86,43 @@ voms-proxy-init --rfc --voms cms -valid 192:00
To make [RUCIO](https://twiki.cern.ch/twiki/bin/viewauth/CMS/Rucio) requests, the `setup` file tried to guess your RUCIO username from your local username (unless was already set up). This is not guaranteed to work and you may have to define your RUCIO username ahead for sourcing the DAS environment.
### Contributing
If you modify part of the source code of a module (e.g. `Core`), you can recompile it as follows:
```
cd $DAS_BASE
cmake --build Core.build --target install
```
(This is analog to `cd $CMSSW_BASE; scram b`.)
It is good practice to check that your changes do not harm the rest of the code. For this, tests can be run as follows:
```
cd $DAS_BASE/Core.build
ctest .
```
(analog to `cd $CMSSW_BASE; scram b runtests`.)
For `cmake` and `ctest`, one can always specify `-j8` to compile with 8 cores (for instance), or more generally `-j$(nproc)` to compile with the number of cores on the present machine.
Despite multitasking, the whole process of compiling and testing may take a few minutes. In case you would like to compile and/or test a subset of the code, do the following (where `JEC` is here just taken as an example):
```
cd $DAS_BASE/Core.build/JEC
make install
```
(analog to `cd $CMSSW_BASE/src/Core/JEC; scram b`.)
Whenever developing, it is perfectly fine to only compile subsets of the code to speed up the whole process. Instead, whenever running over large samples, it is advised to commit and to rerun the whole `Core` to ensure compatibility and reproducibility of the resulsts.
### Updating a module
If you want to update source code of a module (e.g. `Core`), assuming no local changes, you can proceed as follows:
```
cd $DAS_BASE/Core
git pull
cmake -B $DAS_BASE/build
cmake --build build --target install
```
In case of local changes, you should first commit them, or use `git stash` to pause the changes temporarily (after the update, it will be sufficient to run `git stash pop` to recover your changes).
### Good practices
Fight against the increase of entropy by
......
#!/bin/sh
#!/usr/bin/env bash
set -e
......@@ -28,37 +28,38 @@ if [ ! -z "$(git config url.ssh://git@gitlab.cern.ch:7999/.insteadOf)" ]; then
ssh-add
fi
# Get a CMSSW if we don't have one
if [ -z $CMSSW_BASE ]; then
version=CMSSW_12_4_0
[ ! -d $version ] && scram p $version
cd $version
eval `scramv1 runtime -sh`
unset version
fi
# Set up libgit2
cd $CMSSW_BASE
scram setup $BASE_DIR/libgit2.xml
set -x
# Download and build supporting tools
cd $BASE_DIR
cmake3 -B .build
cmake3 --build .build --target install -j$(nproc)
# Get Core
cd $CMSSW_BASE/src
[ ! -d Core ] && git clone https://gitlab.cern.ch/cms-analysis/general/DasAnalysisSystem/Core.git
# And JetToolbox
[ ! -d JMEAnalysis/JetToolbox ] && (
git clone https://github.com/cms-jet/JetToolbox.git JMEAnalysis/JetToolbox -b jetToolbox_120X
cd JMEAnalysis/JetToolbox
patch -p1 <$BASE_DIR/jetToolbox_120X.patch
)
cmake3 -B build
cmake3 --build build --target install -j$(nproc)
# Set up scram tools in CMSSW -- must be done after fetching Core
cd $CMSSW_BASE
for xml in $BASE_DIR/tools/etc/*.xml; do
scram setup $xml
done
## Get a CMSSW if we don't have one
#if [ -z $CMSSW_BASE ]; then
# version=CMSSW_12_4_0
# [ ! -d $version ] && scram p $version
# cd $version
# eval `scramv1 runtime -sh`
# unset version
#fi
#
## Set up libgit2
#cd $CMSSW_BASE
#scram setup $BASE_DIR/libgit2.xml
#
## Get Core
#cd $CMSSW_BASE/src
#[ ! -d Core ] && git clone https://gitlab.cern.ch/cms-analysis/general/DasAnalysisSystem/Core.git
#
## And JetToolbox
#[ ! -d JMEAnalysis/JetToolbox ] && (
# git clone https://github.com/cms-jet/JetToolbox.git JMEAnalysis/JetToolbox -b jetToolbox_120X
# cd JMEAnalysis/JetToolbox
# patch -p1 <$BASE_DIR/jetToolbox_120X.patch
#)
#
## Set up scram tools in CMSSW -- must be done after fetching Core
#cd $CMSSW_BASE
#for xml in $BASE_DIR/tools/etc/*.xml; do
# scram setup $xml
#done
......@@ -3,19 +3,20 @@ case "$(hostname)" in
tput setaf 2
echo "Setting up environment for DESY (naf)."
tput op
module use -a /afs/desy.de/group/cms/modulefiles/
module load cmssw
source /cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-el9-gcc13-opt/setup.sh
source /cvmfs/grid.desy.de/etc/profile.d/grid-ui-env.sh
;;
*cern.ch)
tput setaf 2
echo "Setting up environment for CERN (lxplus)."
tput op
source /cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-el9-gcc13-opt/setup.sh
;;
*iihe.ac.be)
tput setaf 2
echo "Setting up environment for IIHE T2B cluster."
tput op
source /cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-el9-gcc13-opt/setup.sh
;;
*)
tput setaf 3
......@@ -24,7 +25,6 @@ case "$(hostname)" in
;;
esac
source /cvmfs/cms.cern.ch/cmsset_default.sh
source /cvmfs/cms.cern.ch/rucio/setup-py3.sh
source /cvmfs/cms.cern.ch/crab3/crab.sh
......
......@@ -5,6 +5,7 @@ export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/python:$PYTHONPATH
export DARWIN_FIRE_AND_FORGET=@CMAKE_INSTALL_FULL_LIBDIR@ # TODO use ldd or link statically
# Convenience
export DAS_BASE=@CMAKE_SOURCE_DIR@
export DARWIN_BASE=@CMAKE_SOURCE_DIR@/Darwin
export DARWIN_TABLES=@CMAKE_SOURCE_DIR@/tables
export CORE_BASE=@CMAKE_SOURCE_DIR@/Core
<tool name="tunfold" version="17.9">
<lib name="tunfold"/>
<info url="https://www.desy.de/~sschmitt/tunfold.html"/>
<client>
<environment name="TUNFOLD_BASE" default="${CMAKE_SOURCE_DIR}/TUnfold"/><!-- FIXME Needed? -->
<environment name="INCLUDE" default="${CMAKE_INSTALL_FULL_INCLUDEDIR}/TUnfold"/>
<environment name="LIBDIR" default="${CMAKE_INSTALL_FULL_LIBDIR}"/>
</client>
<use name="root_cxxdefaults"/>
<lib name="XMLIO" />
<lib name="XMLParser" />
<runtime name="LD_LIBRARY_PATH" value="$LIBDIR" type="path"/>
</tool>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment