diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4cae92810..7c1117abf5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: codecr.jlab.org/hallb/clas12/container-forge/base:latest +image: codecr.jlab.org/hallb/clas12/iguana/ci_no_root:latest workflow: rules: @@ -6,13 +6,16 @@ workflow: auto_cancel: on_new_commit: interruptible - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH auto_cancel: on_new_commit: conservative - if: $CI_COMMIT_TAG auto_cancel: on_new_commit: conservative +variables: + EVIOFILE: clas_018779.evio.00001 + default: interruptible: true before_script: @@ -22,6 +25,25 @@ default: - export PATH=$CLARA_HOME/bin:$PATH - export PATH=$COATJAVA/bin:$PATH +.clon: + tags: + - clonfarm3-shell + stage: test + needs: [build,download] + dependencies: [build,download] + interruptible: true + before_script: + - export JAVA_HOME=/usr/clas12/offline/jdk/21.0.2 + - export PATH=$JAVA_HOME:$PATH + - export PATH=/usr/clas12/offline/maven/3.9.6/bin:$PATH + - export PATH=/usr/clas12/offline/asprof/4.4/bin:$PATH + - export CLARA_HOME=$CI_PROJECT_DIR/clara + - export COATJAVA=$CI_PROJECT_DIR/coatjava + - export PATH=$CLARA_HOME/plugins/clas12/bin:$PATH + - export PATH=$CLARA_HOME/bin:$PATH + - export PATH=$COATJAVA/bin:$PATH + - tar -xzvf clara.tar.gz + stages: - mirror - build @@ -50,7 +72,7 @@ build: optional: true script: - git config --global --add safe.directory $CI_PROJECT_DIR - - ./build-coatjava.sh --lfs --clara -T$JL_RUNNER_AVAIL_CPU --quiet --no-progress + - ./build-coatjava.sh --lfs --clara -T48 --quiet --no-progress - tar -czf coatjava.tar.gz coatjava - tar -czf clara.tar.gz clara artifacts: @@ -63,31 +85,33 @@ build: download: stage: build script: -# - xrdcp xroot://sci-xrootd.jlab.org///osgpool/hallb/clas12/validation/raw/rg-d/clas_018779.evio.00001 ./ - - git lfs install - - git clone https://code.jlab.org/hallb/clas12/validation-data - - cp validation-data/raw/rg-d/clas_018779.evio.00001 . + - GIT_LFS_SKIP_SMUDGE=1 git clone https://code.jlab.org/hallb/clas12/validation-data + - cd validation-data + - git lfs install --skip-smudge + - git config lfs.fetchinclude raw/rg-d/$EVIOFILE + - git lfs pull + - cd - + - ln validation-data/raw/rg-d/$EVIOFILE artifacts: when: always - expire_in: 1 day paths: - - clas_018779.evio.00001 + - $EVIOFILE -.spotbugs: +spotbugs: stage: test needs: [build] dependencies: [build] script: - tar -xzf coatjava.tar.gz - - ./build-coatjava.sh -T$JL_RUNNER_AVAIL_CPU --spotbugs --quiet --no-progress + - ./build-coatjava.sh -T48 --spotbugs --quiet --no-progress -.unit_tests: +unit-tests: stage: test needs: [build] dependencies: [build] script: - tar -xzf coatjava.tar.gz - - ./build-coatjava.sh -T$JL_RUNNER_AVAIL_CPU --lfs --unittests --quiet --no-progress + - ./build-coatjava.sh -T48 --lfs --unittests --quiet --no-progress - ./validation/jacoco-aggregate.sh artifacts: when: always @@ -95,10 +119,10 @@ download: paths: - publish -.docs: +docs: stage: test - needs: [build,unit_tests] - dependencies: [build,unit_tests] + needs: [build,unit-tests] + dependencies: [build,unit-tests] script: - tar -xzf coatjava.tar.gz - python3 -m venv venv @@ -111,7 +135,7 @@ download: - cp -r publish pages/jacoco artifacts: when: always - expire_in: 7 days + expire_in: 1 week paths: - pages @@ -121,7 +145,6 @@ eb: dependencies: [build] script: - tar -xzf coatjava.tar.gz - - tar -xzf clara.tar.gz - git config --global --add safe.directory $CI_PROJECT_DIR - git lfs install - git submodule update --init validation/advanced-tests/data @@ -141,12 +164,7 @@ decoder: dependencies: [build,download] script: - tar -xzf clara.tar.gz - - decoder -l FINE -n 1000 -o clas_018779_00001.hipo clas_018779.evio.00001 - artifacts: - when: always - expire_in: 1 day - paths: - - clas_018779_00001.hipo + - decoder -l FINE -n 1000 -o decoded.hipo $EVIOFILE clara: stage: test @@ -154,24 +172,49 @@ clara: dependencies: [build,download] script: - tar -xzf clara.tar.gz - - run-clara -v -c $CLARA_HOME -t $JL_RUNNER_AVAIL_CPU -y ./etc/services/rgd-clarode.yml -n 100 -o out clas_018779.evio.00001 + - run-clara -v -c $CLARA_HOME -t 4 -y ./etc/services/rgd-clarode.yml -n 30 -o out $EVIOFILE + - mv out/rec_$EVIOFILE.hipo claroded.hipo profile: - stage: test - needs: [build,decoder] - dependencies: [build,decoder] + extends: .clon + allow_failure: true script: - - tar -xzf coatjava.tar.gz - - libexec/profile -f flamegraph -e cpu clas_018779_00001.hipo - - libexec/profile -f flamegraph -e nativemem clas_018779_00001.hipo - - libexec/profile -f flamegraph -e alloc clas_018779_00001.hipo + - ./clara/plugins/clas12/libexec/profile -e cpu run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp1 -t 16 -l $EVIOFILE + - ./clara/plugins/clas12/libexec/profile -e alloc run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp2 -t 16 -l $EVIOFILE + - ./clara/plugins/clas12/libexec/profile -e lock run-clara -c ./clara -y ./etc/services/rgd-clarode.yml -o tmp3 -t 16 -l $EVIOFILE artifacts: when: always expire_in: 1 week paths: - - pro_flamegraph_cpu_clas_018779_00001 - - pro_flamegraph_nativemem_clas_018779_00001 - - pro_flamegraph_alloc_clas_018779_00001 + - "asprof*.html" + +scaling: + extends: .clon + allow_failure: true + script: + - ./clara/plugins/clas12/libexec/scaling -c ./clara -y ./etc/services/rgd-clarode.yml -t 8,12,18,24 $EVIOFILE + artifacts: + when: always + expire_in: 1 week + paths: + - scaling.svg + +pages: + stage: deploy + needs: [profile,scaling,docs] + dependencies: [profile,scaling,docs] + script: + - cp -r pages public + - mkdir public/perf + - cp asprof*.html public/perf + - cp scaling.svg public/perf + pages: true + artifacts: + expire_in: 1 week + paths: + - public + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH .deploy: stage: deploy diff --git a/docs/mkdocs/docs/index.md b/docs/mkdocs/docs/index.md index 25a1cf9442..1dc49c17df 100644 --- a/docs/mkdocs/docs/index.md +++ b/docs/mkdocs/docs/index.md @@ -12,4 +12,8 @@ --- ## Reports -- [Coverage Report](jacoco/index.html) +- [Jacoco Coverage](jacoco/index.html) +- [Scaling Test](perf/scaling.svg) +- [Cpu Profiling](perf/asprof_cpu.html) +- [Alloc Profiling](perf/asprof_alloc.html) +- [Lock Profiling](perf/asprof_lock.html) diff --git a/libexec/profile b/libexec/profile index 19da5dbd5c..a16b534935 100755 --- a/libexec/profile +++ b/libexec/profile @@ -1,29 +1,31 @@ #!/bin/bash event=cpu -format=flat -seconds=12 -usage1="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [-f format] [--] executable args" -usage2="Usage: profile [options] executable args\nOptions:\n\t[-h] [-s seconds] [-w seconds]\n\t[-e cpu|alloc|nativemem|lock|cache-misses]\n\t[-f flat|traces|collapsed|flamegraph|tree|jfr|otlp]" +profile_seconds=30 +warmup_seconds=60 +usage1="Usage: profile [-h] [-s seconds] [-w seconds] [-e event] [--] executable args" +usage2="Usage: profile [options] executable args\nOptions:\n\t[-h] [-s seconds] [-w seconds]\n\t[-e cpu|alloc|nativemem|lock|cache-misses]" -while getopts s:f:e:o:w:h opt +let tail_seconds=warmup_seconds-5 +let sleep_seconds=5 + +while getopts s:e:o:w:h opt do case $opt in - s) seconds=$OPTARG ;; - f) format=$OPTARG ;; + s) profile_seconds=$OPTARG ;; + w) warmup_seconds=$OPTARG ;; e) event=$OPTARG ;; o) stub=$OPTARG ;; - w) warmup=$OPTARG ;; h) echo -e $usage2 && exit 0 ;; --) break ;; \?) echo $usage1 && exit 1 ;; -# :) echo $usage1 && exit 2 ;; esac done shift $((OPTIND-1)) executable=$1 arguments=${@:2} +logfile=asprof$stub.log which asprof >& /dev/null [ "$?" -ne 0 ] && echo 'ERROR: asprof is not in $PATH.' && echo -e $usage2 && exit 3 @@ -32,30 +34,36 @@ which $executable >& /dev/null [ "$?" -ne 0 ] && echo "ERROR: $executable is not in \$PATH." && echo -e $usage2 && exit 4 echo "Running asprof on '$executable $arguments' ..." +sleep 1 -set -e +rm -f $logfile && touch $logfile -$executable $arguments >& asprof_$stub.log +set -e +$executable $arguments >> $logfile 2>&1 & +set +e pid_bash=$! +echo info: pid bash=$pid_bash, getting java ... +sleep 1 +pid_java=$(pgrep -P $pid_bash) +sleep 1 +# go 2 deep for run-clara: +pid_java=$(pgrep -P $pid_java | head -n 1) +echo info: pid java=$pid_java +tail -f $logfile & +pid_tail=$! +sleep $tail_seconds +kill -9 $pid_tail -echo PID1=$pid_bash -sleep 5 -pid_java=$(pgrep -P "$pid_bash") - -echo PID2=$pid_java - -ps waux && ps -p $pid_java - -echo "Waiting for $warmup seconds of warmup ..." -for x in $(seq $warmup); do let y=$warmup-$x && echo -e -n "\r$y ..." && sleep 1; done - -# This 42 is probably for recon-util: -tail -n 42 asprof_$stub.log +set -e +asprof -e $event -d $profile_seconds -f asprof_${event}$stub.html $pid_java >> $logfile 2>&1 & +pid_asprof=$! +set +e -asprof --title "Coatjava:asprof:$executable:$event" -e $event \ - -d $seconds -o $format -f asprof_${format}_${event}_$stub $pid_java +tail -f $logfile & +pid_tail=$! +wait $pid_asprof +kill -9 $pid_bash +kill -9 $pid_tail kill -9 $pid_java -rm -f asprof_$stub.hipo -