Files
GR-raytracing/benchmarks/2mass_fixed_tile_triangle_scan_2026-08-27.md
T

95 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2MASS 单 tile triangle 扫描基准(2026-08-27)
## 目的
测量当前局部 inverse lens map 路径中,固定 2MASS tile 的 catalog
candidate 扫描成本。这个实验不测全天索引;它故意令每一个 source
triangle 都扫描同一份完整 tile,以确定单 tile 全扫何时成为问题。
## 可复现环境
- Git revision: `5d80bb1b51477680828dbb49113a5db3d3669e62`
(`Makefile: tune default CFLAGS`)
- Host CPU: 12th Gen Intel Core i7-12700K。
- Build defaults: C11、`-march=native -O2 -pipe`、OpenMP,PNG output。
- Render parallelism: **6 个 catalog render worker**。1920 x 1920 的一个
`double` RGB private HDR buffer 约为 84.4 MiB;`FRAME_SPLAT_MAX_PRIVATE_HDR_BYTES`
的 512 MiB 总上限因此只容纳六个 worker-private buffers。下面所有 wall time
和拟合都以此并行规模为条件。
- Catalog: `assets/2mass/processed/all_sky/tile_ra252_dec048.csv`。
它有 54,160 个清洗后的 2MASS PSC sources,覆盖 RA `[252,253)`、
Dec `[-42,-41)`(ICRS/J2000)。
## 控制变量
相机指向 tile 中心 `(RA, Dec) = (252.5 deg, -41.5 deg)`,水平视场为
`0.6 deg`。这个正方形视场完整位于 tile 内,因此改变 coarse mesh 时:
- 所有可见 source 都来自同一 tile;
- `Rendered` image count 固定为 26,172,故实际 PSF splat 工作不变;
- 每个 Minkowski source triangle 仍按当前实现扫描该 tile 的全部
54,160 颗星。
固定参数:1920 x 1920、Moffat FWHM 2.7 px、beta 3、exposure `1e15`。
对正好整除 1920 的 `c = --coarse-cell-pixels`,triangle 数为
`T = 2 * (1920 / c)^2`。
## 命令
```sh
for cell in 64 48 32 24 16 12 8; do
echo "coarse_cell_pixels=$cell"
time ./build/minkowski_sky \
--catalog assets/2mass/processed/all_sky/tile_ra252_dec048.csv \
--look-ra-deg 252.5 \
--look-dec-deg -41.5 \
--fov-deg 0.6 \
--exposure 1e15 \
--width 1920 --height 1920 \
--coarse-cell-pixels "$cell" \
--psf-fwhm-pixels 2.7 \
--psf-moffat-beta 3 \
--output "output/imgs/tile_ra252_dec048_cell${cell}.png"
done
```
## 结果
| `c` | triangles | images | user time | system time | wall time |
|---:|---:|---:|---:|---:|---:|
| 64 | 1,800 | 26,172 | 68.44 s | 0.69 s | 11.977 s |
| 48 | 3,200 | 26,172 | 69.87 s | 0.77 s | 12.151 s |
| 32 | 7,200 | 26,172 | 73.68 s | 1.04 s | 12.625 s |
| 24 | 12,800 | 26,172 | 79.11 s | 1.05 s | 13.185 s |
| 16 | 28,800 | 26,172 | 95.39 s | 0.87 s | 14.931 s |
| 12 | 51,200 | 26,172 | 118.28 s | 0.87 s | 17.465 s |
| 8 | 115,200 | 26,172 | 179.51 s | 0.94 s | 23.966 s |
对 wall time 作最小二乘拟合:
\[
t_{\rm wall} = 11.855\ {\rm s} +
(105.88\ \mu {\rm s})\,T.
\]
拟合 `R^2 = 0.99955`,RMSE 为 0.085 s。因而在此固定 catalog 上,
一次 triangle 对完整 tile 的扫描具有约 105.9 microseconds 的有效墙钟
成本;除以 54,160 得到约 1.95 ns 每 star--triangle 候选判断的有效墙钟
成本。该数包含 per-triangle 准备工作,不能误称为孤立的
`spherical_barycentric` 调用成本。
`c=16` 时,拟合给出约 3.05 s 的网格相关扫描成本和 11.88 s 固定成本;
`c=8` 时,前者约为 12.20 s,与固定成本同量级。
## 结论与下一步
单个高密度 1-degree tile 的完整扫描是可接受的局部工作;本结果不支持仅为
把每个叶节点限制到数百颗星而激进细分 source sky。全天路径的首要索引应是
`source triangle -> candidate 1-degree tiles -> exact per-star containment`,以
避免把无关 tile 放入候选集。是否对极稠密 tile 再做浅层细分,应在实际
Schwarzschild source-triangle 覆盖和负载 profile 下决定。
若要严格隔离单次 `spherical_barycentric` 判断,保持 mesh 不变并只增加保证
落在视场外的 catalog entries;此时 wall time 对候选星数的斜率才不混入
vertex tracing 或 per-triangle 固定成本。