Skip to content

Commit dcd5c45

Browse files
committed
cleanup
1 parent 3275158 commit dcd5c45

38 files changed

Lines changed: 179 additions & 328 deletions

File tree

gamma-gamma/BreitWheeler.adoc

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,16 @@ unpolarized part of the full CAIN expression.
161161

162162
== Implemented OPALX Benchmark
163163

164-
The current _OPALX_ implementation is a host-only benchmark path in the local
165-
`git/opalx` checkout. The relevant files are:
166-
167-
- `src/Physics/LinearBreitWheeler.h`
168-
- `src/Physics/LinearBreitWheeler.cpp`
169-
- `unit_tests/Physics/TestLinearBreitWheeler.cpp`
170-
- `unit_tests/Physics/LinearBreitWheelerBenchmarkCommon.h`
171-
- `unit_tests/Physics/LinearBreitWheelerBenchmark.cpp`
172-
- `unit_tests/Physics/TestLinearBreitWheelerSpectrum.cpp`
164+
The current _OPALX_ implementation lives on the `laser-element-1` branch. The
165+
relevant files are:
166+
167+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/src/Physics/LinearBreitWheeler.h[`src/Physics/LinearBreitWheeler.h`]
168+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/src/Physics/LinearBreitWheeler.cpp[`src/Physics/LinearBreitWheeler.cpp`]
169+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/unit_tests/Physics/TestLinearBreitWheeler.cpp[`unit_tests/Physics/TestLinearBreitWheeler.cpp`]
170+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/unit_tests/Physics/LinearBreitWheelerBenchmarkCommon.h[`unit_tests/Physics/LinearBreitWheelerBenchmarkCommon.h`]
171+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/unit_tests/Physics/LinearBreitWheelerBenchmark.cpp[`unit_tests/Physics/LinearBreitWheelerBenchmark.cpp`]
172+
- link:https://github.com/OPALX-project/OPALX/blob/laser-element-1/unit_tests/Physics/TestLinearBreitWheelerSpectrum.cpp[`unit_tests/Physics/TestLinearBreitWheelerSpectrum.cpp`]
173+
- `~/git/OPALX-project.github.io/gamma-gamma/generate-gamma-gamma-results.sh`
173174
- `~/git/cain/linear-breit-wheeler-head-on.i`
174175
- `~/git/cain/generate-linear-breit-wheeler-results.sh`
175176

@@ -432,20 +433,37 @@ image::reference-data/linear-breit-wheeler-overlap-positron-theta-comparison.png
432433

433434
== Build and Run
434435

435-
The full benchmark workflow is now automated from the shared `~/git/cain` workspace by:
436+
The preferred one-shot workflow is run from the docs tree:
437+
438+
[source,bash]
439+
----
440+
cd ~/git/OPALX-project.github.io/gamma-gamma
441+
./generate-gamma-gamma-results.sh \
442+
--opalx-build ~/git/opalx-laser/build_openmp
443+
----
444+
445+
This top-level driver:
446+
447+
- builds the OPALX gamma-gamma benchmark targets,
448+
- runs the inverse-Compton and Breit-Wheeler unit/regression suites,
449+
- regenerates the CAIN and OPALX benchmark data for both notes,
450+
- republishes the comparison figures, and
451+
- renders the gamma-gamma note pages.
452+
453+
If only the Breit-Wheeler assets need to be refreshed, use:
436454

437455
[source,bash]
438456
----
439457
cd ~/git/cain
440458
./generate-linear-breit-wheeler-results.sh \
441-
--opalx-build ~/git/opalx/build_openmp
459+
--opalx-build ~/git/opalx-laser/build_openmp
442460
----
443461

444462
This script:
445463

446-
- runs the CAIN decks `~/git/cain/linear-breit-wheeler-head-on.i`, `~/git/cain/linear-breit-wheeler-finite-photon-beam.i`, and `~/git/cain/linear-breit-wheeler-finite-photon-beam-energy-spread.i`,
447-
- regenerates the stored CAIN histogram references in `~/git/opalx/unit_tests/Physics/data`,
448-
- runs the OPALX benchmark executable `LinearBreitWheelerBenchmark` for fixed-geometry, finite-photon-beam, and finite-photon-beam-plus-energy-spread cases,
464+
- runs the CAIN decks `~/git/cain/linear-breit-wheeler-head-on.i`, `~/git/cain/linear-breit-wheeler-finite-photon-beam.i`, `~/git/cain/linear-breit-wheeler-finite-photon-beam-energy-spread.i`, and `~/git/cain/linear-breit-wheeler-overlap.i`,
465+
- regenerates the stored CAIN histogram references in `~/git/opalx-laser/unit_tests/Physics/data`,
466+
- runs the OPALX benchmark executable `LinearBreitWheelerBenchmark` for fixed-geometry, finite-photon-beam, finite-photon-beam-plus-energy-spread, and overlap cases,
449467
- regenerates the 1D and 2D comparison plots in `~/git/cain/reference-data`.
450468

451469
The script expects:
@@ -457,11 +475,11 @@ The relevant unit-test targets are:
457475

458476
[source,bash]
459477
----
460-
cmake --build ~/git/opalx/build_openmp \
478+
cmake --build ~/git/opalx-laser/build_openmp \
461479
--target TestLinearBreitWheeler TestLinearBreitWheelerSpectrum LinearBreitWheelerBenchmark -j4
462480
463-
~/git/opalx/build_openmp/unit_tests/Physics/TestLinearBreitWheeler
464-
~/git/opalx/build_openmp/unit_tests/Physics/TestLinearBreitWheelerSpectrum
481+
~/git/opalx-laser/build_openmp/unit_tests/Physics/TestLinearBreitWheeler
482+
~/git/opalx-laser/build_openmp/unit_tests/Physics/TestLinearBreitWheelerSpectrum
465483
----
466484

467485
== References
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
5+
CAIN_DIR_DEFAULT="${HOME}/git/cain"
6+
CAIN_DIR="${CAIN_DIR_DEFAULT}"
7+
OPALX_BUILD_DIR=""
8+
OPALX_SOURCE_DIR=""
9+
CAIN_BIN=""
10+
SKIP_BUILD=0
11+
SKIP_TESTS=0
12+
13+
usage() {
14+
cat <<'EOF'
15+
Usage:
16+
./generate-gamma-gamma-results.sh --opalx-build /path/to/opalx-laser/build_openmp
17+
18+
Options:
19+
--opalx-build DIR OPALX build directory
20+
--opalx-source DIR OPALX source checkout; inferred from CMakeCache if omitted
21+
--cain-dir DIR Shared CAIN workspace; defaults to ~/git/cain
22+
--cain-bin PATH CAIN executable; defaults to ~/git/cain/CAIN-build/cain
23+
--skip-build Reuse existing OPALX targets without rebuilding
24+
--skip-tests Regenerate benchmark data without rerunning OPALX test executables
25+
-h, --help Show this help message
26+
EOF
27+
}
28+
29+
require_file() {
30+
local path=$1
31+
local label=$2
32+
if [[ ! -f "${path}" ]]; then
33+
echo "error: ${label} not found at ${path}" >&2
34+
exit 1
35+
fi
36+
}
37+
38+
infer_opalx_source_dir() {
39+
if [[ -n "${OPALX_SOURCE_DIR}" ]]; then
40+
return
41+
fi
42+
local cache="${OPALX_BUILD_DIR}/CMakeCache.txt"
43+
if [[ -f "${cache}" ]]; then
44+
OPALX_SOURCE_DIR=$(awk -F= '/^CMAKE_HOME_DIRECTORY:INTERNAL=/{print $2}' "${cache}")
45+
fi
46+
if [[ -z "${OPALX_SOURCE_DIR}" ]]; then
47+
echo "error: unable to infer OPALX source directory from ${OPALX_BUILD_DIR}" >&2
48+
exit 1
49+
fi
50+
}
51+
52+
main() {
53+
while [[ $# -gt 0 ]]; do
54+
case "$1" in
55+
--opalx-build) OPALX_BUILD_DIR=$2; shift 2 ;;
56+
--opalx-source) OPALX_SOURCE_DIR=$2; shift 2 ;;
57+
--cain-dir) CAIN_DIR=$2; shift 2 ;;
58+
--cain-bin) CAIN_BIN=$2; shift 2 ;;
59+
--skip-build) SKIP_BUILD=1; shift ;;
60+
--skip-tests) SKIP_TESTS=1; shift ;;
61+
-h|--help) usage; exit 0 ;;
62+
*) echo "error: unknown option: $1" >&2; usage >&2; exit 1 ;;
63+
esac
64+
done
65+
66+
if [[ -z "${OPALX_BUILD_DIR}" ]]; then
67+
echo "error: pass --opalx-build" >&2
68+
usage >&2
69+
exit 1
70+
fi
71+
72+
infer_opalx_source_dir
73+
74+
if [[ -z "${CAIN_BIN}" ]]; then
75+
CAIN_BIN="${CAIN_DIR}/CAIN-build/cain"
76+
fi
77+
78+
require_file "${CAIN_BIN}" "CAIN executable"
79+
require_file "${CAIN_DIR}/generate-linear-compton-results.sh" "linear-Compton workflow"
80+
require_file "${CAIN_DIR}/generate-linear-breit-wheeler-results.sh" "Breit-Wheeler workflow"
81+
82+
if [[ "${SKIP_BUILD}" -eq 0 ]]; then
83+
echo "[1/6] Building OPALX gamma-gamma benchmark targets"
84+
cmake --build "${OPALX_BUILD_DIR}" --target TestLinearCompton TestLinearComptonSpectrum LinearComptonSpectrumBenchmark TestLinearBreitWheeler TestLinearBreitWheelerSpectrum LinearBreitWheelerBenchmark -j4
85+
fi
86+
87+
if [[ "${SKIP_TESTS}" -eq 0 ]]; then
88+
echo "[2/6] Running OPALX inverse-Compton tests"
89+
"${OPALX_BUILD_DIR}/unit_tests/Physics/TestLinearCompton"
90+
"${OPALX_BUILD_DIR}/unit_tests/Physics/TestLinearComptonSpectrum"
91+
92+
echo "[3/6] Running OPALX Breit-Wheeler tests"
93+
"${OPALX_BUILD_DIR}/unit_tests/Physics/TestLinearBreitWheeler"
94+
"${OPALX_BUILD_DIR}/unit_tests/Physics/TestLinearBreitWheelerSpectrum"
95+
fi
96+
97+
echo "[4/6] Regenerating linear-Compton benchmark data and figures"
98+
"${CAIN_DIR}/generate-linear-compton-results.sh" --opalx-build "${OPALX_BUILD_DIR}" --cain-bin "${CAIN_BIN}" --cain-deck-dir "${CAIN_DIR}"
99+
100+
echo "[5/6] Regenerating Breit-Wheeler benchmark data and figures"
101+
"${CAIN_DIR}/generate-linear-breit-wheeler-results.sh" --opalx-root "${OPALX_SOURCE_DIR}" --opalx-build "${OPALX_BUILD_DIR}" --cain-bin "${CAIN_BIN}"
102+
103+
echo "[6/6] Rendering gamma-gamma note pages"
104+
asciidoctor -o /tmp/gamma-gamma-index.html "${SCRIPT_DIR}/index.adoc"
105+
asciidoctor -o /tmp/linear-compton-benchmark.html "${SCRIPT_DIR}/linear-compton-benchmark.adoc"
106+
asciidoctor -o /tmp/breit-wheeler.html "${SCRIPT_DIR}/BreitWheeler.adoc"
107+
}
108+
109+
main "$@"

0 commit comments

Comments
 (0)