IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Commits on Source (1490)
Showing with 1394 additions and 1946 deletions
*.inl gitlab-language=c++
\ No newline at end of file
......@@ -2,9 +2,23 @@
**/*~
**/*.bak
build/
install/
.vscode/
Framework/Particles/GeneratedParticleProperties.inc
flymd.html
flymd.md
Testing
tags
Environment/GeneratedMediaProperties.inc
CMakeUserPresets.json
corsika/framework/core/GeneratedParticleClasses.inc
corsika/framework/core/GeneratedParticleProperties.inc
corsika/framework/core/particle_db.pkl
corsika/media/GeneratedMediaProperties.inc
corsika/modules/epos/Generated.inc
corsika/modules/fluka/Generated.inc
corsika/modules/qgsjetII/Generated.inc
corsika/modules/sibyll/Generated.inc
corsika/modules/sophia/Generated.inc
conan_cmake/
corsika-cmake.sh
variables:
GIT_STRATEGY: $CORSIKA8_GIT_STRATEGY # clone: fresh clone, fetch: update
GIT_SSL_NO_VERIFY: "1"
GIT_DEPTH: "1"
GIT_DEPTH: "2"
# to re-use clones also in different forks
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_NAME
## Runtime options for sanitizers
......@@ -14,36 +14,36 @@ variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule
corsika_DIR: "${CI_PROJECT_DIR}/build/install" # for cmake to find corsikaConfig.cmake
# _alternatively_ corsika-data can be downloaded as submodule:
GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script,
GIT_SUBMODULE_STRATEGY: recursive # none: we get the submodules in before_script,
# normal: get submodules automatically
CTEST_OUTPUT_ON_FAILURE: 1
PIP_PARTICLE_VERSION: "0.25.1"
#
# multi-step pipeline for each commit
#
# Mote: "Draft/WIP:" merge request, non-Draft/non-WIP merge requests and "Ready for Code Review" MR are all
# Note: "Draft/WIP:" merge request, non-Draft/non-WIP merge requests and "Ready for Code Review" MR are all
# handled explicitly
#
stages:
- quality
- config
- build
- test
- build_test
- example
- build_test_example
- python
- install
- optional
####### CODE QUALITY CHECK ##############
##########################################
########### CODE QUALITY CHECK ###########
##########################################
##########################################################
check-copyrights:
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
stage: quality
tags:
- corsika
......@@ -69,134 +69,73 @@ check-clang-format:
- if: $CI_COMMIT_BRANCH
allow_failure: true
### CodeQuality tool ####
#include:
# - template: Code-Quality.gitlab-ci.yml
#
#code_quality:
# stage: quality
# rules:
# - if: '$CODE_QUALITY_DISABLED'
# when: never
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
# - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the master branch (but not in other branch pipelines)
# - if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
####### CONFIG ##############
##########################################################
# the generic config template job
# job/stage to just prepare cmake
.config:
stage: config
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
artifacts:
when: on_failure
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/CMakeFiles/CMakeOutput.log
# config for gcc
config-u-18_04:
extends: .config
image: corsika/devel:u-18.04
# config for clang
config-clang-8:
extends: .config
image: corsika/devel:clang-8
####### BUILD (only manual) ##############
##########################################################
# the generic build template job
# normal pipeline for each commit
.build:
stage: build
check-python-quality:
image: corsika/devel:u-22.04
stage: quality
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4
- cd ${CI_PROJECT_DIR}/python # change into the Python directory
- pip3 install --user -e '.[test]' # install the package + test deps
- python3 --version
- python3 -m black -t py37 --check corsika tests
- python3 -m flake8 -v corsika tests
- python3 -m isort --atomic --check-only corsika tests
- python3 -m mypy corsika
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
# build for gcc
build-u-18_04:
extends: .build
image: corsika/devel:u-18.04
# build for clang
build-clang-8:
extends: .build
image: corsika/devel:clang-8
####### TEST (only manual) ##############
##########################################
################# CONFIG #################
##########################################
##########################################################
# generic test template job
# normal pipeline for each commit
.test:
stage: test
# the generic config template job
# job/stage to just prepare cmake
.config:
stage: config
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- set -o pipefail
- ctest -j4
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
artifacts:
when: always
when: on_failure
expire_in: 3 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/CMakeFiles/CMakeOutput.log
# test for gcc
test-u-18_04:
extends: .test
image: corsika/devel:u-18.04
# config for gcc
config-u-22_04:
extends: .config
image: corsika/devel:u-22.04
# test for clang
test-clang-8:
extends: .test
image: corsika/devel:clang-8
# config for clang
config-clang-14:
extends: .config
image: corsika/devel:clang-14
####### BUILD-TEST (all builds <= Draft/WIP, default) ##############
##########################################
############### BUILD-TEST ###############
##########################################
##########################################################
# the generic build_test template job
......@@ -206,9 +145,13 @@ test-clang-8:
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4
- set -o pipefail
- ctest -j4
......@@ -227,49 +170,61 @@ test-clang-8:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# build_test for gcc
build_test-u-18_04:
build_test-u-22_04:
extends: .build_test
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
needs:
- job: config-u-18_04
- job: config-u-22_04
artifacts: false
# build_test for clang
build_test-clang-8:
build_test-clang-14:
extends: .build_test
image: corsika/devel:clang-8
image: corsika/devel:clang-14
needs:
- job: config-clang-8
- job: config-clang-14
artifacts: false
####### BUILD-TEST-EXAMPLE (only non-Draft/non-WIP) ##############
##########################################
########## BUILD-TEST-EXAMPLE ###########
##########################################
##########################################################
# generic example template job
# normal pipeline for each commit
# artefacts are needed as input for python jobs
.build_test_example:
stage: build_test_example
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- VERBOSE=1 -j4
- set -o pipefail
- ctest -j4
- cmake --install .
- mkdir -p build_examples
- cd build_examples
- cmake -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples
- mkdir -p ${CI_PROJECT_DIR}/build/build_examples
- cd ${CI_PROJECT_DIR}/build/build_examples
- export corsika_DIR=${CI_PROJECT_DIR}/build/install
- export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies
- cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug ../install/share/corsika/examples
- cmake --build . -- -j2
- cmake --build . --target run_examples -- -j2
- cmake --build . --target run_examples -- -j2
- export EXE=${CI_PROJECT_DIR}/build/install/bin/c8_air_shower # Run the example scripts
- export OUTPUT_DIR=${CI_PROJECT_DIR}/build/build_examples/example_outputs/
- export CMD="$EXE --seed 1234 --energy 1e3 -p 2212 --disable-interaction-histograms --compress --filename $OUTPUT_DIR/c8_air_shower_output"
- echo "Running... $CMD"
- $CMD
rules:
- if: '$CI_MERGE_REQUEST_ID && ($CI_MERGE_REQUEST_TITLE =~ /^Draft:/ || $CI_MERGE_REQUEST_TITLE =~ /^WIP:/)'
when: manual
......@@ -281,72 +236,40 @@ build_test-clang-8:
allow_failure: true
artifacts:
when: always
expire_in: 3 days
expire_in: 2 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs/radio_em_shower_outputs #python examples need this
- ${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output.tar #python examples need this
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
- ${CI_PROJECT_DIR}/build/CMakeCache.txt #python tests need this
- ${CI_PROJECT_DIR}/build #/bin #python tests need this
# build_test_example for gcc
build_test_example-u-18_04:
build_test_example-u-22_04:
extends: .build_test_example
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
needs:
- job: config-u-18_04
- job: config-u-22_04
artifacts: false
# build_test_example for clang
build_test_example-clang-8:
build_test_example-clang-14:
extends: .build_test_example
image: corsika/devel:clang-8
image: corsika/devel:clang-14
needs:
- job: config-clang-8
- job: config-clang-14
artifacts: false
####### INSTALL (only manual) ##############
##########################################################
# generic install template job
# make install
.install:
stage: install
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- set -o pipefail
- cmake --install .
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
# install for gcc
install-u-18_04:
extends: .install
image: corsika/devel:u-18.04
# install for clang
install-clang-8:
extends: .install
image: corsika/devel:clang-8
####### OPTIONAL ##############
##########################################
################ OPTIONAL ################
##########################################
##########################################################
# generic release template job
......@@ -356,20 +279,26 @@ install-clang-8:
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -r
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4
- set -o pipefail
- ctest -j4
- cmake --install .
- mkdir -p build_examples
- cd build_examples
- cmake -DCMAKE_BUILD_TYPE=Release ../install/share/corsika/examples
- cmake --build . -- -j2
- cmake --build . --target run_examples -- -j2
- mkdir -p ${CI_PROJECT_DIR}/build/build_examples
- cd ${CI_PROJECT_DIR}/build/build_examples
- export corsika_DIR=${CI_PROJECT_DIR}/build/install
- export corsika_CONAN_DEPENDENCIES=${CI_PROJECT_DIR}/build/install/lib/cmake/dependencies
- cmake -DCMAKE_TOOLCHAIN_FILE=${corsika_CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${corsika_CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release ../install/share/corsika/examples
- cmake --build . -- VERBOSE=1 -j4
- cmake --build . --target run_examples -- -j4
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for Code Review/' # run on merge requests, if label 'Ready for Code Review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
......@@ -388,47 +317,56 @@ install-clang-8:
paths:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# release for gcc
release-full-u-18_04:
release-full-u-22_04:
extends: .release
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
needs:
- job: config-u-18_04
- job: config-u-22_04
artifacts: false
# release for clang
release-full-clang-8:
release-full-clang-14:
extends: .release
image: corsika/devel:clang-8
image: corsika/devel:clang-14
needs:
- job: config-clang-8
- job: config-clang-14
artifacts: false
##########################################
################ COVERAGE ################
##########################################
##########################################################
# the coverage generation should either run when manually requested, OR always on the master
coverage:
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
needs:
- job: config-u-18_04
- job: config-u-22_04
artifacts: false
stage: optional
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DCOVERAGE_BUILD=True -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4
- ctest -j4
- cmake --build . --target coverage
- tar czf coverage-report.tar.gz coverage-report
coverage: '/^.*lines\.+:\s(.*\%)\s/'
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for Code Review/' # run on merge requests, if label 'Ready for Code Review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
when: manual
......@@ -446,25 +384,31 @@ coverage:
##########################################
################# SANITY #################
##########################################
##########################################################
sanity:
image: corsika/devel:u-18.04
image: corsika/devel:u-22.04
needs:
- job: config-u-18_04
- job: config-u-22_04
artifacts: false
stage: optional
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
- pip3 install conan --upgrade --user
- pip3 install particle==${PIP_PARTICLE_VERSION}
- pip3 install numpy
- mkdir -p ${CI_PROJECT_DIR}/build
- cd ${CI_PROJECT_DIR}/build
- ${CI_PROJECT_DIR}/conan-install.sh -s .. -d
- ${CI_PROJECT_DIR}/corsika-cmake.sh -c "-DWITH_CORSIKA_SANITIZERS_ENABLED=ON -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/build/install -DUSE_Pythia8_C8=C8"
- cmake --build . -- -j4
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for Code Review/' # run on merge requests, if label 'Ready for Code Review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
......@@ -476,7 +420,9 @@ sanity:
allow_failure: true
###### Python ##########
##########################################
################# Python #################
##########################################
##########################################################
# template for all Python jobs
......@@ -493,19 +439,42 @@ sanity:
- python3 -m black -t py37 corsika tests
- python3 -m flake8 corsika tests
- python3 -m pytest --cov=corsika tests
- cd ${CI_PROJECT_DIR} # reset the directory
coverage: '/^TOTAL\s*\d+\s*\d+\s*(.*\%)/'
# the default Python version Ubuntu 18.04 is Python3.8
python-3.8:
python-tests:
extends: .python
image: corsika/analysis:python-3.9.5
image: corsika/devel:u-22.04
needs:
- job: build_test_example-u-18_04
- job: build_test_example-u-22_04
artifacts: true
artifacts:
when: always
expire_in: 3 month
expire_in: 1 month
paths:
- ${CI_PROJECT_DIR}/Python/python-test.log
allow_failure: true
- ${CI_PROJECT_DIR}/python/python-test.log
allow_failure: false
python-examples:
stage: python
tags:
- corsika
image: corsika/devel:u-22.04
needs:
- job: build_test_example-u-22_04
artifacts: true
artifacts:
when: always
expire_in: 1 month
paths:
- ${CI_PROJECT_DIR}/python/examples/example_plots
script:
- export EXAMPLE_SHOWER=${CI_PROJECT_DIR}/build/build_examples/example_outputs/c8_air_shower_output.tar
- cd ${CI_PROJECT_DIR}/python
- pip3 install --user -e '.[test,examples]'
- cd ${CI_PROJECT_DIR}/python/examples
- python3 particle_distribution.py --input-dir $EXAMPLE_SHOWER
- python3 shower_profile.py --input-dir $EXAMPLE_SHOWER
- python3 first_interactions.py --input-dir $EXAMPLE_SHOWER
- export EXAMPLE_RADIO_SHOWER_DIR=${CI_PROJECT_DIR}/build/build_examples/example_outputs/radio_em_shower_outputs
- python3 radio_emission.py --input-dir $EXAMPLE_RADIO_SHOWER_DIR
variables:
GIT_STRATEGY: $CORSIKA8_GIT_STRATEGY # clone: fresh clone, fetch: update
GIT_SSL_NO_VERIFY: "1"
GIT_DEPTH: "1"
# to re-use clones also in different forks
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_NAME
## Runtime options for sanitizers
# (detect_leaks=0 because leak detection doesn't work in CI, but you can
# try to test with leak detection locally by using detect_leaks=1)
UBSAN_OPTIONS: "print_stacktrace=1"
LSAN_OPTIONS: "log_threads=1"
ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1"
# location of AirShowerPhysics/corsika-data
CORSIKA_DATA: "${CI_PROJECT_DIR}/modules/data" # the git submodule
corsika_DIR: "${CI_PROJECT_DIR}/build/install" # for cmake to find corsikaConfig.cmake
# _alternatively_ corsika-data can be downloaded as submodule:
GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script,
# normal: get submodules automatically
CTEST_OUTPUT_ON_FAILURE: 1
#
# multi-step pipeline for each commit
#
# Mote: "Draft:" merge request, non-Draft merge requests and "Ready for Code Review" MR are all
# handled explicitly
#
stages:
- quality
- config
- build
- test
- build_test
- example
- build_test_example
- python
- install
- optional
####### CODE QUALITY CHECK ##############
##########################################################
check-copyrights:
image: corsika/devel:u-18.04
stage: quality
tags:
- corsika
script:
- ./do-copyright.py
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
allow_failure: true
##########################################################
check-clang-format:
image: corsika/devel:clang-8
stage: quality
tags:
- corsika
script:
- ./do-clang-format.py --all
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
allow_failure: true
### CodeQuality tool ####
#include:
# - template: Code-Quality.gitlab-ci.yml
#
#code_quality:
# stage: quality
# rules:
# - if: '$CODE_QUALITY_DISABLED'
# when: never
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' # Run code quality job in merge request pipelines
# - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # Run code quality job in pipelines on the master branch (but not in other branch pipelines)
# - if: '$CI_COMMIT_TAG' # Run code quality job in pipelines for tags
####### CONFIG ##############
##########################################################
# the generic config template job
# job/stage to just prepare cmake
.config:
stage: config
tags:
- corsika
script:
- mkdir -p build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_Pythia8_C8=C8
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
artifacts:
when: on_failure
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/CMakeFiles/CMakeOutput.log
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull-push
# config for gcc
config-u-18_04:
extends: .config
image: corsika/devel:u-18.04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# config for clang
config-clang-8:
extends: .config
image: corsika/devel:clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### BUILD (only manual) ##############
##########################################################
# the generic build template job
# normal pipeline for each commit
.build:
stage: build
tags:
- corsika
script:
- cd build
- cmake --build . -- -j4
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull-push
# build for gcc
build-u-18_04:
extends: .build
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# build for clang
build-clang-8:
extends: .build
image: corsika/devel:clang-8
dependencies:
- config-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### TEST (only manual) ##############
##########################################################
# generic test template job
# normal pipeline for each commit
.test:
stage: test
tags:
- corsika
script:
- cd build
- set -o pipefail
- ctest -j4
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
- if: $CI_COMMIT_TAG
when: manual
- if: $CI_COMMIT_BRANCH
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull-push
# test for gcc
test-u-18_04:
extends: .test
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# test for clang
test-clang-8:
extends: .test
image: corsika/devel:clang-8
dependencies:
- build-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### BUILD-TEST (all builds <= Draft, default) ##############
##########################################################
# the generic build_test template job
# normal pipeline for each commit
.build_test:
stage: build_test
tags:
- corsika
script:
- cd build
- cmake --build . -- -j4
- set -o pipefail
- ctest -j4
rules:
- if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
allow_failure: false
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
paths:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull-push
# build_test for gcc
build_test-u-18_04:
extends: .build_test
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# build_test for clang
build_test-clang-8:
extends: .build_test
image: corsika/devel:clang-8
dependencies:
- config-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### BUILD-TEST-EXAMPLE (only non-Draft) ##############
##########################################################
# generic example template job
# normal pipeline for each commit
.build_test_example:
stage: build_test_example
tags:
- corsika
script:
- cd build
- cmake --build . -- -j4
- set -o pipefail
- ctest -j4
- make install
- mkdir -p build_examples
- cd build_examples
- cmake ../install/share/corsika/examples
- make -j4
- make -j4 run_examples | gzip -v -9 > examples.log.gz
rules:
- if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
when: manual
allow_failure: true
- if: $CI_COMMIT_BRANCH
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 3 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/build_examples/examples.log.gz
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
# build_test_example for gcc
build_test_example-u-18_04:
extends: .build_test_example
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# build_test_example for clang
build_test_example-clang-8:
extends: .build_test_example
image: corsika/devel:clang-8
dependencies:
- config-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### INSTALL ##############
##########################################################
# generic install template job
# make install
.install:
stage: install
tags:
- corsika
script:
- cd build
- set -o pipefail
- make -j2 install
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
# install for gcc
install-u-18_04:
extends: .install
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# install for clang
install-clang-8:
extends: .install
image: corsika/devel:clang-8
dependencies:
- build-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
####### OPTIONAL ##############
##########################################################
# generic release template job
# optional release pipeline for each commit
.release:
stage: optional
tags:
- corsika
script:
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4
- set -o pipefail
- ctest -j4
- make install
- mkdir -p build_examples
- cd build_examples
- cmake ../install/share/corsika/examples
- make -j4
- make -j4 run_examples | gzip -v -9 > examples.log.gz
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
artifacts:
when: always
expire_in: 3 days
reports:
junit:
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
paths:
- ${CI_PROJECT_DIR}/build/build_examples/examples.log.gz
- ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
# release for gcc
release-full-u-18_04:
extends: .release
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
# release for clang
release-full-clang-8:
extends: .release
image: corsika/devel:clang-8
dependencies:
- config-clang-8
cache:
key: "${CI_COMMIT_REF_SLUG}-clang"
##########################################################
# the coverage generation should either run when manually requested, OR always on the master
coverage:
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
stage: optional
tags:
- corsika
script:
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Coverage -DUSE_Pythia8_C8=C8
- cmake --build . -- -j4
- ctest -j4
- cmake --build . --target coverage
- tar czf coverage-report.tar.gz coverage-report
coverage: '/^.*lines\.+:\s(.*\%)\s/'
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
artifacts:
when: always
expire_in: 1 year
paths:
- ${CI_PROJECT_DIR}/build/coverage-report.tar.gz
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
key: "${CI_COMMIT_REF_SLUG}-gcc"
##########################################################
sanity:
image: corsika/devel:u-18.04
dependencies:
- config-u-18_04
stage: optional
tags:
- corsika
script:
- cd build
- cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON
- cmake --build . -- -j4
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
allow_failure: true
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- if: $CI_COMMIT_TAG
when: manual
allow_failure: true
cache:
paths:
- ${CI_PROJECT_DIR}/build/
untracked: true
policy: pull
key: "${CI_COMMIT_REF_SLUG}-gcc"
##########################################################
# template for all Python jobs
.python:
stage: python
tags:
- corsika
before_script:
- apt-get update && apt-get install -y python3-pip
- pip3 install --upgrade cython
script:
- cd ${CI_PROJECT_DIR}/python # change into the Python directory
- pip3 install --user -e '.[test]' # install the package + test deps
- python3 --version
- python3 -m mypy corsika
- python3 -m isort --atomic --check-only corsika tests
- python3 -m black -t py37 corsika tests
- python3 -m flake8 corsika tests
- python3 -m pytest --cov=corsika tests
- cd ${CI_PROJECT_DIR} # reset the directory
coverage: '/^TOTAL\s*\d+\s*\d+\s*(.*\%)/'
# the default Python version Ubuntu 18.04 is Python3.8
python-3.8:
extends: .python
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
cache:
key: "${CI_COMMIT_REF_SLUG}-gcc"
artifacts:
when: always
expire_in: 1 year
paths:
- ${CI_PROJECT_DIR}/Python/python-test.log
allow_failure: true
Issues: Closes #....
The code approval procedure is described in the wiki: [Code approval procedure wiki](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
The code approval procedure is described in the wiki: [Code approval procedure wiki](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
- [ ] The MR is without `WIP/Draft` status
- [ ] Make sure the most recent CI jobs (config, quality, build_test_example) all run fine with no failures
- if "check clang-format" failed: the code contributor has to run `./do-clang-format.py --apply` eventually with the `--all` option
- if "check copyright" failed the code contributor has to run`./do-copyright.py --add=20xy`
- [ ] Make sure also the jobs with MR-label `ready for code review` succeed. This includes the optional jobs, in particular 'coverage', 'release-clang-8", "release-u-18.04" and make sure no problems occur. You may have to trigger a pipeline manually to check this.
- [ ] Make sure also the jobs with MR-label `ready for code review` succeed. This includes the optional jobs, in particular 'coverage', 'release-full-clang-14", "release-full-u-22_04" and make sure no problems occur. You may have to trigger a pipeline manually to check this.
- [ ] Check in the "coverage" job output that the coverage did not decrease. It should always stay, or increase. If it decreased --> ask contributor to add further needed unit tests, and check coverage report.
- On the MR page, open the "Open in Web IDE" tool
- [ ] Check if the provided solution solves the Issue, discuss on gitlab
......
[submodule "modules/data"]
path = modules/data
url = ../../AirShowerPhysics/corsika-data.git
branch = master
shallow = true
[submodule "modules/conex"]
path = modules/conex
path = modules/conex/cxroot
url = ../../AirShowerPhysics/cxroot.git
branch = master
shallow = true
* milestone1 release: So 7. Okt 15:51:07 CEST 2018
......@@ -3,17 +3,20 @@
#
# See file AUTHORS for a list of contributors.
#
# This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3). See file LICENSE for a full version of
# the license.
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
cmake_minimum_required (VERSION 3.9)
#+++++++++++++++++++++++++++++
# project name
# version is: "8.major.minor.patch"
# major: API changes
# minor: no API changes
# patch: bug fix and small improvements
#
set (c8_version 8.0.0)
set (c8_version 8.0.0.0)
project (
corsika
VERSION ${c8_version}
......@@ -21,6 +24,11 @@ project (
LANGUAGES CXX
)
#+++++++++++++++++++++++++++++
# for pre-defined standard path
#
include (GNUInstallDirs)
#+++++++++++++++++++++++++++++
# prevent in-source builds and give warning message
#
......@@ -35,12 +43,17 @@ endif ()
# cmake version-specific settings
#
# https://cmake.org/cmake/help/latest/policy/CMP0079.html
if (${CMAKE_VERSION} VERSION_GREATER "3.13.0")
cmake_policy (SET CMP0079 NEW)
endif ()
if (POLICY CMP0079)
cmake_policy (SET CMP0079 NEW)
endif ()
# Download timestamp for external modules
if (POLICY CMP0135)
cmake_policy (SET CMP0135 OLD)
endif ()
# AUtomatically add extensions to filenames if needed (old behaviour)
if (POLICY CMP0115)
cmake_policy (SET CMP0115 OLD)
endif ()
#+++++++++++++++++++++++++++++
# warn user if system is not UNIX
......@@ -53,7 +66,13 @@ endif ()
# cmake path dir, and cmake config
#
set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
if(DEFINED CONAN_CMAKE_DIR)
list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}")
endif(DEFINED CONAN_CMAKE_DIR)
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1`
# ignore many irrelevant Up-to-date messages during install
set (CMAKE_INSTALL_MESSAGE LAZY)
......@@ -72,7 +91,7 @@ include (corsikaDefines)
# check if compiler is C++17 compliant
#
include (CheckCXXCompilerFlag)
check_CXX_compiler_flag ("--std=c++17" COMPILER_SUPPORTS_CXX17)
check_CXX_compiler_flag ("-std=c++17" COMPILER_SUPPORTS_CXX17)
if (NOT COMPILER_SUPPORTS_CXX17)
message (FATAL "| CORSIKA8 > The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler.")
endif ()
......@@ -102,15 +121,8 @@ add_compile_options (
# Setup external dependencies.
#
###
include (conan) # self-provided in 'cmake' directory
#
# download and build all dependencies
message (STATUS "Installing dependencies from Conan (this may take some time)...")
conan_cmake_run (CONANFILE conanfile.txt
BASIC_SETUP CMAKE_TARGETS
BUILD missing
BUILD_TYPE "Release"
SETTINGS compiler.libcxx=libstdc++11)
#
# add cnpy temporarily. As long as SaveBoostHistogram does not save to parquet directly
#
......@@ -120,28 +132,66 @@ add_subdirectory (externals/cnpy)
# Coverage
#
# targets and settings needed to generate coverage reports
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
#if (CMAKE_BUILD_TYPE STREQUAL Coverage)
SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build")
if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n")
set (c8_lcov_download_url "https://github.com/linux-test-project/lcov/releases/download")
set (c8_lcov_version "1.16")
set (c8_lcov_install_dir "${CMAKE_BINARY_DIR}/lcov")
include(ExternalProject)
ExternalProject_Add(lcov
URL ${c8_lcov_download_url}/v${c8_lcov_version}/lcov-${c8_lcov_version}.tar.gz
DOWNLOAD_NO_EXTRACT 0
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND make -C <SOURCE_DIR> install PREFIX=${c8_lcov_install_dir}
)
find_package (Perl REQUIRED)
# compile coverage under -O0 to avoid any optimization, function elimation etc.
add_compile_options ("-O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage")
# search for local lcov
find_program (c8_lcov_bin lcov)
if (NOT c8_lcov_bin)
set (c8_lcov_bin "${c8_lcov_install_dir}/bin/lcov")
message ("use C8 version of lcov ${c8_lcov_bin}")
endif ()
# search for local genhtml
find_program (c8_genhtml_bin genhtml)
if (NOT c8_genhtml_bin)
set (c8_genhtml_bin "${c8_lcov_install_dir}/bin/genhtml")
message ("use C8 version of genhtml ${c8_genhtml_bin}")
endif ()
set (GCOV gcov CACHE STRING "gcov executable" FORCE)
set (LCOV_BIN_DIR "${PROJECT_SOURCE_DIR}/externals/lcov/bin")
# collect coverage data
add_custom_command (
OUTPUT raw-coverage.info
COMMAND ${CMAKE_COMMAND} -E echo "Note: you need to run ctest at least once to generate the coverage data"
COMMAND ${LCOV_BIN_DIR}/lcov --gcov-tool=${GCOV} --directory . --capture --output-file raw-coverage.info
COMMAND ${c8_lcov_bin} --gcov-tool=${GCOV} --rc lcov_branch_coverage=1
--directory . --capture --output-file raw-coverage.info
)
# remove uninteresting entries
add_custom_command (
OUTPUT coverage.info
COMMAND ${LCOV_BIN_DIR}/lcov -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${LCOV_BIN_DIR}/lcov --remove coverage2.info
"*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*"
"*/include/Pythia8/*" "*/install/*" "${CMAKE_SOURCE_DIR}/modules/*"
"${CMAKE_BINARY_DIR}/modules/*"
COMMAND ${c8_lcov_bin} -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${c8_lcov_bin} --remove coverage2.info
"*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*"
"*/include/Pythia8/*" "*/install/*"
"${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*"
"*/cxroot/*" "*/.conan2/*" "/boost/*"
--output-file coverage.info
COMMAND ${CMAKE_COMMAND} -E remove coverage2.info
DEPENDS raw-coverage.info
......@@ -149,10 +199,11 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage)
# generate html report
add_custom_command (
OUTPUT coverage-report
COMMAND ${LCOV_BIN_DIR}/genhtml --demangle-cpp coverage.info -o coverage-report
COMMAND ${c8_genhtml_bin} --branch-coverage --show-details --title "CORSIKA 8 test coverage" --legend --demangle-cpp coverage.info -o coverage-report
DEPENDS coverage.info
)
add_custom_target (coverage DEPENDS coverage-report)
endif ()
#+++++++++++++++++++++++++++++
......@@ -191,13 +242,14 @@ set (public_CORSIKA8_targets CORSIKA8)
# CORSIKA8
#
add_library (CORSIKA8 INTERFACE)
set_target_properties (
CORSIKA8
PROPERTIES
INTERFACE_CORSIKA8_MAJOR_VERSION 0
COMPATIBLE_INTERFACE_STRING CORSIKA8_MAJOR_VERSION
)
#
target_include_directories (
CORSIKA8
INTERFACE
......@@ -205,17 +257,29 @@ target_include_directories (
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)
# since CORSIKA8 is a header only library we must specify all link dependencies here:
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(CLI11 REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(spdlog REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Arrow REQUIRED)
find_package(PROPOSAL REQUIRED)
find_package(Catch2 REQUIRED)
target_link_libraries (
CORSIKA8
INTERFACE
CONAN_PKG::proposal
CONAN_PKG::eigen
CONAN_PKG::spdlog
CONAN_PKG::boost
CONAN_PKG::yaml-cpp
CONAN_PKG::arrow
CONAN_PKG::cli11
BZip2::BZip2
Boost::filesystem
CLI11::CLI11
Eigen3::Eigen
spdlog::spdlog
yaml-cpp::yaml-cpp
Parquet::parquet_static
PROPOSAL::PROPOSAL
cnpy # for SaveBoostHistogram
)
......@@ -232,12 +296,23 @@ add_subdirectory (documentation)
#
set (CORSIKA_DATA_WITH_TEST ON) # we want to run the corsika-data unit test
add_subdirectory (modules/data) # this is corsika-data (submodule)
add_subdirectory (modules/common)
add_subdirectory (modules/pythia8)
add_subdirectory (modules/sibyll)
add_subdirectory (modules/sophia)
add_subdirectory (modules/qgsjetII)
add_subdirectory (modules/urqmd)
add_subdirectory (modules/conex)
add_subdirectory (modules/epos)
add_subdirectory (modules/tauola)
add_subdirectory (modules/fluka)
#
#+++++++++++++++++++++++++++++++
# standard applications
#
add_subdirectory(applications)
#+++++++++++++++++++++++++++++++
# unit testing
......@@ -252,72 +327,120 @@ install (
EXPORT CORSIKA8PublicTargets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# header only part
# header only part, just copy entire directory tree
#
install (DIRECTORY corsika DESTINATION include)
#
# generate cmake config package version (for find_package)
#
write_basic_package_version_file (
${PROJECT_BINARY_DIR}/corsikaConfigVersion.cmake
VERSION ${c8_version}
COMPATIBILITY SameMajorVersion
)
# export targets in build tree
#
# export targets in build tree (for find_package)
#
export (
EXPORT CORSIKA8PublicTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/corsikaTargets.cmake"
NAMESPACE CORSIKA8::
)
# export targets in install tree
#
# export targets in install tree (for find_package)
#
install (
EXPORT CORSIKA8PublicTargets
FILE corsikaTargets.cmake
NAMESPACE CORSIKA8::
DESTINATION lib/cmake/corsika
)
# config for build tree
if(DEFINED CONAN_CMAKE_DIR)
install (
DIRECTORY conan_cmake/
DESTINATION lib/cmake/dependencies
)
endif(DEFINED CONAN_CMAKE_DIR)
#
# config for build tree (for find_package)
#
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/corsikaConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
# corsikaDefines for build tree
#
# corsikaDefines
#
configure_package_config_file (
cmake/corsikaDefines.cmake
${PROJECT_BINARY_DIR}/corsikaDefines.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
# config for install tree
# overwrite with install location (if it was build as part of corsika)
#
# config for install tree (for find_package)
# overwrite with install locations (if it was build as part of corsika)
#
set (Pythia8_INCDIR ${Pythia8_INCDIR_INSTALL})
set (Pythia8_LIBDIR ${Pythia8_LIBDIR_INSTALL})
configure_package_config_file (
cmake/corsikaConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/corsikaConfig.cmake
INSTALL_DESTINATION ${PROJECT_BINARY_DIR}/do_not_need_this
${PROJECT_BINARY_DIR}/corsikaConfig.cmake-install
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
)
#
# generate "corsika/corsika.hpp" file with cmake-level details and paths
# first for build-tree
#
# the location of the "corsika-data" is of fundamental importance
set (CORSIKA_CMAKE_DATA_DIR ${CMAKE_SOURCE_DIR}/modules/data)
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika/corsika.hpp
)
#
# second also for install-tree
#
set (CORSIKA_CMAKE_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/corsika/data")
configure_file (
src/corsika.hpp.in
${PROJECT_BINARY_DIR}/corsika.hpp-install
)
#
# installation of cmake and config files
#
install (
FILES
${CMAKE_BINARY_DIR}/conanbuildinfo.cmake
${CMAKE_BINARY_DIR}/conaninfo.txt
${CMAKE_BINARY_DIR}/corsikaConfig.cmake
${CMAKE_BINARY_DIR}/corsikaDefines.cmake
${CMAKE_BINARY_DIR}/corsikaConfigVersion.cmake
DESTINATION lib/cmake/corsika
)
#
# install and rename install-level corsikaConfig.cmake
#
install (
FILES
${CMAKE_BINARY_DIR}/corsikaConfig.cmake-install
RENAME corsikaConfig.cmake
DESTINATION lib/cmake/corsika
)
#
# also install-level config.hpp
#
install (FILES
${PROJECT_BINARY_DIR}/corsika.hpp-install
RENAME corsika.hpp
DESTINATION include/corsika
)
#
# examples
#
install (DIRECTORY examples DESTINATION share/corsika)
install (DIRECTORY examples DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# data
#
install (DIRECTORY modules/data DESTINATION ${CMAKE_INSTALL_DATADIR}/corsika)
#
# tools
#
......
# Collaboration agreement
The CORSIKA project very much welcomes all collaboration and
contributions. The aim of the CORSIKA project is to create a
scientific software framework as a fundamental tool for research. The
collaboration agreement and the licensing model are based on the
guidelines layed out by HSF
[[1]](https://hepsoftwarefoundation.org/activities/licensing.html) or
CERN
[[2]](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwiLqKG00dXdAhUOZFAKHdIwAh4QFjAAegQIARAC&url=https%3A%2F%2Findico.cern.ch%2Fcategory%2F4251%2Fattachments%2F101%2F505%2FOSL-2012-01-Open_Source_Licences_at_CERN-Short_version.pdf&usg=AOvVaw1n4S0PQCSeE6wbdfdhKDqF),
[[3]](http://legal.web.cern.ch/licensing/software), and follow the
examples of other big scientific software projects.
The CORSIKA project consists of the contributions from the scientific
community and individuals in a best effort to deliver the best
possible performance and physics output.
The MCnet guidelines developed by [www.montecarlonet.org](www.montecarlonet.org)
are copied in [MCNET_GUIDELINES](MCNET_GUIDELINES) -- they provide a very good
additional scope that contributors should read and consider.
## The software license of the CORSIKA project
The license adopted for the CORSIKA project is the explicit copyleft
license GPLv3, as copied in full in the file
[LICENSE](LICENSE). Each source file of the CORSIKA project contains a
short statement of the copyright and this license. Each binary or
source code release of CORSIKA contains the file LICENSE. The
code, documentation and content in the folder [./externals](./externals)
is not integral part of the CORSIKA project and can be based on, or
include, other licenses, which must be compatible with GPLv3.
The folder [./modules](./modules) contains the code of several
external physics models for your convenience. Please consult the
original model authors and honor their policies and licenses.
Of course, we have their consent to
distribute their code together with CORSIKA 8.
Check the content of these folders carefully for details and additional
license information. It depends on the configuration of
the build system to what extend this code is used to build CORSIKA.
## Contributing
If you want to contribute, you need to read
[the GUIDELINES](CONTRIBUTING.md) and comply with these rules, or help to
improve them.
# Guidelines for code development, structure, formating etc.
The CORSIKA Project very much welcomes contributions. Here we outlined
The CORSIKA Project very much welcomes contributions. Here we outline
how you can find the right place to contribute, and how to do that.
Connect to https://gitlab.ikp.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in touch with the project.
The CORSIKA Project decides on the [GUIDELINES](CONTRIBUTING.md) and can decide to
Connect to https://gitlab.iap.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in touch with the project.
The CORSIKA Project decides on the [contributing guidelines](CONTRIBUTING.md) and can decide to
change/improve them.
# How to contribute
......@@ -20,7 +20,7 @@ change/improve them.
- Proposed code to close one issue (located in a specific git
branch) is reviewed, discussed, and eventually merged
into the master branch via a merge-request (MR) to close the issue.
- all merge request will undergo a code review, and must be approved before merge, in order to ensure high code qualtiy: [Code Approval Procedure](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
- all merge request will undergo a code review, and must be approved before merge, in order to ensure high code qualtiy: [Code Approval Procedure](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Code-Approval-Procedure)
## Code formatting
......@@ -45,7 +45,7 @@ e.g. [link1](https://clangformat.com/) or
## Coding rules, conventions and guidelines
Please read the [Coding wiki page](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/-/wikis/Coding-Conventions-and-Guidelines).
Please read the [Coding wiki page](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Coding-Conventions-and-Guidelines).
......@@ -53,15 +53,14 @@ Please read the [Coding wiki page](https://gitlab.ikp.kit.edu/AirShowerPhysics/c
## Release versioning scheme
Releases of CORSIKA 8 are thought to be the baseline for larger scale
validation, and full production. The releases are numbered as x.y.z,
starting with x=8, which will not be changed for CORSIKA 8. The y index is
updated for new releases that normally contain improved or
validation, and full production. The releases are numbered as CORSIKA 8 vx.y.z,
starting with x=1. The x index is updated for new releases that normally contain improved or
enhanced physics performance, and also interface
changes to accomodate improvements. The z index can be updated more
changes to accomodate improvements. The y and z indices can be updated more
frequently for bug fixes or new features. Changes in z will not
contain interface changes, thus, production code will remain
fully compatible within changes of z. Special releases of CORSIKA will
also have a release names.
fully compatible within changes of z. Special releases of CORSIKA might
also have a release name.
# How to become scientific author of the CORSIKA Project
......@@ -70,9 +69,9 @@ The CORSIKA Project decides on who becomes scientific author. The
following conditions are sufficient, but not all of them are
required all the time:
- responsibility for a particular functionality or software/management part
- have read and follow these [GUIDELINES](CONTRIBUTING.md)
- have read and follow our [contributing guidelines](CONTRIBUTING.md)
- active in the CORSIKA Project, that means responsive to
discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.ikp.kit.edu,
of relevant *Issues*, or in (phone) meetings
- agreement to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md)
discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.iap.kit.edu,
of relevant *Issues*, in (phone) meetings or our Mattermost workspace
- agreement to the [using and collaborating agreement](USING_COLLABORATING.md)
- the members of the CORSIKA Project must agree
This diff is collapsed.
Maintainers of the CORSIKA8 project are collaborators actively taking
care of code contributions, quality control, development, and related
discussions.
General and infrastructure:
- Ralf Ulrich <ralf.ulrich@kit.edu>, KIT
- Maximilian Reininghaus <maximilian.reininghaus@kit.edu>, KIT
- Hans Dembinski <hdembins@mpi-hd.mpg.de>, Dortmund
- Antonio Augusto Alves Junior <antonio.junior@kit.edu>, KIT
High performance, GPU:
- Dominik Baack <dominik.baack@tu-dortmund.de>, Dortmund
- Antonio Augusto Alves Junior <antonio.junior@kit.edu>, KIT
- Luisa Arrabito <arrabito@in2p3.fr>, Montpellier
Electromagnetic models:
- Jean-Marco Alameddine <jean-marco.alameddine@udo.edu>, Dortmund
- Jan Soedingrekso <jan.soedingrekso@tu-dortmund.de>, Dortmund
- Maximilian Sackel <maximilian.sackel@udo.edu>, Dortmund
Hadron models:
- Felix Riehn <friehn@lip.pt>, Santiago/Lisbon
- Anatoli Fedynitch <anatoli.fedynitch@icecube.wisc.edu> ICRR Tokyo
Output formats and infrastructure:
- Remy Prechelt <prechelt@hawaii.edu>, UHM
- Ralf Ulrich <ralf.ulrich@kit.edu>, KIT
Python library:
- Remy Prechelt <prechelt@hawaii.edu>, UHM
Radio:
- Remy Prechelt <prechelt@hawaii.edu>
- Tim Huege <tim.huege@kit.edu>, KIT
Testing, containers:
- Lukas Nellen <lukas@nucleares.unam.mx>
# CORSIKA 8 Framework for Particle Cascades in Astroparticle Physics
# CORSIKA 8 Framework for Particle Cascades in Astroparticle Physics
The purpose of CORSIKA is to simulate any particle cascades in
astroparticle physics or astrophysical context. A lot of emphasis is
The purpose of CORSIKA 8 is to simulate any particle cascades in
astroparticle physics or astrophysical context. A lot of emphasis has been
put on modularity, flexibility, completeness, validation and
correctness. To boost computational efficiency different techniques
correctness. To boost computational efficiency, different techniques
are provided, like thinning or cascade equations. The aim is that
CORSIKA remains the most comprehensive framework for simulating
CORSIKA 8 remains the most comprehensive framework for simulating
particle cascades with stochastic and continuous processes.
The software makes extensive use of static design patterns and
compiler optimization. Thus, the most fundamental configuration
decision of the user must be performed at compile time. At run time
decisions of the user must be performed at compile time. At run time,
model parameters can still be changed.
CORSIKA 8 is by default released under the GPLv3 license. See [license
file](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE)
CORSIKA 8 is by default released under the BSD 3-Clause License. See [license
file](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE)
which is part of every release and the source code.
If you use, or want to refer to, CORSIKA 8 please cite ["Towards a Next
Generation of CORSIKA: A Framework for the Simulation of Particle
Cascades in Astroparticle Physics", Comput.Softw.Big Sci. 3 (2019)
2](https://doi.org/10.1007/s41781-018-0013-0). We kindly ask (and
require) any relevant improvement or addition to be offered or
Cascades in Astroparticle Physics", Comput. Softw. Big Sci. 3 (2019)
2](https://doi.org/10.1007/s41781-018-0013-0) as well as
["Simulating radio emission from particle cascades with CORSIKA 8", Astropart. Phys. 166 (2025)
103072](https://doi.org/10.1016/j.astropartphys.2024.103072).
We kindly ask (and require) any relevant improvement or addition to be offered or
contributed to the main CORSIKA 8 repository for the benefit of the
whole community.
When you plan to contribute to CORSIKA 8 check the guidelines outlined here:
CORSIKA 8 makes use of various third-party code, in particular interaction
models. Please check the [using and collaborating
agreement](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/USING_COLLABORATING.md)
for further information on this topic.
If you plan to contribute to CORSIKA 8, please check the guidelines outlined here:
[coding
guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code
that fails the review by the CORSIKA author group must be improved
guidelines](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code
that fails the review by the CORSIKA 8 author group must be improved
before it can be merged in the official code base. After your code has
been accepted and merged, you become a contributor of the CORSIKA 8
project (code author).
project (code author).
IMPORTANT: Before you contribute, you need to read and agree to the
[collaboration
agreement](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The agreement can be discussed, and eventually improved.
We also want to point you to the [MCnet
guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES), which are very useful also for us.
IMPORTANT: Before you contribute, you need to read and agree to the conditions set out in the
[using and collaborating
agreement](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/blob/master/USING_COLLABORATING.md).
The agreement can be discussed, and eventually improved if necessary.
## Get in contact
* Connect to https://gitlab.ikp.kit.edu register yourself and join the "Air Shower Physics" group. Write to me (ralf.ulrich@kit.edu) only in case there are problems with that.
* Join our chat threads using Mattermost via this [invite link](https://mattermost.hzdr.de/signup_user_complete/?id=xtdd8jyt6trbiezt71gaz3z4ge&md=link&sbr=su). Click the `GitLab` button, then `Sign in with Helmholtz ID`. You will be able to make an account by either finding your institution, or using your e.g. ORCID, GitHub, or Google account.
* Connect to https://gitlab.iap.kit.edu, register yourself and join the "Air Shower Physics" group. Write to us on Mattermost (in the User Questions channel), or directly contact one of the [steering comittee members](https://gitlab.iap.kit.edu/AirShowerPhysics/corsika/-/wikis/Steering-Committee) in case there are problems with that.
* Connect to corsika-devel@lists.kit.edu (self-register at
https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in
touch with the project.
* Register on the corsika slack channel.
## Installation
CORSIKA 8 is tested regularly at least on gcc7.3.0 and clang-8.0.0.
CORSIKA 8 is tested regularly at least on `gcc11.0.0` and `clang-14.0.0`.
### Prerequisites
You will also need:
- Python 3 (supported versions are Python >= 3.6), with pip
- conan (via pip)
- cmake
- cmake > 3.4
- git
- g++, gfortran, binutils, make
- optional: FLUKA (see below)
On a bare Ubuntu 20.04, just add:
On a bare Ubuntu machine, just add:
``` shell
sudo apt-get install python3 python3-pip cmake g++ gfortran git doxygen graphviz
```
On a bare CentOS 7 install python3, pip3 (pip from python3) and cmake3. Any of the devtools 7, 8, 9 should work (at least).
Also initialize devtools, before building CORSIKA 8:
### Creating a virtual environment and Conan
It is recommended that you install CORSIKA 8 and its dependencies within a python3 virtual environment.
To do so, you can run the following.
``` shell
source /opt/rh/devtoolset-9/enable
# Create the environment using your native python3 binary
python3 -m venv /path/to/new/virtual/environment/corsika-8
# Load the environment (should be run each time you open a new terminal)
source /path/to/new/virtual/environment/corsika-8/bin/activate
```
You will need to load the environment each time that you open a new terminal.
CORSIKA 8 uses the [conan](https://conan.io/) package manager to
manage our dependencies. If you do not have Conan installed, it can be
installed with:
manage our dependencies. Currently, version 2.50.0 or higher is required.
**Note**: if you are NOT using a virtual environment, you may want to use the `pip install --user` flag.
``` shell
pip install --user conan
pip install conan particle==0.25.1 numpy
```
### Compiling
### Enabling FLUKA support
For legal reasons we do not distribute/bundle FLUKA together with CORSIKA 8.
As FLUKA is the standard low-energy hadronic interaction model for CORSIKA 8, you have to download
it separately from (http://www.fluka.org/), which requires registering there as FLUKA user.
The following should be done *before* compiling CORSIKA 8:
1. Note your system's version of gfortran (`gfortran --version`) and glibc (`ldd --version`)
2. Download the FLUKA __binary__, ensuring that it matches the versions you found above
3. Download the FLUKA __data file__ (will be named something similar to __fluka20xy.z-data.tar.gz__).
4. Un-tar the files that you downloaded using `tar -xf <filename>`
5. Set environmental variables `export FLUFOR=gfortran` and `export FLUPRO=<path to where you unzipped the files>`. Note that the `FLUPRO` directory should contain __libflukahp.a__. Both of these variables will have to be set every time you open a new terminal.
6. Go to the `FLUPRO` directory and run `make`. This will compile an exe, __flukahp__, in your current directory.
7. Follow the normal steps to compile CORSIKA 8 (see below).
Once Conan is installed, follow these steps to download and install CORSIKA 8:
When you later install CORSIKA 8, you should see a message during the __cmake__ step indicating the FLUKA was correctly found.
``` shell
git clone --recursive git@gitlab.ikp.kit.edu:AirShowerPhysics/corsika.git
libflukahp.a found in directory <some location here> via FLUPRO environment variable
FLUKA support is enabled.
```
### Compiling CORSIKA 8
Once Conan is installed and FLUKA provided, follow these steps to download and install CORSIKA 8:
``` shell
cd ./top/directory/for/corsika/installation
git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git
# Or for https: git clone --recursive https://gitlab.iap.kit.edu/AirShowerPhysics/corsika.git
mkdir corsika-build
cd corsika-build
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j8
../corsika/conan-install.sh --source-directory ../corsika --release-with-debug
# conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds.
../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DWITH_FLUKA=ON -DCMAKE_INSTALL_PREFIX=../corsika-install"
make -j4 #The number should match the number of available cores on your machine
make install
```
## Alternate installation using docker containers
## Installation (using docker containers)
There are docker containers prepared that bring all the environment and packages you need to run CORSIKA. See [docker hub](https://hub.docker.com/repository/docker/corsika/devel) for a complete overview.
There are docker containers prepared that bring all the environment and packages you need to run CORSIKA. See [docker hub](https://hub.docker.com/repository/docker/corsika/devel) for a complete overview.
### Prerequisites
You only need docker, e.g. on Ubunut: `sudo apt-get install docker` and of course root access.
You only need docker, e.g. on Ubuntu: `sudo apt-get install docker` and of course root access.
## Compiling
### Compiling
Follow these steps to download and install CORSIKA 8, master development version
```shell
git clone --recursive https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika.git
cd ./top/directory/for/corsika/installation
git clone --recursive git@gitlab.iap.kit.edu:AirShowerPhysics/corsika.git
sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash
mkdir build
cd build
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j8
mkdir corsika-build
cd corsika-build
../corsika/conan-install.sh --source-directory ../corsika --release-with-debug
# conan-install.sh takes required options from command line to install dependencies for 'Debug', 'Release' and 'RelWithDebInfo' builds.
../corsika/corsika-cmake.sh -c "-DCMAKE_BUILD_TYPE="RelWithDebInfo" -DWITH_FLUKA=ON -DCMAKE_INSTALL_PREFIX=../corsika-install"
make -j4 #The number should match the number of available cores on your machine
make install
```
## Runing Unit Tests
## Running Unit Tests
To run the unit tests, do the following.
Note, before you run *any* executbale you must also define the
`CORSIKA_DATA` environment variable to point to the location where you
cloned corsika `modules/data`, thus typically
```shell
export CORSIKA_DATA=$PWD/../corsika/modules/data
cd ./corsika-build
ctest -j4 #The number should match the number of available cores on your machine
```
To run the Unit Tests, just type `ctest` in your build area.
## Running applications and examples
## Running examples
### Standard applications
To see how a relatively simple hadron cascade develops,
see `examples/cascade_example.cpp` for a starting point.
Applications for standard use-cases are located in the `applications` directory.
These are example scripts that can be used directly or slightly modified for your use case.
See [applications/README.md] for more.
The applications are compiled automatically after running `make` and will appear your `corsika-build/bin` directory.
After running `make install` the binaries will also be copied into your `corsika-install/bin` directory as well.
To run the cascade_example, or any other CORSIKA 8 application, you
must first compile it wrt. to the CORSIKA 8 header-only framework. This
can be done best by copying
e.g. `corsika-install/share/corsika/examples/` to your working place
(e.g. `corsika-work`).
Next, you need to define the environment variable `corsika_DIR` to point to, either,
your build, or your install area. Thus, e.g.
For example, from inside your `corsika-install/bin` directory, run
```shell
export corsika_DIR=<dir where you installed CORSIKA 8 to, or where you buld it">
c8_air_shower --pdg 2212 -E 1e5 -f my_shower
```
This will run a vertical 100 TeV proton shower and will create and put the output into `./my_shower`.
Then compile your example/application with
### Building the examples
Unlike the applications, the examples must be compiled as a second step.
From your top corsika directory, (the one that includes `corsika-build` and `corsika-install`) run
```shell
cd corsika-work
cmake .
make
bin/cascade_example
export CONAN_DEPENDENCIES=$PWD/corsika-install/lib/cmake/dependencies
cmake -DCMAKE_TOOLCHAIN_FILE=${CONAN_DEPENDENCIES}/conan_toolchain.cmake -DCMAKE_PREFIX_PATH=${CONAN_DEPENDENCIES} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=RelWithDebInfo -Dcorsika_DIR=$PWD/corsika-build -DWITH_FLUKA=ON -S $PWD/corsika/examples -B $PWD/corsika-build-examples
cd corsika-build-examples
make -j4 #The number should match the number of available cores on your machine
```
Visualize output (needs gnuplot installed):
You can run the examples by using the binaries in `corsika-build-examples/bin/`.
For example:
```shell
bash $corsika_DIR/share/corsika/tools/plot_tracks.sh tracks.dat
firefox tracks.dat.gif
corsika-build-examples/bin/known_particles
```
(note, if you use the corsika_DIR to point to the build area: the script `plot_tracks.sh` is
not copied to the build area, it is only part of the source tree at `tools/plot_tracks.sh`)
Or also consider the `vertical_EAS` example in the same directory,
which can be configured with command line options.
Run `bin/vertical_EAS` to get basic help.
This will print out all of the particles that are known by CORSIKA.
### Generating doxygen documentation
To generate the documentation, you need doxygen and graphviz. If you work with
the docker corsika/devel containers this is already included.
Otherwise, e.g. on Ubuntu 18.04, do:
To generate the documentation, you need doxygen and graphviz. If you work with
the docker corsika/devel containers this is already included.
Otherwise, e.g. on Ubuntu machines, do:
```shell
sudo apt-get install doxygen graphviz
```
Switch to the corsika build directory and do
Switch to the `corsika-build` directory and do
```shell
make doxygen
make docs
make install
```
open with firefox:
```shell
firefox ../corsika-install/share/corsika/doc/html/index.html
```
CORSIKA 8 Framework for Particle Cascades in Astroparticle Physics
===================================================================
The purpose of CORSIKA is to simulate any particle cascades in
astroparticle physics or astrophysical context. A lot of emphasis is
put on modularity, flexibility, completeness, validation and
correctness. To boost computational efficiency different techniques
are provided, like thinning or cascade equations. The aim is that
CORSIKA remains the most comprehensive framework for simulating
particle cascades with stochastic and continuous processes.
The software makes extensive use of static design patterns and
compiler optimization. Thus, the most fundamental configuration
decision of the user must be performed at compile time. At run time
model parameters can still be changed.
CORSIKA 8 is by default released under the GPLv3 license. See `license
file <https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE>`_
which is part of every release and the source code.
If you use, or want to refer to, CORSIKA 8 please cite `"Towards a Next
Generation of CORSIKA: A Framework for the Simulation of Particle
Cascades in Astroparticle Physics", Comput.Softw.Big Sci. 3 (2019)
2 <https://doi.org/10.1007/s41781-018-0013-0>`_. We kindly ask (and
require) any relevant improvement or addition to be offered or
contributed to the main CORSIKA 8 repository for the benefit of the
whole community.
When you plan to contribute to CORSIKA 8 check the guidelines outlined here:
`coding
guidelines <https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md>`_. Code
that fails the review by the CORSIKA author group must be improved
before it can be merged in the official code base. After your code has
been accepted and merged, you become a contributor of the CORSIKA 8
project (code author).
IMPORTANT: Before you contribute, you need to read and agree to the
`collaboration agreement
<https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md>`_. The
agreement can be discussed, and eventually improved.
We also want to point you to the `MCnet guidelines
<https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES>`_,
which are very useful also for us.
Get in contact
--------------
* Connect to https://gitlab.ikp.kit.edu register yourself and join the "Air Shower Physics" group. Write to me (ralf.ulrich@kit.edu) only in case there are problems with that.
* Connect to corsika-devel@lists.kit.edu (self-register at
https://www.lists.kit.edu/sympa/subscribe/corsika-devel) to get in
touch with the project.
* Register on the corsika slack channel.
Installation
------------
CORSIKA 8 is tested regularly at least on gcc7.3.0 and clang-8.0.0.
Prerequisites
~~~~~~~~~~~~~
You will also need:
* Python 3 (supported versions are Python >= 3.6), with pip
* conan (via pip)
* cmake
* git
* g++, gfortran, binutils, make
On a bare Ubuntu 20.04, just add:
::
sudo apt-get install python3 python3-pip cmake g++ gfortran git doxygen graphviz
On a bare CentOS 7 install python3, pip3 (pip from python3) and cmake3. Any of the devtools 7, 8, 9 should work (at least).
Also initialize devtools, before building CORSIKA 8:
::
source /opt/rh/devtoolset-9/enable
CORSIKA 8 uses the `conan <https://conan.io/>`_ package manager to
manage our dependencies. If you do not have Conan installed, it can be
installed with:
::
pip install --user conan
Compiling
~~~~~~~~~
Once Conan is installed, follow these steps to download and install CORSIKA 8:
::
git clone --recursive git@gitlab.ikp.kit.edu:AirShowerPhysics/corsika.git
mkdir corsika-build
cd corsika-build
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j8
make install
Installation (using docker containers)
--------------------------------------
There are docker containers prepared that bring all the environment and packages you need to run CORSIKA. See `docker hub <https://hub.docker.com/repository/docker/corsika/devel>`_ for a complete overview.
Prerequisites
~~~~~~~~~~~~~
You only need docker, e.g. on Ubuntu: :code:`sudo apt-get install docker` and of course root access.
Compiling
---------
Follow these steps to download and install CORSIKA 8, master development version
::
git clone --recursive https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika.git
sudo docker run -v $PWD:/corsika -it corsika/devel:clang-8 /bin/bash
mkdir build
cd build
cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install
make -j8
make install
Runing Unit Tests
-----------------
Note, before you run *any* executbale you must also define the
:code:`CORSIKA_DATA` environment variable to point to the location where you
cloned corsika :code:`modules/data`, thus typically
::
export CORSIKA_DATA=$PWD/../corsika/modules/data
To run the Unit Tests, just type :code:`ctest` in your build area.
Running examples
----------------
To see how a relatively simple hadron cascade develops,
see :code:`examples/cascade_example.cpp` for a starting point.
To run the cascade_example, or any other CORSIKA 8 application, you
must first compile it wrt. to the CORSIKA 8 header-only framework. This
can be done best by copying
e.g. :code:`corsika-install/share/corsika/examples/` to your working place
(e.g. :code:`corsika-work`).
Next, you need to define the environment variable :code:`corsika_DIR` to point to, either,
your build, or your install area. Thus, e.g.
::
export corsika_DIR=<dir where you installed CORSIKA 8 to, or where you buld it">
Then compile your example/application with
::
cd corsika-work
cmake .
make
bin/cascade_example
Visualize output (needs gnuplot installed):
::
bash $corsika_DIR/share/corsika/tools/plot_tracks.sh tracks.dat
firefox tracks.dat.gif
(note, if you use the corsika_DIR to point to the build area: the script :code:`plot_tracks.sh` is
not copied to the build area, it is only part of the source tree at :code:`tools/plot_tracks.sh`)
Or also consider the :code:`vertical_EAS` example in the same directory,
which can be configured with command line options.
Run :code:`bin/vertical_EAS` to get basic help.
Generating doxygen documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To generate the documentation, you need doxygen and graphviz. If you work with
the docker corsika/devel containers this is already included.
Otherwise, e.g. on Ubuntu 18.04, do:
::
sudo apt-get install doxygen graphviz
Switch to the corsika build directory and do
::
make doxygen
make install
open with firefox:
::
firefox ../corsika-install/share/corsika/doc/html/index.html
This is currently derived from
https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/wikis/ICRC2019
and will be revised whenever needed:
- Luisa Arrabito (1)
- Dominik Baack (2)
- Johan Bregeon (1)
- Hans Dembinski (3)
- Ralph Engel (4)
- Dieter Heck (4)
- Tim Huege (4,5)
- Lukas Nellen (6)
- Tanguy Pierog (4)
- Maximilian Reininghaus (4,7)
- Felix Riehn (8)
- Ralf Ulrich (4)
- Darko Veberic (4)
Affiliations:
- University of Montpellier, France
- TU Dortmund University, Germany
- Max Planck Institute for Nuclear Physics, Heidelberg, Germany
- Karlsruhe Institute of Technology (KIT), Germany
- Vrije Universiteit Brussel, Belgium
- National Autonomous University of Mexico (UNAM)
- Instituto de Tecnologías en Detección y Astropartículas (CNEA, CONICET, UNSAM), Buenos Aires, Argentina
- Laboratory of Instrumentation and Experimental Particles (LIP), Portugal
These guidelines are copied from: http://www.montecarlonet.org/
---------------------------------------------------------------
# Usage and collaboration agreement
The CORSIKA 8 project very much welcomes all collaboration and
contributions. The aim of the project is to create a
scientific software framework as a fundamental tool for research.
MCNET GUIDELINES
The project consists of the contributions from the scientific
community and individuals in a best effort to deliver the best
possible performance and physics output.
for Event Generator Authors and Users
## The software license of the CORSIKA project
PREAMBLE
CORSIKA 8 is by default released under the BSD 3-Clause License, as copied in full in the file
[LICENSE](LICENSE). Each source file of the CORSIKA project contains a
short statement of the copyright and this license. Each binary or
source code release of CORSIKA contains the file LICENSE.
This generator has been developed as part of an academic research
project and is the result of many years of work by the authors.
Proper academic recognition is a requirement for its continued
development.
The code, documentation and content in the folder [./externals](./externals)
is not integral part of the CORSIKA project and can be based on, or
include, other licenses, which must be compatible with the CORSIKA 8 license.
The components of the program have been developed to work together
as a coherent physics framework. We believe that the creation of
separately maintained forks or piecewise distribution of individual
parts would diminish their scientific value.
The folder [./modules](./modules) contains the code of several
external physics models for your convenience. They each come with
their own license which we ask you to honor. Please also make sure to cite the
adequate reference papers when using their models in scientific work
and publications.
The authors are convinced that software development in a scientific
context requires full availability of all source code, to further
progress and to allow local modifications to meet the specific
requirements of the individual user.
Of course, we have the authors' consent to
distribute their code together with CORSIKA 8.
Therefore we have decided to release this program under the GNU
General Public License (GPL) version 2 (with the option to instead
follow the terms and conditions of any later version of GPL). This
ensures that the source code will be available to you and grants you
the freedom to use and modify the program. You can redistribute your
modified versions as long as you retain the GPL and respect existing
copyright notices (see the file 'COPYING' for details).
Check the content of these folders carefully for details and additional
license information. It depends on the configuration of
the build system to what extent this code is used to build CORSIKA.
By using the GPL, we entrust you with considerable freedom and expect
you to use it wisely, since the GPL does not address the issues in
the first two paragraphs. To remedy this shortcoming, we have
formulated the following guidelines relevant for the distribution
and usage of event generator software in an academic setting.
## Contributing
GUIDELINES
If you want to contribute, you need to read
[the contributing GUIDELINES](CONTRIBUTING.md) and comply with these rules, or help to
improve them.
## General guidelines
We reproduce below some guidelines copied from http://www.montecarlonet.org/ that we also ask you to follow in the spirit of academic collaboration.
1) The integrity of the program should be respected.
-------------------------------------------------
......@@ -90,23 +94,7 @@ and usage of event generator software in an academic setting.
modifications should be spelled out.
POSTSCRIPT
The copyright license of the software is the GPL v2 alone, therefore
the above guidelines are not legally binding. However, we reserve the
right to criticize offenders. The guidelines should always be combined
with common sense, for interpretation and for issues not covered.
Enquiries regarding the guidelines and related issues are encouraged
and should be directed to the authors of the program.
Please note that the program, including all its code and documentation,
is intended for academic use and is delivered "as is" to be used at
your own risk, without any guarantees.
----------------------------------------------------------------------
These guidelines were edited by Nils Lavesson and David Grellscheid
(These guidelines were originally edited by Nils Lavesson and David Grellscheid
for the MCnet collaboration, which has approved and agreed to respect
them. MCnet is a Marie Curie Research Training Network funded under
Framework Programme 6 contract MRTN-CT-2006-035606.
Framework Programme 6 contract MRTN-CT-2006-035606.)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
add_executable (c8_air_shower c8_air_shower.cpp)
target_link_libraries (c8_air_shower CORSIKA8)
if(WITH_FLUKA)
message("compiling c8_air_shower.cpp with FLUKA")
target_compile_definitions(c8_air_shower PRIVATE WITH_FLUKA)
else()
message("compiling c8_air_shower.cpp with UrQMD")
endif()
install (
TARGETS c8_air_shower DESTINATION bin
)
# CORSIKA 8 Applications
This directory contains standard applications which are typical for astroparticle physics solutions.
They are "physics-complete" and are suitable for generating simulations that can be used in publications.
For example, `c8_air_shower.cpp` would be a similar binary to what would be built by CORSIKA 7 and will simulate
air showers in a curved atmosphere.
This diff is collapsed.
......@@ -3,9 +3,8 @@
#
# See file AUTHORS for a list of contributors.
#
# This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3). See file LICENSE for a full version of
# the license.
# This software is distributed under the terms of the 3-clause BSD license.
# See file LICENSE for a full version of the license.
#
# - find Conex
......