From 175e541f7cbc4b9f08cacb3e964c1748a88020ae Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Thu, 17 Oct 2019 02:44:19 +0200 Subject: [PATCH] First project components including singularity file for GiBUU container --- .gitignore | 6 ++++ Makefile | 36 ++++++++++++++++++++++ README.md | 36 +++++++++++++++++++++- jobcards/examples/example.job | 56 +++++++++++++++++++++++++++++++++++ km3buu.Singularity | 23 ++++++++++++++ run.sh | 32 ++++++++++++++++++++ 6 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 jobcards/examples/example.job create mode 100644 km3buu.Singularity create mode 100755 run.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..895472b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +#Singularity +*.simg + +# GiBUU +*.dat +output/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c7777bd --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +export REPO_OUTPUT_DIR := output +export REPO_JOBCARDS_DIR := jobcards +export CONTAINER_OUTPUT_DIR := /opt/output +export CONTAINER_JOBCARD_DIR := /opt/jobcards + +default: run + +build: km3buu.Singularity + sudo singularity build GiBUU.simg km3buu.Singularity + + +run: GiBUU.simg + @if [ ! -d "jobcards/${CARDSET}" ];then \ + exit 1; \ + fi; + @if [ -d "${REPO_OUTPUT_DIR}/${CARDSET}" ];then \ + echo "Output directory for this cardset already exists; remove and go on [y/n]";\ + read REPLY; \ + if [ ! $$REPLY = "y" ];then \ + exit 2;\ + fi;\ + fi; + rm -rf ${REPO_OUTPUT_DIR}/${CARDSET}; + mkdir -p ${REPO_OUTPUT_DIR}/${CARDSET}; + singularity exec -B ${REPO_JOBCARDS_DIR}/${CARDSET}:$$CONTAINER_JOBCARD_DIR\ + -B ${REPO_OUTPUT_DIR}/${CARDSET}:$$CONTAINER_OUTPUT_DIR\ + GiBUU.simg\ + /bin/sh run.sh $$CONTAINER_JOBCARD_DIR $$CONTAINER_OUTPUT_DIR + +lyon: + @echo "TO DO" + +clean: + @rm -rf output + + diff --git a/README.md b/README.md index 4b44b4f..e7b5851 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,37 @@ # KM3BUU -This project contains software and data related to the GiBUU studies done for KM3NeT. \ No newline at end of file +The KM3BUU project is an integrated environment for the GiBUU studies within the KM3NeT experiment. The execution is mainly based on + +## Installation +The project is based on images using `singularity`, for which version 3 or higher (e.g. [v3.4](https://sylabs.io/guides/3.4/user-guide/)) is required. This is done due to the intention to provide a comparable installation on all systems and thus make the results +easily reproducible. The main project control is based on `make`. +In order to apply installation commands presented within this section, clone this repository and change to the project directory: +``` +git clone https://git.km3net.de/jschumann/km3buu +cd km3buu +``` + + +### Local Machine +By "Local Machine" a computer where are root (administrative) privileges are available is +meant. These root privileges are required to build the singularity image by yourself. To start the build run following `make` command: +``` +make build +``` + +### Compute Cluster +In order to make this project also usable in a non-root environment, binaries will be provided. Within KM3NeT computing infrastructure this is the case for the lyon compute cluster, thus this case is customised for this environment. + +This part is currently under development, so it is time to say: Coming soon ... ;-) + + +## Structure & Usage + +The used GiBUU jobcards are located in a sub-folder within the jobcards folder. +Each sub-folder represents a set of jobcards, which can be processed by: + +``` +make run CARDSET=examples +``` + +This command runs all jobcards within the `jobcards/examples` folder and writes the output it to the folder `output`. The folder structure is applied from the `jobcards`folder. \ No newline at end of file diff --git a/jobcards/examples/example.job b/jobcards/examples/example.job new file mode 100644 index 0000000..f793595 --- /dev/null +++ b/jobcards/examples/example.job @@ -0,0 +1,56 @@ +&neutrino_induced + process_ID = -2 ! 2:CC, 3:NC, -2:antiCC, -3:antiNC + flavor_ID = 2 ! 1:electron, 2:muon, 3:tau + nuXsectionMode = 6 ! 6: dSigmaMC + includeDIS = .true. ! enables DIS events + printAbsorptionXS = T +/ + +&target + target_Z=1 + target_A=1 +/ + +&input + numEnsembles = 1000 ! for H: 100000, + ! for O: 6400 + ! decrease it if there are + ! problems with memory or + ! for heavier nuclei + eventtype = 5 ! 5=neutrino + ! of a given particle + numTimeSteps = 0 ! the distance numTimeSteps*delta_T + ! should significantly + ! exceed the radius + ! of the target nucleus + ! for H this must be 0 + ! numTimeSteps=0 gives inclusive + ! X-sections + delta_T = 0.2 ! timestep for hadron propagation + localEnsemble = .true. ! sets fullEnsemble = True + num_runs_SameEnergy = 1 ! increase these if you want to + ! increase statistics + ! (= number of generated events) + LRF_equals_CALC_frame = .true. ! if .false.: + ! no offshelltransport + ! possible + path_to_input = '/opt/buuinput2019' ! needs to be + ! changed to actual path +/ + +&nl_SigmaMC + enu = 4.0 !energy of the initial neutrino +/ + + +&neutrinoAnalysis + outputEvents = .true ! output list of events and + ! all outgoing particles in + ! each event to the file + ! FinalEvents.dat +/ + +&pythia + PARP(91)=0.44 +/ + diff --git a/km3buu.Singularity b/km3buu.Singularity new file mode 100644 index 0000000..4a314e8 --- /dev/null +++ b/km3buu.Singularity @@ -0,0 +1,23 @@ +Bootstrap: docker +From: debian:stretch + +%post + apt-get update -qq + apt-get install -qq -y neovim + apt-get install -qq -y gfortran make libbz2-dev + apt-get install -qq -y wget + cd /opt && \ + wget https://gibuu.hepforge.org/downloads?f=buuinput2019.tar.gz && \ + tar xvzf downloads?f=buuinput2019.tar.gz && \ + wget https://gibuu.hepforge.org/downloads?f=release2019.tar.gz && \ + tar xvzf downloads?f=release2019.tar.gz && \ + ls -ahl && \ + cd release2019 && \ + make -j withROOT=0 + rm -rf /opt/*.tar.gz + +%environment + export CONTAINER_GIBUU_EXEC=/opt/release2019/objects/GiBUU.x + + + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..1c0fb1f --- /dev/null +++ b/run.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +if [ -z "$CONTAINER_GIBUU_EXEC+x" ]; +then + echo "No GIBUU executable provided via CONTAINER_GIBUU_EXEC"; + exit 1 +fi; + +if [ $# -eq 0 ]; +then + echo "No paths provided!"; + exit 1; +elif [ $# -eq 1 ]; +then + echo "No output directory within the container given!"; + exit 1; +fi; + +CONTAINER_JOBCARD_DIR=$1 +CONTAINER_OUTPUT_DIR=$2 + +JOBCARDS=$(find $CONTAINER_JOBCARD_DIR -name "*.job") + +cd $CONTAINER_OUTPUT_DIR + +for filepath in $JOBCARDS; do + filename=$(basename -- $filepath) + foldername="${filename%.*}" + mkdir $foldername; cd $foldername + $CONTAINER_GIBUU_EXEC < $filepath; + cd .. +done -- GitLab