This is an old revision of the document!
Singularity is a container system developed for the HPC user environment. It is similar to the docker, but it runs on the user-space.
In some cases, setting up the madgraph_aMC@NLO is painful job - to synchronize the system packages. Running the simplest example process works on the vanilla setup but it comes to a problem if you want to run the NLO simulations.
Life gets much easier with the aMC@NLO on the singularity - once you have sif image file then you can re-use the image files keeping the identical setup for each runs.
# Singularity recipe to run MG5_aMC@NLO
Bootstrap: docker
From: rootproject/root:6.24.06-ubuntu20.04
%post
export LANG="C"
export LC_ALL="C"
## Install necessary packages
apt-get update
apt-get -y install python-six python3-six
apt-get -y install wget ghostscript bc rsync
### Install Madgraph_aMC@NLO
mkdir -p /sw/install
cd /sw/install
wget https://launchpad.net/mg5amcnlo/3.0/3.3.x/+download/MG5_aMC_v3.3.1.tar.gz
cd /sw
tar xzf /sw/install/MG5_aMC_v3.3.1.tar.gz
cd /sw/MG5_aMC_v3_3_1
## Install internal subpackages within the Madgraph_aMC@NLO
./bin/mg5_aMC <<EOF
install zlib
install boost
install hepmc
install lhapdf6
install ninja
install collier
install QCDLoop
EOF
./bin/mg5_aMC <<EOF
install looptools
cuttools install
iregi install
EOF
./bin/mg5_aMC <<EOF
install pythia8;
install maddm; install maddump; install MadSTR;
EOF
cat /etc/ld.so.conf
./bin/mg5_aMC << EOF
install ExRootAnalysis; install MadAnalysis4
install Delphes
EOF
### First launch example process, with QCD at NLO
./bin/mg5_aMC << EOF
generate p p > t t~ [QCD]
output /sw/install/out_ttNLO
#launch -m
launch
shower = PYTHIA8
madspin = ON
0
EOF
### Allow generic users to run executables
#chmod go+rx bin/* HEPTools/*/bin/*
#chmod -R go+r .
%environment
export LC_ALL=C
export PATH=/usr/games:$PATH
%runscript
#/usr/local/bin/thisroot.sh
#export ROOTSYS=/usr
#export PS1="\[Singularity \e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]>"
#python /sw/MG5_aMC_v3_3_1/bin/mg5_aMC
/bin/bash