What to do with the `3d_threaded` integrator

未关闭
#3,310 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp, python

调研方向

Start by tracing Integrator3DThreaded and the parallel_integrator.py/.h, parallel_reference_profiler.h, and integration/algorithms.h files, including their bindings and tests. Check the listed calculator factories and their uses to identify what exists only for this path. Done means removing the integrator option and its dedicated code, bindings, tests, and factories; the issue describes this as a deletion preference, so confirm the project's direction before undertaking the broad removal.

由索引模型根据 Issue 内容生成。

描述

I spent a bit of time exploring this option, trying to understand why it never became default, and working out whether it is worth investing in it further or remove it entirely. First I found it doesn't work out-of-the-box:

  • It doesn't run with default settings. It rejects background.algorithm=auto and fails on nproc=Auto.
  • With more than one thread it aborts. There is a data race in dxtbx Scan getters (non-atomic af::shared refcounts; present since https://github.com/cctbx/dxtbx/pull/620).
  • No end-to-end tests. Only the individual algorithms are unit-tested.

Some benchmarks using the dxtbx fix, background.algorithm=glm, and a 16-core workstation show that it is slower and loses data:

Dataset Standard 3d (nproc=8) 3d_threaded (best config)
Insulin, Eiger 16M, 450 images, sparse 1:12, 0.8 GB 2:02, 2.2 GB (njobs=2; 1–16 threads all ~3:35)
EscoA, Eiger 9M, 900 images, 200 Å axis 4:39, 2.2 GB, 1.37M refl 7:54, 8 GB, 565k refl

This might be because:

  1. Image reading is single-threaded per job. Threads don't help on sparse data.
  2. Neighbouring reflections' foreground is masked as Overlapped, which:
    • costs about 2× per core on crowded data;
    • makes summation fail for any reflection with overlapped foreground. On EscoA that discards 1.13M of 1.78M reflections.
    • with masking disabled, the best configuration gets to 4:56 (vs 4:39), but with about 80 % more CPU.
  3. Memory is higher, not lower. Reflections are held as one std::map per row (~4.5 KB each), giving 14 GB peak on EscoA.

It also lacks several features of the standard integrator:

  • the valid-foreground filter
  • ice-ring flagging
  • overlaps_filter
  • lookup.mask
  • multi-sweep support

and it splits ~10× more reflections into partials.

To make it competitive would require, at least:

  • parallel image reading
  • a larger ring buffer that blocks instead of busy-waiting
  • keep reflection data in the table's existing columns instead of converting every row to a std::map (that conversion is most of the memory and a global lock)
  • an overlap policy
  • default-settings compatibility
  • feature parity with the standard integrator
  • end-to-end tests

Which looks a lot like a total rewrite to me. My preference would be to delete it and remove the option, as keeping it around is a cognitive load for further development of dials.integrate. This would mean removing:

  • Integrator3DThreaded
    • parallel_integrator.py/.h, parallel_reference_profiler.h and integration/algorithms.h, with their bindings and tests
    • the *CalculatorFactory classes in background/{simple,glm,gmodel}/algorithm.py and profile_model/gaussian_rs/algorithm.py, which exist only to serve this path.
主要语言
Python
星标
107
派生
61
平均合并
2 天 15 小时
30 天内合并 PR
12

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dials/dials 的其他 Issue

查看 dials/dials 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。