What to do with the `3d_threaded` integrator

Đang mở
#3,310 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, python
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Python
Star
107
Fork
61
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dials/dials

Tất cả issue của dials/dials

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.