Build Packages / Create release (push) Successful in 9s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m8s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 11m12s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 16m43s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 20m56s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 22m4s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 26m57s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 28m24s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 27m58s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m29s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 18m23s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 19m55s
Build Packages / Generate python client (push) Successful in 32s
Build Packages / Build documentation (push) Successful in 1m32s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 27m20s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 29m27s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 32m41s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 34m46s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 37m25s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 35m56s
Build Packages / Unit tests (push) Successful in 2h8m44s
Build Packages / Validation Battery (push) Successful in 33m35s
* jfjoch_broker: Optional live Rugnux analysis of DECTRIS rotation collections inside the broker, with merged data, maps and the placed model written beside the master file, the rotation lattice in the scan result, and a "Rugnux live" tab and dashboard row in the web frontend. * Rugnux: Faster processing, with molecular replacement and model validation spread over several GPUs and run on the Apple GPU on macOS. * Rugnux: The polarization stated in miniCBF and d*TREK headers is used, twinned crystals' space groups are decided more reliably, and a run that finds no lattice still reports every image. Reviewed-on: #86 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
93 lines
3.8 KiB
C++
93 lines
3.8 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <future>
|
|
#include <latch>
|
|
|
|
#include "JFJochReceiver.h"
|
|
#include "../common/DiffractionExperiment.h"
|
|
#include "../common/PixelMask.h"
|
|
#include "../common/ImageBuffer.h"
|
|
#include "../common/Logger.h"
|
|
#include "../image_pusher/ImagePusher.h"
|
|
#include "../preview/PreviewImage.h"
|
|
#include "../preview/ZMQPreviewSocket.h"
|
|
#include "../preview/ZMQMetadataSocket.h"
|
|
#include "LossyFilter.h"
|
|
#include "../common/MovingAverage.h"
|
|
#include "JFJochReceiverCurrentStatus.h"
|
|
#include "../common/JFJochReceiverPlots.h"
|
|
#include "JFJochReceiverOutput.h"
|
|
#include "../image_puller/ZMQImagePuller.h"
|
|
#include "../image_analysis/MXAnalysisWithoutFPGA.h"
|
|
#include "../image_analysis/dark_mask_analysis/DarkMaskAnalysis.h"
|
|
|
|
class JFJochReceiverLite : public JFJochReceiver {
|
|
// Overriding Cancel(bool) below would otherwise hide the Cancel(const JFJochException &)
|
|
// the analysis threads call.
|
|
using JFJochReceiver::Cancel;
|
|
|
|
ImagePuller &image_puller;
|
|
|
|
std::atomic<bool> end_message_received{false};
|
|
|
|
// Set when the caller reports the run is over - JFJochServices::Stop cancels the receiver
|
|
// silently once the detector reads back idle. Only consulted while waiting for the start
|
|
// message; a silent cancel must not interrupt images that are still being processed.
|
|
std::atomic<bool> detector_finished{false};
|
|
|
|
// How long a start message may still be in flight after the detector reported it had finished.
|
|
// The detector can also read back as idle for a moment just after it was armed, so a run is not
|
|
// abandoned the instant the silent cancel arrives.
|
|
constexpr static auto StartMessageGrace = std::chrono::seconds(5);
|
|
|
|
const int64_t data_analysis_nthreads;
|
|
|
|
std::vector<std::future<void>> data_analysis_futures;
|
|
std::future<void> measurement;
|
|
|
|
std::latch measurement_started;
|
|
std::latch data_analysis_started;
|
|
|
|
DarkMaskAnalysis dark_mask_analysis;
|
|
|
|
void MaskThread(uint32_t id);
|
|
void MeasurementThread();
|
|
void DataAnalysisThread(uint32_t id);
|
|
public:
|
|
// Shared with JFJochReceiverRugnux, which forwards a collection the same way.
|
|
static bool SerializeImageOrDrop(CBORStream2Serializer &serializer, DataMessage &msg,
|
|
ZeroCopyReturnValue &loc, size_t slot_size, Logger &logger);
|
|
// Takes what the detector's start message decides into the experiment.
|
|
static void ApplyStartMessage(DiffractionExperiment &experiment, const StartMessage &message);
|
|
|
|
static int64_t NumberOfDataAnalysisThreads(int64_t requested_thread_number, const DiffractionExperiment& experiment);
|
|
|
|
JFJochReceiverLite(const DiffractionExperiment& experiment,
|
|
const PixelMask &pixel_mask,
|
|
ImagePuller &image_puller,
|
|
ImagePusher &image_pusher,
|
|
Logger &logger, int64_t forward_and_sum_nthreads,
|
|
const SpotFindingSettings &spot_finding_settings,
|
|
JFJochReceiverCurrentStatus ¤t_status,
|
|
JFJochReceiverPlots &plots,
|
|
ImageBuffer &image_buffer,
|
|
ZMQPreviewSocket *zmq_preview_socket = nullptr,
|
|
ZMQMetadataSocket *zmq_metadata_socket = nullptr,
|
|
IndexerThreadPool *indexing_thread_pool = nullptr);
|
|
~JFJochReceiverLite() override;
|
|
|
|
void StopReceiver() override;
|
|
void Cancel(bool silent) override;
|
|
|
|
float GetEfficiency() const override;
|
|
float GetProgress() const override;
|
|
|
|
void SetSpotFindingSettings(const SpotFindingSettings &spot_finding_settings) override;
|
|
JFJochReceiverOutput GetFinalStatistics() const override;
|
|
};
|
|
|
|
|