MXAnalysisWithoutFPGA: Use GPU spot finder if available
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../compression/JFJochDecompress.h"
|
||||
|
||||
#include "SpotAnalyze.h"
|
||||
#include "spot_finding/ImageSpotFinderFactory.h"
|
||||
|
||||
MXAnalysisWithoutFPGA::MXAnalysisWithoutFPGA(const DiffractionExperiment &in_experiment,
|
||||
const AzimuthalIntegration &in_integration,
|
||||
@@ -33,7 +34,7 @@ MXAnalysisWithoutFPGA::MXAnalysisWithoutFPGA(const DiffractionExperiment &in_exp
|
||||
for (int i = 0; i < npixels; i++)
|
||||
mask_1bit[i] = (in_mask.GetMask().at(i) != 0);
|
||||
|
||||
spotFinder = std::make_unique<ImageSpotFinderCPU>(experiment.GetXPixelsNum(), experiment.GetYPixelsNum());
|
||||
spotFinder = CreateImageSpotFinder(experiment.GetXPixelsNum(), experiment.GetYPixelsNum());
|
||||
updated_image = spotFinder->GetHostBuffer();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../common/AzimuthalIntegration.h"
|
||||
#include "../common/PixelMask.h"
|
||||
#include "../common/AzimuthalIntegrationProfile.h"
|
||||
#include "spot_finding/ImageSpotFinderCPU.h"
|
||||
#include "spot_finding/ImageSpotFinder.h"
|
||||
#include "indexing/IndexerThreadPool.h"
|
||||
|
||||
class MXAnalysisWithoutFPGA {
|
||||
|
||||
@@ -9,6 +9,8 @@ ADD_LIBRARY(JFJochSpotFinding STATIC
|
||||
DetModuleSpotFinder_cpu.h
|
||||
ImageSpotFinder.cpp
|
||||
ImageSpotFinder.h
|
||||
ImageSpotFinderFactory.cpp
|
||||
ImageSpotFinderFactory.h
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(JFJochSpotFinding JFJochCommon)
|
||||
|
||||
18
image_analysis/spot_finding/ImageSpotFinderFactory.cpp
Normal file
18
image_analysis/spot_finding/ImageSpotFinderFactory.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "ImageSpotFinderFactory.h"
|
||||
#include "ImageSpotFinderCPU.h"
|
||||
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
#include "../../common/CUDAWrapper.h"
|
||||
#include "ImageSpotFinderGPU.h"
|
||||
#endif
|
||||
|
||||
std::unique_ptr<ImageSpotFinder> CreateImageSpotFinder(size_t width, size_t height) {
|
||||
#ifdef JFJOCH_USE_CUDA
|
||||
if (get_gpu_count() > 0)
|
||||
return std::make_unique<ImageSpotFinderGPU>(width, height);
|
||||
#endif
|
||||
return std::make_unique<ImageSpotFinderCPU>(width, height);
|
||||
}
|
||||
11
image_analysis/spot_finding/ImageSpotFinderFactory.h
Normal file
11
image_analysis/spot_finding/ImageSpotFinderFactory.h
Normal file
@@ -0,0 +1,11 @@
|
||||
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef JFJOCH_IMAGESPOTFINDERFACTORY_H
|
||||
#define JFJOCH_IMAGESPOTFINDERFACTORY_H
|
||||
|
||||
#include "ImageSpotFinder.h"
|
||||
|
||||
std::unique_ptr<ImageSpotFinder> CreateImageSpotFinder(size_t width, size_t height);
|
||||
|
||||
#endif //JFJOCH_IMAGESPOTFINDERFACTORY_H
|
||||
Reference in New Issue
Block a user