From a438e84b63208cf972da11a86a9df2970c46cf0c Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Tue, 10 Nov 2020 23:10:24 -0600 Subject: [PATCH] Cleaned up and simplified the config/env.sh and util/build.sh - We should limit the number of new environment variables. They increase complexity which should be mostly absorbed by using containers. - Any new environment variables should be set via the ci yml file or defined the UI. https://docs.gitlab.com/ee/ci/variables/README.html#custom-environment-variables - Removed dummy scripts - Removed dvmp dummy jobs. - Fixed dvmp output data. Note the out artifacts should go in `results/dvmp` if they are in the `dvmp` directory. This will just make things easier later on for collecting and summarizing results. - updated dvmp/scripts/run_generator_instance.sh - Added dvmp.sh to run geant4/reconstruction. Note `dvmp/dvmp.sh` could be named something more specific, like `dvmp/dvmp_barrel_decays.sh` depending on the input, analysis, etc... --- .gitlab-ci.yml | 3 +- config/env.sh | 15 ++--- dis/dis.sh | 3 +- dummy/.gitignore | 0 dummy/config.yml | 24 -------- dummy/dummy_fail_test.sh | 7 --- dummy/dummy_test.sh | 7 --- dummy/dummy_test2.sh | 7 --- dvmp/config.yml | 35 ++---------- dvmp/dvmp.sh | 78 ++++++++++++++++++++++++++ dvmp/scripts/dummy_fail_test.sh | 7 --- dvmp/scripts/dummy_test.sh | 7 --- dvmp/scripts/dummy_test2.sh | 7 --- dvmp/scripts/run_generator_instance.sh | 10 +++- util/build_detector.sh | 20 +++++-- 15 files changed, 114 insertions(+), 116 deletions(-) delete mode 100644 dummy/.gitignore delete mode 100644 dummy/config.yml delete mode 100755 dummy/dummy_fail_test.sh delete mode 100755 dummy/dummy_test.sh delete mode 100755 dummy/dummy_test2.sh create mode 100644 dvmp/dvmp.sh delete mode 100755 dvmp/scripts/dummy_fail_test.sh delete mode 100755 dvmp/scripts/dummy_test.sh delete mode 100755 dvmp/scripts/dummy_test2.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 49d71255..01da6a16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,11 +15,10 @@ stages: include: - local: 'dis/config.yml' - - local: 'dummy/config.yml' - local: 'dvmp/config.yml' summary: stage: finish - needs: ["dis:results", "dummy:results", "dvmp:results"] + needs: ["dis:results", "dvmp:results"] script: - echo "All benchmarks passed" diff --git a/config/env.sh b/config/env.sh index e2b34a24..0177dabc 100755 --- a/config/env.sh +++ b/config/env.sh @@ -12,17 +12,18 @@ if [[ ! -n "${JUGGLER_INSTALL_PREFIX}" ]] ; then export JUGGLER_INSTALL_PREFIX="/usr/local" fi +# not sure this is needed if [[ ! -n "${DETECTOR_PREFIX}" ]]; then - export DETECTOR_PREFIX=detector + # reuse the custom juggler install prefix for detector + export DETECTOR_INSTALL_PREFIX=${JUGGLER_INSTALL_PREFIX} fi ## ensure absolute paths +# not sure this is needed either export JUGGLER_INSTALL_PREFIX=`realpath ${JUGGLER_INSTALL_PREFIX}` -export DETECTOR_PREFIX=`realpath ${DETECTOR_PREFIX}` - -## setup detector paths -export LD_LIBRARY_PATH=${DETECTOR_PREFIX}/lib:$LD_LIBRARY_PATH -export DETECTOR_SOURCE_PATH=${DETECTOR_PREFIX}/src +export DETECTOR_INSTALL_PREFIX=`realpath ${DETECTOR_INSTALL_PREFIX}` ## setup root results artifact path -export RESULTS_PATH=`realpath results` +# this should be in the CI File instead +# https://docs.gitlab.com/ee/ci/yaml/README.html#variables +# export RESULTS_PATH=`realpath results` diff --git a/dis/dis.sh b/dis/dis.sh index 657c9b80..8bdaffbd 100644 --- a/dis/dis.sh +++ b/dis/dis.sh @@ -60,7 +60,6 @@ fi # Need to figure out how to pass file name to juggler from the commandline xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv \ gaudirun.py ../options/tracker_reconstruction.py - if [[ "$?" -ne "0" ]] ; then echo "ERROR running juggler" exit 1 @@ -78,6 +77,6 @@ if [[ "$?" -ne "0" ]] ; then fi if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then -cp ${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE} results/. +cp ${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE} results/dis/. fi diff --git a/dummy/.gitignore b/dummy/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/dummy/config.yml b/dummy/config.yml deleted file mode 100644 index 80e0b60a..00000000 --- a/dummy/config.yml +++ /dev/null @@ -1,24 +0,0 @@ -dummy:dummy_test: - stage: analyze - timeout: 1 hours - script: - - dummy/dummy_test.sh - -dummy:dummy_test2: - stage: analyze - timeout: 1 hours - script: - - dummy/dummy_test2.sh - -dummy:dummy_fail_test: - stage: analyze - timeout: 1 hours - allow_failure: true - script: - - dummy/dummy_fail_test.sh - -dummy:results: - stage: collect - needs: ["dummy:dummy_test", "dummy:dummy_test2", "dummy:dummy_fail_test"] - script: - - echo "All DIS benchmarks successful" diff --git a/dummy/dummy_fail_test.sh b/dummy/dummy_fail_test.sh deleted file mode 100755 index f8c506b3..00000000 --- a/dummy/dummy_fail_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test..." -echo "..." -echo "Fails!" - -exit 1 diff --git a/dummy/dummy_test.sh b/dummy/dummy_test.sh deleted file mode 100755 index 5af1dc34..00000000 --- a/dummy/dummy_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test..." -echo "..." -echo "Passes!" - -#exit 1 diff --git a/dummy/dummy_test2.sh b/dummy/dummy_test2.sh deleted file mode 100755 index dfede272..00000000 --- a/dummy/dummy_test2.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test number 2..." -echo "..." -echo "Passes!" - -#exit 1 diff --git a/dvmp/config.yml b/dvmp/config.yml index f96b3b94..65eb4ab8 100644 --- a/dvmp/config.yml +++ b/dvmp/config.yml @@ -20,49 +20,22 @@ dvmp:generate: dvmp:jpsi_central:process: stage: process needs: ["dvmp:generate"] - dependencies: - - dvmp:generate timeout: 1 hour script: - - mkdir -p results/data/dvmp - - mkdir -p results/plots/dvmp - - echo "Running the detector simulation" - - touch results/data/dvmp/sim-stub - - echo "Running the reconstruction" - - touch results/data/dvmp/rec-stub + - bash dvmp/dvmp.sh artifacts: paths: - results -dvmp:jpsi_central:dummy_test: +dvmp:jpsi_central:test_analysis: stage: analyze needs: ["dvmp:jpsi_central:process"] - dependencies: - - dvmp:jpsi_central:process script: - - dvmp/scripts/dummy_test.sh + - echo "THIS IS A PLACE HOLDER" -dvmp:jpsi_central:dummy_test2: - stage: analyze - needs: ["dvmp:jpsi_central:process"] - dependencies: - - dvmp:jpsi_central:process - script: - - dvmp/scripts/dummy_test2.sh - -dvmp:jpsi_central:dummy_fail_test: - stage: analyze - needs: ["dvmp:jpsi_central:process"] - dependencies: - - dvmp:jpsi_central:process - allow_failure: true - script: - - dvmp/scripts/dummy_fail_test.sh dvmp:results: stage: collect - needs: ["dvmp:jpsi_central:dummy_test", - "dvmp:jpsi_central:dummy_test2", - "dvmp:jpsi_central:dummy_fail_test"] + needs: ["dvmp:jpsi_central:test_analysis"] script: - echo "All DVMP benchmarks successful" diff --git a/dvmp/dvmp.sh b/dvmp/dvmp.sh new file mode 100644 index 00000000..7b7b2d9a --- /dev/null +++ b/dvmp/dvmp.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then + export JUGGLER_DETECTOR="topside" +fi + +if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then + export JUGGLER_N_EVENTS=100 +fi + +# only used when running locally (not in CI) +if [[ ! -n "${JUGGLER_INSTALL_PREFIX}" ]] ; then + export JUGGLER_INSTALL_PREFIX="/usr/local" +fi + +# these variables might not need exported. +export JUGGLER_FILE_NAME_TAG="dvmp" +# Generator file +export JUGGLER_GEN_FILE="results/dvmp/jpsi_central_electron-10on100-gen.hepmc" +#export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc" + +export JUGGLER_SIM_FILE="sim_${JUGGLER_FILE_NAME_TAG}.root" +export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root" + +echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}" +echo "JUGGLER_DETECTOR = ${JUGGLER_DETECTOR}" +echo "JUGGLER_FILE_NAME_TAG = ${JUGGLER_FILE_NAME_TAG}" + +### Build the detector constructors. +git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git +git clone https://eicweb.phy.anl.gov/EIC/detectors/accelerator.git +pushd ${JUGGLER_DETECTOR} +ln -s ../accelerator/eic +popd +mkdir ${JUGGLER_DETECTOR}/build +pushd ${JUGGLER_DETECTOR}/build +cmake ../. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j30 install +popd + +pushd ${JUGGLER_DETECTOR} + +## run geant4 simulations +npsim --runType batch \ + --part.minimalKineticEnergy 1000*GeV \ + -v WARNING \ + --numberOfEvents ${JUGGLER_N_EVENTS} \ + --compactFile ${JUGGLER_DETECTOR}.xml \ + --inputFiles ../${JUGGLER_GEN_FILE} \ + --outputFile ${JUGGLER_SIM_FILE} +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running script" + exit 1 +fi + +# Need to figure out how to pass file name to juggler from the commandline +xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv \ + gaudirun.py ../options/tracker_reconstruction.py +if [[ "$?" -ne "0" ]] ; then + echo "ERROR running juggler" + exit 1 +fi +ls -l +popd + +pwd +mkdir -p results/dis + +echo "STAND-IN FOR ANALYSIS SCRIPT" +#root -b -q "dis/scripts/rec_dis_electrons.cxx(\"${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE}\")" +#if [[ "$?" -ne "0" ]] ; then +# echo "ERROR running root script" +# exit 1 +#fi + +if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then +cp ${JUGGLER_DETECTOR}/${JUGGLER_REC_FILE} results/dvmp/. +fi + diff --git a/dvmp/scripts/dummy_fail_test.sh b/dvmp/scripts/dummy_fail_test.sh deleted file mode 100755 index f8c506b3..00000000 --- a/dvmp/scripts/dummy_fail_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test..." -echo "..." -echo "Fails!" - -exit 1 diff --git a/dvmp/scripts/dummy_test.sh b/dvmp/scripts/dummy_test.sh deleted file mode 100755 index 5af1dc34..00000000 --- a/dvmp/scripts/dummy_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test..." -echo "..." -echo "Passes!" - -#exit 1 diff --git a/dvmp/scripts/dummy_test2.sh b/dvmp/scripts/dummy_test2.sh deleted file mode 100755 index dfede272..00000000 --- a/dvmp/scripts/dummy_test2.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -echo "Dummy Test number 2..." -echo "..." -echo "Passes!" - -#exit 1 diff --git a/dvmp/scripts/run_generator_instance.sh b/dvmp/scripts/run_generator_instance.sh index 88102d5c..2564299b 100755 --- a/dvmp/scripts/run_generator_instance.sh +++ b/dvmp/scripts/run_generator_instance.sh @@ -15,7 +15,7 @@ fi export RNG_SEED=1 ## Setup local environment -export DATA_PATH=$RESULTS_PATH/data/dvmp +export DATA_PATH=results/dvmp EBEAM= @@ -110,9 +110,13 @@ sed "s/@TAG@/${FNAME}/" $CONFIG_IN | \ echo "Running the generator" lager -r ${RNG_SEED} -c ${FNAME}.json -e ${NEVENTS} -o . +ls -lrth +popd + + ## Finally, move relevant output into the artifacts directory echo "Moving generator output into ${DATA_PATH}" mkdir -p ${DATA_PATH} -for ext in hepmc json log root; do - mv *.${FNAME}.*.${ext} ${DATA_PATH}/${FNAME}.${ext} +for ext in hepmc json log root ; do + mv dvmp/*.${FNAME}.*.${ext} ${DATA_PATH}/${FNAME}.${ext} done diff --git a/util/build_detector.sh b/util/build_detector.sh index 7a1477f8..3d08a73c 100755 --- a/util/build_detector.sh +++ b/util/build_detector.sh @@ -4,15 +4,25 @@ source config/env.sh ## Build and install the detector plugins. -if [[ ! -d ${DETECTOR_SOURCE_PATH} ]]; then - git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git ${DETECTOR_SOURCE_PATH} +if [[ ! -d ${JUGGLER_DETECTOR} ]]; then + git clone https://eicweb.phy.anl.gov/EIC/detectors/${JUGGLER_DETECTOR}.git + # this might be temporary. There are multiple solutions here but this is the simple pattern for now + # I do not want to use git submodules here -whit + git clone https://eicweb.phy.anl.gov/EIC/detectors/accelerator.git + pushd ${JUGGLER_DETECTOR} + ln -s ../accelerator/eic + popd else - pushd ${DETECTOR_SOURCE_PATH} + pushd ${JUGGLER_DETECTOR} + git pull --ff-only + popd + pushd accelerator git pull --ff-only popd fi mkdir -p detector-build pushd detector-build -echo cmake ${DETECTOR_SOURCE_PATH} -DCMAKE_INSTALL_PREFIX=${DETECTOR_PREFIX} && make -j30 install -cmake ${DETECTOR_SOURCE_PATH} -DCMAKE_INSTALL_PREFIX=${DETECTOR_PREFIX} && make -j30 install +# Always keep the detector directory at the top level. +echo cmake ../${JUGGLER_DETECTOR} -DCMAKE_INSTALL_PREFIX=${DETECTOR_INSTALL_PREFIX} && make -j30 install +cmake ../${JUGGLER_DETECTOR} -DCMAKE_INSTALL_PREFIX=${DETECTOR_INSTALL_PREFIX} && make -j30 install popd -- GitLab