Skip to content

Commit db6fcca

Browse files
authored
Merge pull request #42 from VERITAS-Observatory/v2.0-optimisation-dev3
v2.0-dev3 bug fixes
2 parents df815bf + ea614b4 commit db6fcca

File tree

9 files changed

+48
-26
lines changed

9 files changed

+48
-26
lines changed

.github/workflows/build-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
packages: write
2727
strategy:
2828
matrix:
29-
type: ['corsika', 'corsika-noopt', 'corsika-ax2', 'groptics', 'care', 'mergevbf']
29+
type: ['corsika', 'groptics', 'care', 'mergevbf']
3030

3131
steps:
3232
- name: Checkout repository

.github/workflows/build-optimized-corsika.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
packages: write
2727
strategy:
2828
matrix:
29-
type: ['noopt', 'avx2', 'avx512', 'avx', 'sse4']
29+
type: ['noopt', 'avx2', 'avx512f', 'avx', 'sse4']
3030

3131
steps:
3232
- name: Checkout repository

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ cff-version: 1.2.0
44
message: If you use this software, please cite it using these metadata.
55
title: "VTS-SimPipe: simulation tools for the VERITAS observatory"
66
doi: 10.5281/zenodo.10541349
7-
version: 1.0.0
7+
version: 2.0.0
88
type: software
9-
date-released: 2024-01-22
9+
date-released: 2024-03-03
1010
keywords:
1111
- "gamma-ray astronomy"
1212
- "astronomy software"

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![DOI](https://zenodo.org/badge/738007615.svg)](https://zenodo.org/doi/10.5281/zenodo.10541349)
44
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
55
[![build-images](https://github.com/VERITAS-Observatory/VTS-SimPipe/actions/workflows/build-images.yml/badge.svg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/actions/workflows/build-images.yml)
6+
[![build-optimized-corsika](https://github.com/VERITAS-Observatory/VTS-SimPipe/actions/workflows/build-optimized-corsika.yml/badge.svg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/actions/workflows/build-optimized-corsika.yml)
67

78
[VERITAS](https://veritas.sao.arizona.edu/) is a ground-based gamma-ray observatory located at the Fred Lawrence Whipple Observatory in southern Arizona, USA.
89
It explores the gamma-ray sky in the energy range from 100 GeV to 30 TeV.
@@ -22,7 +23,7 @@ This work is built on a large effort from many people, especially:
2223
- Nepomuk Otte for the [CARE](https://github.com/nepomukotte/CARE) package
2324
- Raul Prado for an initial pipeline implementation for DESY (see [here](https://github.com/RaulRPrado/MC-DESY/tree/master))
2425
- Tony Lin for a Docker implementation of the pipeline (see [here](https://github.com/VERITAS-Observatory/Build_SimDockerImage/tree/master))
25-
- Luisa Arrabito and Orel Gueta on providing the optimized CORSIKA code and help with compilation
26+
- Luisa Arrabito and Orel Gueta on providing the optimized CORSIKA code and help with compilation issues.
2627

2728
## Quick startup
2829

@@ -42,9 +43,7 @@ cd scripts && ./pull.sh
4243
# see example in config/config_ATM61_template.dat
4344
# prepare production
4445
cd scripts
45-
./prepare_all_production_steps.sh \
46-
../config/config_ATM61_template.dat
47-
../config/CORSIKA/input_template.dat
46+
./prepare_all_production_steps.sh ../config/config_ATM61_template.dat
4847
# on DESY: log into the DAG submission node
4948
./prepare_DAG_jobs.sh ../config/config_ATM61_template.dat
5049
./submit_DAG_jobs.sh ../config/config_ATM61_template.dat <directory with DAG files>
@@ -81,9 +80,9 @@ Images can be downloaded from the package registry of this repository.
8180
Requires the tar package with the CORSIKA tar software to be available in the main directory of `VTSSimPipe`.
8281
Note that the CI on github will build three different containers for CORSIKA:
8382

84-
1. [vts-simpipe-corsika](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika) based on [docker/Dockerfile-corsika](docker/Dockerfile-corsika) with the standard CORSIKA software (as used in VERITAS for productions in the past)
85-
2. [vts-simpipe-corsika-noopt](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-noopt) based on [docker/Dockerfile-corsika-noopt](docker/Dockerfile-corsika-noopt) using CORSIKA 7.7500 with minor updates to the Bernlohr package (this is the package used for the generation and propagation of Cherenkov photons).
86-
3. [vts-simpipe-corsika-ax2](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-ax2) based on [docker/Dockerfile-corsika-ax2](docker/Dockerfile-corsika-ax2) using CORSIKA 7.7500 with minor updates to the Bernlohr package (this is the package used for the generation and propagation of Cherenkov photons). A patch is applied to the Cherenkov photon code to allow to use vector instructions and improve runtime performance.
83+
1. [vts-simpipe-corsika](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika) based on [docker/Dockerfile-corsika](docker/Dockerfile-corsika) with the standard CORSIKA software (as used in VERITAS for productions in the past); configuration and compilation using the `coconut` tools.
84+
2. [vts-simpipe-corsika-noopt](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-noopt) based on [docker/Dockerfile-corsika-noopt](docker/Dockerfile-corsika-noopt) using CORSIKA 7.7500 used compile coptions as outlined in the Docker file (in contrast to 1., uses the `O3` flags, but it does not use the vectorization code of 3.)
85+
3. [vts-simpipe-corsika-ax2](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-ax2) based on [docker/Dockerfile-corsika-ax2](docker/Dockerfile-corsika-ax2) using CORSIKA 7.7500 with minor updates to the Bernlohr package (this is the package used for the generation and propagation of Cherenkov photons). A patch is applied to the Cherenkov photon code to allow to use vector instructions and improve runtime performance, see discussions in L. Arrabito et al, *Optimizing Cherenkov photons generation and propagation in CORSIKA for CTA Monte-Carlo simulations*, [arXiv.2006.14927](https://arxiv.org/abs/2006.14927)
8786

8887
To build the CORSIKA container (similar for all):
8988

@@ -296,3 +295,22 @@ SLANT 1
296295
### corsikaIOreader parameters
297296

298297
- apply pre-efficiency cut of 50%
298+
299+
## Optimization of CORSIKA
300+
301+
The CTA simulation pipeline uses vector-optimization of the Cherenkov photon generation and propagation code in CORSIKA with notable performance improvements, see the discussion in L. Arrabito et al, *Optimizing Cherenkov photons generation and propagation in CORSIKA for CTA Monte-Carlo simulations*, [arXiv.2006.14927](https://arxiv.org/abs/2006.14927).
302+
303+
VTS-SimPipe is able to use the same optimized CORSIKA, thanks to for Luisa Arrabito for providing it. Below a comparison of the runtime of the optimized and non-optimized CORSIKA for the same simulation setup:
304+
305+
| Type | CORSIKA version | IACT/ATMO version | Remarks | Run Time [s] / event | Ratio to VTS-SimPipe |
306+
| -------- | -------- | -------- | -------- | -------- | -------- |
307+
| VTS-SimPipe | 7.7500 | 1.66 (2023-02-03) | default coconut build (see remarks below); [container](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika/177291090?tag=1.1.0), [docker](https://github.com/VERITAS-Observatory/VTS-SimPipe/blob/main/docker/Dockerfile-corsika); SLANT option; no VIEWCONE | 33.6 | 1. |
308+
| VTS-noopt | 7.7500 | 1.66 (2023-02-03) | no specific optimization (O3; see remarks below); [container](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-noopt/182679178?tag=20240223-115829) [docker (noopt arg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/blob/main/docker/Dockerfile-corsika-optimized) | 17.2 | 2.0 |
309+
| VTS-avx2 | 7.7500 | 1.66 (2023-02-03) | avx2 [container](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-avx2/182679269?tag=20240223-115831), [docker (avx2 arg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/blob/main/docker/Dockerfile-corsika-optimized) | 14.42 | 2.3 |
310+
| VTS-sse4 | 7.7500 | 1.66 (2023-02-03) | sse4 [container](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-sse4/182679278?tag=20240223-115831), [docker (sse4 arg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/blob/main/docker/Dockerfile-corsika-optimized) | 12.5 | 2.7 |
311+
| VTS-avx512f | 7.7500 | 1.66 (2023-02-03) | avx51f [container](https://github.com/VERITAS-Observatory/VTS-SimPipe/pkgs/container/vtsimpipe-corsika-avx512/182679206?tag=20240223-115833), [docker (avx512 arg)](https://github.com/VERITAS-Observatory/VTS-SimPipe/blob/main/docker/Dockerfile-corsika-optimized) | 17.37 | 1.9 |
312+
313+
### Remarks
314+
315+
- default Coconut C compile flags (VTS-SimPipe): `cc -DHAVE_CONFIG_H -I. -I../include -DMAX_IO_BUFFER=200000000 -DCORSIKA_VERSION=77500 -g -D_FILE_OFFSET_BITS=64 -MT libiact_a-eventio.o -MD -MP -MF .deps/libiact_a-eventio.Tpo -c -o libiact_a-eventio.o `test -f 'eventio.c'` (**no optimisation at all?**)
316+
- VTS-noopt compile flags: `cc -DHAVE_CONFIG_H -I. -I../include -DMAX_IO_BUFFER=200000000 -DCORSIKA_VERSION=77500 -std=c99 -O3 -MT libiact_a-eventio.o -MD -MP -MF .deps/libiact_a-eventio.Tpo -c -o libiact_a-eventio.o `test -f 'eventio.c'

docker/Dockerfile-care

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ RUN mkdir CARE && tar -xzf v$CARE_VERSION.tar.gz -C CARE --strip-components=1 &&
3838
FROM rootproject/root:6.24.06-centos7
3939
LABEL maintainer.name="VERITAS Collaboration"
4040
LABEL maintainer.email="gernot.maier@desy.de"
41+
LABEL org.opencontainers.image.source="https://github.com/VERITAS-Observatory/VTS-SimPipe"
42+
LABEL org.opencontainers.image.description="CARE Camera simulations as used for the VERITAS simulation pipeline."
43+
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
4144
WORKDIR /workdir
4245
COPY --from=build_image /workdir/VBF /workdir/VBF
4346
COPY --from=build_image /workdir/CARE /workdir/CARE

docker/Dockerfile-corsika

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ WORKDIR /workdir/
2323
FROM almalinux:9.3-minimal
2424
LABEL maintainer.name="VERITAS Collaboration"
2525
LABEL maintainer.email="gernot.maier@desy.de"
26+
LABEL org.opencontainers.image.source="https://github.com/VERITAS-Observatory/VTS-SimPipe"
27+
LABEL org.opencontainers.image.description="CORSIKA 7.7500 (non-optimized version) as used for the VERITAS simulation pipeline."
28+
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
2629
WORKDIR /workdir
2730
ENV DEBIAN_FRONTEND=noninteractive
2831
ARG CORSIKA=corsika-77500

docker/Dockerfile-corsika-optimized

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,23 @@ WORKDIR /workdir/corsika-77500
2828
RUN ./coconut < /dev/null
2929
ENV GCC_PATH="/usr/bin/"
3030
RUN make clean && rm -f */*.a lib/*/*.a && \
31-
if [ "$AVX_FLAG" == "avx512" ]; then \
31+
if [ "$AVX_FLAG" != "noopt" ]; then \
3232
make \
3333
CC="${GCC_PATH}/gcc -static" \
3434
CXX="${GCC_PATH}/g++ -static" \
3535
CPP="${GCC_PATH}/gcc -static -E" \
36-
F77="${GCC_PATH}/gfortran" \
37-
# F77="${GCC_PATH}/gfortran -static-libgfortran" \
38-
CFLAGS="-DCERENKOPT -DVLIBM -std=c99 -O3 -mavx512f -ffp-contract=off -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
39-
CXXFLAGS="-DCERENKOPT -DVLIBM -std=c99 -O3 -mavx512f -ffp-contract=off -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
40-
FFLAGS="-ffixed-line-length-132 -fno-automatic -frecord-marker=4 -std=legacy -DCERENKOPT -DVLIBM -std=c99 -O3 -mavx512f -ffp-contract=off -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
41-
install; \
42-
elif [ "$AVX_FLAG" != "noopt" ]; then \
43-
make \
44-
CC="${GCC_PATH}/gcc -static" \
45-
CXX="${GCC_PATH}/g++ -static" \
46-
CPP="${GCC_PATH}/gcc -static -E" \
47-
# F77="${GCC_PATH}/gfortran -L/lib64/ -static-libgfortran" \
4836
F77="${GCC_PATH}/gfortran -L/lib64/" \
4937
CFLAGS="-DCERENKOPT -DVLIBM -std=c99 -O3 -m${AVX_FLAG} -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
5038
CXXFLAGS="-DCERENKOPT -DVLIBM -std=c99 -O3 -m${AVX_FLAG} -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
51-
FFLAGS="-ffixed-line-length-132 -fno-automatic -frecord-marker=4 -std=legacy -DCERENKOPT -DVLIBM -std=c99 -O3 -m${AVX_FLAG} -ffp-contract=off -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
39+
# Note: different to CTA - no change in avx options for Fortran
40+
# FFLAGS="-ffixed-line-length-132 -fno-automatic -frecord-marker=4 -std=legacy -DCERENKOPT -DVLIBM -std=c99 -O3 -m${AVX_FLAG} -DVECTOR_SIZE=8 -DVECTOR_LENGTH=8" \
41+
FFLAGS="-ffixed-line-length-132 -fno-automatic -frecord-marker=4 -std=legacy -std=c99 -O3 -mavx2" \
5242
install; \
5343
else \
5444
make \
5545
CC="${GCC_PATH}/gcc -static" \
5646
CXX="${GCC_PATH}/g++ -static" \
5747
CPP="${GCC_PATH}/gcc -static -E" \
58-
# F77="${GCC_PATH}/gfortran -static-libgfortran" \
5948
F77="${GCC_PATH}/gfortran" \
6049
CFLAGS="-std=c99 -O3 -mavx2" \
6150
CXXFLAGS="-std=c99 -O3 -mavx2" \
@@ -72,6 +61,9 @@ WORKDIR /workdir/
7261
FROM almalinux:9.3-minimal
7362
LABEL maintainer.name="VERITAS Collaboration"
7463
LABEL maintainer.email="gernot.maier@desy.de"
64+
LABEL org.opencontainers.image.source="https://github.com/VERITAS-Observatory/VTS-SimPipe"
65+
LABEL org.opencontainers.image.description="CORSIKA 7.7500 (optimized version) as used for the VERITAS simulation pipeline."
66+
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
7567
WORKDIR /workdir
7668
ENV DEBIAN_FRONTEND=noninteractive
7769
ARG CORSIKA=corsika-77500

docker/Dockerfile-groptics

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ RUN mkdir GrOptics && tar -xzf v$GROPTICS_VERSION.tar.gz -C GrOptics --strip-com
2828
FROM rootproject/root:6.24.06-centos7
2929
LABEL maintainer.name="VERITAS Collaboration"
3030
LABEL maintainer.email="gernot.maier@desy.de"
31+
LABEL org.opencontainers.image.source="https://github.com/VERITAS-Observatory/VTS-SimPipe"
32+
LABEL org.opencontainers.image.description="GrOptics as used for the VERITAS simulation pipeline."
33+
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
3134
WORKDIR /workdir
3235
COPY --from=build_image /workdir/corsikaIOreader/corsikaIOreader /workdir/corsikaIOreader/corsikaIOreader
3336
COPY --from=build_image /workdir/GrOptics /workdir/GrOptics

docker/Dockerfile-mergevbf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ RUN mkdir EventDisplay_v4 && tar -xzf v490.5.tar.gz -C EventDisplay_v4 --strip-c
2929
FROM rootproject/root:6.24.06-centos7
3030
LABEL maintainer.name="VERITAS Collaboration"
3131
LABEL maintainer.email="gernot.maier@desy.de"
32+
LABEL org.opencontainers.image.source="https://github.com/VERITAS-Observatory/VTS-SimPipe"
33+
LABEL org.opencontainers.image.description="MergeVBF as used for the VERITAS simulation pipeline."
34+
LABEL org.opencontainers.image.licenses="BSD-3-Clause"
3235
WORKDIR /workdir
3336
COPY --from=build_image /workdir/VBF /workdir/VBF
3437
COPY --from=build_image /workdir/EventDisplay_v4 /workdir/EventDisplay_v4

0 commit comments

Comments
 (0)