Files
Jungfraujoch/image_analysis/scale_merge/PairSortGPU.h
T
leonarski_fandClaude Opus 5.5 8ed898d5a1 RotationScaleMerge: sort the outlier band's log-spread pairs on the device
The multiplicative spread of the outlier band is the weighted median of
(|ln(I/median)|, weight) pairs, one per usable full, and its sort was the bulk of
that step. SortPairsGPU sorts them on the GPU (by the second key, then stably
by the first) and leaves the sequence std::sort leaves: two pairs that compare
equal are the same two numbers. The values themselves (a logarithm) and the
running sum stay on the host.

p.mtz md5 unchanged on myob, cytc, 8a1a and 8qaw (GPU build); a Catch2 case
checks the device order against std::sort.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVmAWnzCmRKAXVUCdc4iNi
2026-10-08 07:27:25 +02:00

13 lines
563 B
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <utility>
#include <vector>
// Sort pairs of finite doubles ascending, first by .first then by .second, on the GPU. Two pairs that
// compare equal are the same two numbers, so this is the sequence std::sort leaves, to the bit. Only
// built with CUDA; a device without room for about 40 bytes a pair throws (run on the CPU build then).
void SortPairsGPU(std::vector<std::pair<double, double>> &v);