rugnux pre-scan: spot width on per-spot squares, engines built during the read, tiers looked ahead, measurements memoised
The spot-width stage of the pre-scan copied every preprocessed frame back to the host (72 MB a frame on a 16M detector, page-locked host mirrors per worker) for measurements that read a few pixels about each spot. Now: - MeasureSpotsOnTiles: the flux curves and the footprint read (2*24+1)^2 squares about each spot, gathered on the card (ImagePreprocessorBufferGPU::GatherTiles) - no copy_image_to_host, no host mirror. The flux curves are bounded at R_BKG_OUT = 20 px. The footprint keeps its arithmetic; a per-iteration check that its window is inside the square, and a spot whose window walks off it is measured again from scratch on an 80 px square, then on the whole frame. Where the squares would be more pixels than the frame, the frame is read. Same pixels in the same order, so the same bits. Harness over 34 rotation sets (~1500 frames): 0 differences; misses at 24 on a few spots of most frames, at 54 on up to 80% of frames of a few sets, at 80 on none. - The azimuthal mapping and the per-worker spot engines are built while the frames are read. - The tiers no longer wait for each other: workers run on through the visit order, each tier's answer is drawn from exactly its own frames, and frames measured past the tier the answer stops at are thrown away - a frame is measured the same whichever tier it is read for. - PreScanMemo keeps the spot measurement, the defective pixels and the background gain under the pre-scan key plus the spot-finding and azimuthal settings, so a copy of the run that pre-scans again on the same inputs reads no frames. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EizBKhTqrAYago9KJG3dA3
This commit is contained in:
@@ -25,6 +25,14 @@ class ImagePreprocessorBufferGPU : public ImagePreprocessorBuffer {
|
||||
// image is final by the time a gather is asked for. The NULL stream would serialise all workers.
|
||||
CudaStream gather_stream;
|
||||
|
||||
// GatherTiles: the squares' centres, the squares on the card, and the page-locked landing for them.
|
||||
// Grown to the largest frame's spots.
|
||||
size_t tile_capacity = 0; // pixels of gpu_tiles and host_tiles
|
||||
CudaDevicePtr<int32_t> gpu_tile_centre;
|
||||
CudaDevicePtr<int32_t> gpu_tiles;
|
||||
PinnedVector<int32_t> tile_centre;
|
||||
PinnedVector<int32_t> host_tiles;
|
||||
|
||||
public:
|
||||
// host_mirror = false skips the host copy of the preprocessed image entirely (and with it the
|
||||
// page-locking): pass it when every engine reading this buffer runs on the device.
|
||||
@@ -33,4 +41,7 @@ public:
|
||||
int32_t *getGPUBuffer() override;
|
||||
const int32_t *getGPUBuffer() const override;
|
||||
void Gather(const std::vector<uint32_t> &npixel, std::vector<int32_t> &values) const override;
|
||||
const int32_t *GatherTiles(const std::vector<int32_t> &x, const std::vector<int32_t> &y,
|
||||
int width, int half) override;
|
||||
const int32_t *HostImage() override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user