Files
Jungfraujoch/tests/CMakeLists.txt
T
leonarski_f ea383f9e83 FFBIDXIndexerCPU: the fast-feedback indexer on the CPU, used where there is no GPU
A port of the fast-feedback indexer's CUDA kernels to plain C++/Eigen: the same half-sphere and
rotation samples, the same scores and the same 32 output cells for Refine(). The loops are
reorganised so the inner one runs over samples and vectorises (GCC/Clang, no intrinsics), and the
cell search separates the rotation about the candidate vector out of the per-spot terms. The
vector refinement reproduces the library's warp sums - partial sums its shuffle reduction leaves in
the other lanes carry into the next round - and its float arithmetic (FMA contraction, the
Fibonacci points in float), because the candidates searched depend on it: on the library's 27 test
spot lists and 4 synthetic stills the CPU and GPU best cells agree to ~1e-6 relative, the top-32
sets in 30 of 31 cases completely.

FFBIDX now resolves to the GPU library where a GPU is visible and to the CPU port otherwise (no
GPU, --no-gpu, or a build without CUDA); Auto takes FFBIDX for stills whenever a cell is known,
also without a GPU, instead of FFTW. With a GPU nothing changes (a stills set and a rotation set
reproduce the baseline exactly). Without a GPU the stills indexer pool gets one indexer per worker
instead of eight, since the CPU indexer holds no card memory.

Single core, synthetic still, loaded 5950X: ~8 ms per call at 30 spots, ~15 ms at 80, ~35 ms at
250; 16 threads ~1300/700/330 calls/s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit 9a8eb8669d1be6c3ec16db6786280affd6830ee5)
2026-10-23 17:56:50 +02:00

238 lines
8.6 KiB
CMake

# Quick cross-platform checks: the results that depend on the architecture, the compiler or the
# standard library (bitshuffle/LZ4 SIMD paths, HDF5 read-back, CBF parsing, CPU spot finding, FFTW
# indexing, gemmi MTZ/CIF). Built in every configuration, the portable (viewer/rugnux-only) ones
# included, and linked only against what those build - so it runs on the macOS and Windows jobs.
# Only the cases tagged [portable] are meant to run there (a few seconds in all); the rest of these
# files is compiled in because the tagged cases live next to them.
# EXCLUDE_FROM_ALL: a product build does not pay for it, CI builds the target by name.
ADD_EXECUTABLE(jfjoch_portable_test EXCLUDE_FROM_ALL
PortableTest.cpp
TestData.h
ZSTDCompressorTest.cpp
JFJochReaderTest.cpp
CrystFELGeometryTest.cpp
XFELReaderTest.cpp
SaturationCeilingTest.cpp
DetectorModulesTest.cpp
PanelLayoutTest.cpp
CellPopulationTest.cpp
MultiReaderTest.cpp
ModuleRefinementTest.cpp
SweepLayoutTest.cpp
CBORTest.cpp
ImageSpotFinderCPUTest.cpp
AdaptiveSpotFinderCPUTest.cpp
AzimuthalIntegrationTest.cpp
CalcBraggPredictionTest.cpp
BraggStencilTest.cpp
SpotFootprintTest.cpp
BraggIntegrationEngineCompressedImageTest.cpp
BraggIntegrationEngineCPUTest.cpp
BraggIntegrationEngineMetalTest.cpp
MolecularReplacementMetalTest.cpp
ModelDensityMetalTest.cpp
WriteReflectionsTest.cpp
LoadReferenceMtzFreeFlagsTest.cpp
LoadReferenceSfCifTest.cpp
RotationIndexerTest.cpp
FFBIDXIndexerCPUTest.cpp
)
target_link_libraries(jfjoch_portable_test Catch2WithMain JFJochRugnux JFJochReader JFJochImageAnalysis
JFJochWriter JFJochCommon)
target_include_directories(jfjoch_portable_test PRIVATE .)
# Same device-link step as rugnux (see rugnux/CMakeLists.txt): a portable CUDA build links cuFFT statically.
IF (JFJOCH_PORTABLE_ONLY AND JFJOCH_CUDA_AVAILABLE AND TARGET CUDA::cufft_static)
SET_TARGET_PROPERTIES(jfjoch_portable_test PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
ENDIF()
# The CPU vs GPU test of the fast-feedback indexer reads the library's own test spot lists
IF (JFJOCH_CUDA_AVAILABLE)
FetchContent_GetProperties(fast-indexer SOURCE_DIR FFBIDX_SOURCE_DIR)
SET(FFBIDX_SIMPLE_DATA_DIR "${FFBIDX_SOURCE_DIR}/data/simple/files")
TARGET_COMPILE_DEFINITIONS(jfjoch_portable_test PRIVATE FFBIDX_SIMPLE_DATA_DIR="${FFBIDX_SIMPLE_DATA_DIR}")
ENDIF()
IF (JFJOCH_PORTABLE_ONLY)
RETURN()
ENDIF()
ADD_EXECUTABLE(jfjoch_test
PortableTest.cpp
DiffractionExperimentTest.cpp
RawToConvertedGeometryTest.cpp
../common/RawToConvertedGeometry.h
../common/DiffractionExperiment.h
CheckImageOutput.h
FPGAIntegrationTest.cpp
StrongPixelSetTest.cpp
AdaptiveThresholdTest.cpp
AdaptiveSpotFinderCPUTest.cpp
ZSTDCompressorTest.cpp
FrameTransformationTest.cpp
HDF5WritingTest.cpp PedestalCalcTest.cpp
ZMQImagePusherTest.cpp StreamWriterTest.cpp
CoordTest.cpp JFJochStateMachineTest.cpp
JFJochReceiverIntegrationTest.cpp
AcquisitionCountersTest.cpp
IndexingUnitTest.cpp
FFBIDXIndexerCPUTest.cpp
ThreadSafeFIFOSetTest.cpp
ReceiveRingBufferTest.cpp
FPGANetworkTest.cpp
JFPedestalTest.cpp
JFCalibrationTest.cpp
AzimuthalIntegrationTest.cpp
StatusVectorTest.cpp
CBORTest.cpp
DetectorGeometryTest.cpp DetectorSetupTest.cpp DiffractionGeometryTest.cpp
FPGASpotFindingUnitTest.cpp
PreviewCounterTest.cpp
FPGAFrameGeneratorTest.cpp
FPGAHostWriterTest.cpp
DiffractionSpotTest.cpp
TIFFTest.cpp
JFJochReceiverProcessingTest.cpp
JPEGTest.cpp
HistogramTest.cpp
ROIMapTest.cpp
ROIIntegrationCPUTest.cpp
ROIIntegrationGPUTest.cpp
BraggIntegrationEngineGPUTest.cpp
BraggIntegrationEngineCompressedImageTest.cpp
BraggIntegrationEngineCPUTest.cpp
BackgroundGainTest.cpp
BackgroundApertureTest.cpp
BraggStencilTest.cpp
SpotFootprintTest.cpp
SpotTilesTest.cpp
LossyFilterTest.cpp
ImageBufferTest.cpp
JFJochImageBufferReaderTest.cpp
PixelMaskTest.cpp
RegressionTest.cpp
FPGAHLSModulesTest.cpp
ZMQPreviewSocketTest.cpp
DetectorSettingsTest.cpp
AutoIncrVectorTest.cpp
ModuleSummationTest.cpp
ZMQMetadataSocketTest.cpp
JFJochReaderTest.cpp
MultiReaderTest.cpp
CrystFELGeometryTest.cpp
XFELReaderTest.cpp
SaturationCeilingTest.cpp
DetectorModulesTest.cpp
PanelLayoutTest.cpp
CellPopulationTest.cpp
ModuleRefinementTest.cpp
LiveCollectionTest.cpp
RugnuxLiveStatusTest.cpp
RugnuxStructureTest.cpp
SweepLayoutTest.cpp
ShadowFinderTest.cpp
HotPixelFinderTest.cpp
BandwidthEstimateTest.cpp
ParallelForTest.cpp
HostMemoryTest.cpp
RugnuxTest.cpp
ResultReportTest.cpp
DiagnosticOutputTest.cpp
PostRefineTest.cpp
RotationScaleWalkTest.cpp
AndersonMixingTest.cpp
RugnuxLargeTest.cpp
TestData.h
MovingAverageTest.cpp
ImageMetadataTest.cpp
JFJochReceiverLiteTest.cpp
GridScanSettingsTest.cpp
JFJochReceiverPlotsTest.cpp
GoniometerAxisTest.cpp
DetGeomCalibTest.cpp
RingsFromProfileTest.cpp
CalibrationTest.cpp
XtalOptimizerTest.cpp
XtalRefineTest.cpp
XtalRefineCeres.h
CrystalLatticeTest.cpp
FPGAPTPTest.cpp
ResolutionShellsTest.cpp
ImageSpotFinderCPUTest.cpp
ImageSpotFinderGPUTest.cpp
BSLZ4DecoderGPUTest.cpp
BSLZ4DecoderGPUFuzzTest.cpp
ImagePreprocessorGPUFusedTest.cpp
StoredImageDecodeGPUTest.cpp
DirectHostReadGPUTest.cpp
AdaptiveSpotFinderGPUTest.cpp
SpotExtractorGPUParityTest.cpp
CUDAMemHelpersTest.cpp
CudaHandledErrorTest.cpp
CalcBraggPredictionTest.cpp
SpotUtilsTest.cpp
LatticeSearchTest.cpp
LePageLatticeTest.cpp
TimeTest.cpp
RotationIndexerTest.cpp
SpindleBlindFractionTest.cpp
SpindleCuspLossTest.cpp
TopPixelsTest.cpp
HKLKeyTest.cpp
TCPImagePusherTest.cpp
PreflightTest.cpp
ModelValidationTest.cpp
MolecularReplacementTest.cpp
ModelMaskGPUTest.cpp
ModelDensityGPUTest.cpp
SearchSpaceGroupTest.cpp
SearchSpaceGroupTwinTest.cpp
SyntheticMergedReflections.h
XDSPluginTest.cpp
MergeScaleTest.cpp
AnisotropyAnalysisTest.cpp
ModelScalingTest.cpp
ModelScaleGPUTest.cpp
CorrectionSurfaceGPUTest.cpp
RotationIngestGPUTest.cpp
TwinningAnalysisTest.cpp
TranslationalNCSTest.cpp
RfreeFlagsTest.cpp
FrenchWilsonTest.cpp
SphericalHarmonicSurfaceTest.cpp
WilsonOutliersTest.cpp
PairSortGPUTest.cpp
ReindexAmbiguityTest.cpp
CrystalSettingTest.cpp
LoadReferenceMtzFreeFlagsTest.cpp
LoadReferenceSfCifTest.cpp
WriteReflectionsTest.cpp
RugnuxResultFilesTest.cpp
UnitCellTest.cpp
CCTest.cpp
MultiLatticeSearchTest.cpp
LatticeReductionTest.cpp
BeamCenterFromBackgroundTest.cpp
BeamCenterFFTTest.cpp
BeamCenterFFTGPUTest.cpp
BearerTokensTest.cpp
BrokerHttpAuthTest.cpp
DectrisSimplonClientTest.cpp
../broker/JFJochBrokerHttp.cpp
)
target_link_libraries(jfjoch_test Catch2WithMain JFJochBroker JFJochReceiver JFJochReader JFJochStreamWriter
JFJochRugnuxOutput JFJochRugnux JFJochModelWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochPreview
jfjoch_xds_plugin ZLIB::ZLIB httplib::httplib)
target_include_directories(jfjoch_test PRIVATE .)
IF (JFJOCH_CUDA_AVAILABLE)
TARGET_COMPILE_DEFINITIONS(jfjoch_test PRIVATE FFBIDX_SIMPLE_DATA_DIR="${FFBIDX_SIMPLE_DATA_DIR}")
ENDIF()
find_package(Threads REQUIRED)
add_library(enospc_shim MODULE enospc_shim.c)
target_link_libraries(enospc_shim PRIVATE Threads::Threads dl)
set_target_properties(enospc_shim PROPERTIES PREFIX "" POSITION_INDEPENDENT_CODE ON) # remove "lib"
ADD_EXECUTABLE(jfjoch_hdf5_enospc_test jfjoch_hdf5_enospc_test.cpp)
target_link_libraries(jfjoch_hdf5_enospc_test Catch2WithMain JFJochWriter)