RadialIntegrationCPUTest: Fix
This commit is contained in:
1 parent
5df72a4d54
commit
06ca7be10d
1 file changed
+16
-10
@@ -9,12 +9,16 @@
|
||||
|
||||
Logger logger{"RadialIntegrationCPUTest"};
|
||||
|
||||
void RunRadialIntegrationThread(RadialIntegration* integration,
|
||||
void RunRadialIntegrationThread(const std::vector<uint16_t>& mapping,
|
||||
uint32_t nbins, uint32_t pixel_split,
|
||||
int16_t* image, size_t nimages,
|
||||
size_t image0, size_t stride,
|
||||
size_t npixel) {
|
||||
|
||||
RadialIntegration integration(mapping, nbins, pixel_split);
|
||||
|
||||
for (size_t i = image0; i < nimages; i += stride)
|
||||
integration->ProcessOneImage(image + i * npixel, npixel);
|
||||
integration.ProcessOneImage(image + i * npixel, npixel);
|
||||
}
|
||||
|
||||
auto TestRadialIntegration(const DiffractionExperiment &experiment,
|
||||
@@ -23,13 +27,6 @@ auto TestRadialIntegration(const DiffractionExperiment &experiment,
|
||||
uint32_t pixel_split) {
|
||||
uint32_t nredo = 5;
|
||||
RadialIntegrationMapping mapping(experiment);
|
||||
std::unique_ptr<RadialIntegration> integration;
|
||||
|
||||
if (pixel_split == 1)
|
||||
integration = std::make_unique<RadialIntegration>(mapping);
|
||||
else
|
||||
integration = std::make_unique<RadialIntegration>(mapping.GetPixelToBinMappingSplitTo4(),
|
||||
mapping.GetBinNumber(), 4);
|
||||
|
||||
std::vector<float> result;
|
||||
|
||||
@@ -37,10 +34,19 @@ auto TestRadialIntegration(const DiffractionExperiment &experiment,
|
||||
for (int redo = 0; redo < nredo; redo++) {
|
||||
std::vector<std::future<void>> futures;
|
||||
for (int i = 0; i < nthreads; i++) {
|
||||
if (pixel_split == 1)
|
||||
futures.emplace_back(std::async(std::launch::async, &RunRadialIntegrationThread,
|
||||
integration.get(), image, nimages,
|
||||
std::ref(mapping.GetPixelToBinMapping()), mapping.GetBinNumber(), 1,
|
||||
image, nimages,
|
||||
i, nthreads,
|
||||
experiment.GetPixelsNum()));
|
||||
else
|
||||
futures.emplace_back(std::async(std::launch::async, &RunRadialIntegrationThread,
|
||||
mapping.GetPixelToBinMappingSplitTo4(), mapping.GetBinNumber(), 4,
|
||||
image, nimages,
|
||||
i, nthreads,
|
||||
experiment.GetPixelsNum()));
|
||||
|
||||
}
|
||||
for (auto &f: futures)
|
||||
f.get();
|
||||
|
||||
Reference in new issue
Block a user