Skip to content

Commit

Permalink
refs #9509. Single threaded CCL works faster.
Browse files Browse the repository at this point in the history
Small adjustment to the code to use single threaded CCL. Results in a 4-5 times speed up. This is because we have n * small images being processed rather than one large one. The overhead of the parallel execution completely dominates the speed up acheived from the asynchronous thread execution in this case.

The next step will be to make the algorithm parallel with respect to the individual peaks in the peak list. This should result in a further speedup.
  • Loading branch information
OwenArnold committed May 27, 2014
1 parent 8dcc86e commit db37082
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Code/Mantid/Framework/Crystal/src/IntegratePeaksHybrid.cpp
Expand Up @@ -174,6 +174,8 @@ namespace Mantid
PeakClusterProjection projection(mdWS);
auto outImageResults = boost::make_shared<WorkspaceGroup>();

Progress progress(this, 0, 1, peakWS->getNumberPeaks());

//PARALLEL_FOR1(peakWS)
for (int i = 0; i < peakWS->getNumberPeaks(); ++i)
{
Expand Down Expand Up @@ -215,9 +217,11 @@ namespace Mantid

HardThresholdBackground backgroundStrategy(threshold, normalization);
// CCL. Multi-processor version.
ConnectedComponentLabeling analysis;
const size_t startId = 1;
const size_t nThreads = 1;
ConnectedComponentLabeling analysis(startId, nThreads);

Progress progress(this, 0, 1, 1); // HACK Fix!
Progress dummyProgress;
// Perform CCL.
ClusterTuple clusters = analysis.executeAndFetchClusters(localImage, &backgroundStrategy, progress);
// Extract the clusters
Expand Down Expand Up @@ -248,8 +252,9 @@ namespace Mantid
peak.setIntensity(integratedValues.get<0>());
peak.setSigmaIntensity(integratedValues.get<1>());

progress.report();

}
progress.report();
//PARALLEL_END_INTERUPT_REGION
}
//PARALLEL_CHECK_INTERUPT_REGION
Expand Down

0 comments on commit db37082

Please sign in to comment.