What to do with the `3d_threaded` integrator

オープン
#3,310 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
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時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dials/dials のほかの issue

dials/dials の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。