Commit 61f0db3
authored
Async gpu std example (#315)
## Summary
Adds `examples/async_gpu_std/`, a counterpart to
`examples/async_gpu_launch` that demonstrates the same double-buffered
async CPU+GPU optical photon pattern but **using only C++ stdlib
primitives** _ no `G4TaskGroup`, no `G4Mutex`. The GPU worker is a plain
`std::thread` driven by `std::mutex` + `std::condition_variable` + a
bounded `std::queue<GPUTask>`.
## What's in it
| file | purpose |
|---|---|
| `async_gpu_std.h` | `GPUTaskManager` (worker thread, bounded queue,
backpressure), Cerenkov + multi-component scintillation genstep paths,
`PhotonSD`,
sync/async `RunAction` |
| `async_gpu_std.cpp` | `main()` with manual argv parsing, physics list,
action initialization |
| `CMakeLists.txt` | standalone `find_package(eic-opticks)` build (also
pulls `glm` first to work around the missing `find_dependency(glm)` in
the installed
eic-opticks Config.cmake) |
| `apex.gdml` | bundled detector geometry (no external references) |
| `run.mac` | `setStackPhotons false` on Cerenkov + Scintillation, 100
beam-on events |
| `run.sh` | reads inputs from the example dir; `--sync` / `--async`
(default) flags |
## Architecture vs `async_gpu_launch`
| concern | async_gpu_launch | async_gpu_std |
|---|---|---|
| worker thread | `G4TaskGroup<void,void>` | `std::thread` |
| mutex | `G4Mutex` / `G4AutoLock` | `std::mutex` |
| wakeups | implicit via task group | `std::condition_variable` |
| queue | implicit | `std::queue<GPUTask>` (bounded) |
| backpressure | none | `GPU_MAX_QUEUE_SIZE` (default 3) |
Simulation behavior is otherwise identical _ Cerenkov + 3-component
scintillation gensteps, sphoton `.npy` hit dumps per batch.1 parent a8570f0 commit 61f0db3
6 files changed
Lines changed: 1694 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments