Skip to content

DiamondLightSource/fast-feedback-service

Repository files navigation

Fast Feedback Service

This is a GPU implementation of the DIALS spotfinder algorithm. It is designed to be used in a beamline for real-time feedback and x-ray centring during data collections.

The service, a python script in src/, watches a queue for requests to process images. It then launches the compiled C++ CUDA executable to process the images. This executable is compiled from the source code in spotfinder/.

Setup

In order to create a development environment and compile the service, you need to have the following:

Dependencies

For example, you can create a conda/mamba environment with the following command:

mamba create -c conda-forge -p ENV boost-cpp benchmark gtest cmake hdf5 hdf5-external-filter-plugins compilers bitshuffle

Compiling the CUDA code

To compile the CUDA code, you need to run the following:

mamba activate ENV/         # Activate your environment
cd fast-feedback-service/   # Go to the root of the repository
mkdir build                 # Create a build directory
cd build                    # Go to the build directory
cmake ..                    # Run cmake to generate the makefile
make                        # Compile the code

This will create the executable spotfinder in the build/bin/ directory.

Usage

Environment Variables

The service uses the following environment variables:

  • SPOTFINDER: The path to the compiled spotfinder executable.
    • If not set, the service will look for the executable in the build/bin/ or _build/bin directories.

Running the service

To run the service, you need to be on a machine with an NVIDIA GPU and the CUDA toolkit installed.

Set up the environment variables:

export SPOTFINDER=/path/to/spotfinder
export ZOCALO_CONFIG=/dls_sw/apps/zocalo/live/configuration.yaml

Then launch the service through Zocalo:

zocalo.service -s GPUPerImageAnalysis

Goals

  • 500 Hz throughput for Eiger real-time data collection
  • 2500 Hz throughput for Jungfrau real-time data collection

Repository Structure

Folder Name Implementation
baseline/ A standalone implementation of the standard DIALS dispersion spotfinder that can be used for comparison.
h5read/ A small C/C++ library to read hdf5 files in a standard way
include/ Common utility code, like coloring output, or image comparison, is stored here.
src/ Service to run the spotfinder
spotfinder/ CUDA implementation of the spotfinder algorithm
tests/ Tests for the spotfinder code