Skip to content

Commit

Permalink
Add back the parallelisation for SofQW polygon algorithms
Browse files Browse the repository at this point in the history
Refs #12584
  • Loading branch information
martyngigg committed Jun 25, 2015
1 parent 137727e commit 3c2f089
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 7 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/SofQWNormalisedPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ void SofQWNormalisedPolygon::exec() {
}

const MantidVec &X = inputWS->readX(0);

int emode = m_EmodeProperties.m_emode;
/* PARALLEL_FOR2(inputWS, outputWS) */

PARALLEL_FOR2(inputWS, outputWS)
for (int64_t i = 0; i < static_cast<int64_t>(nHistos);
++i) // signed for openmp
{
/* PARALLEL_START_INTERUPT_REGION */
PARALLEL_START_INTERUPT_REGION

DetConstPtr detector = inputWS->getDetector(i);
if (detector->isMasked() || detector->isMonitor()) {
Expand Down Expand Up @@ -157,18 +157,20 @@ void SofQWNormalisedPolygon::exec() {
std::upper_bound(m_Qout.begin(), m_Qout.end(), lrQ) - m_Qout.begin();
if (qIndex != 0 && qIndex < static_cast<int>(m_Qout.size())) {
// Add this spectra-detector pair to the mapping
PARALLEL_CRITICAL(SofQWNormalisedPolygon_spectramap) {
specNumberMapping.push_back(
outputWS->getSpectrum(qIndex - 1)->getSpectrumNo());
detIDMapping.push_back(detector->getID());
}
}
}
if (g_log.is(Logger::Priority::PRIO_DEBUG)) {
g_log.debug(logStream.str());
}

/* PARALLEL_END_INTERUPT_REGION */
PARALLEL_END_INTERUPT_REGION
}
/* PARALLEL_CHECK_INTERUPT_REGION */
PARALLEL_CHECK_INTERUPT_REGION

outputWS->finalize();
this->normaliseOutput(outputWS, inputWS);
Expand Down
16 changes: 9 additions & 7 deletions Code/Mantid/Framework/Algorithms/src/SofQWPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ void SofQWPolygon::exec() {
qCalculator = &SofQWPolygon::calculateIndirectQ;
}

/* PARALLEL_FOR2(inputWS, outputWS) */
PARALLEL_FOR2(inputWS, outputWS)
for (int64_t i = 0; i < static_cast<int64_t>(nTheta);
++i) // signed for openmp
{
/* PARALLEL_START_INTERUPT_REGION */
PARALLEL_START_INTERUPT_REGION

const double theta = m_thetaPts[i];
if (theta < 0.0) // One to skip
Expand Down Expand Up @@ -112,15 +112,17 @@ void SofQWPolygon::exec() {
std::upper_bound(m_Qout.begin(), m_Qout.end(), lrQ) - m_Qout.begin();
if (qIndex != 0 && qIndex < static_cast<int>(m_Qout.size())) {
// Add this spectra-detector pair to the mapping
specNumberMapping.push_back(
outputWS->getSpectrum(qIndex - 1)->getSpectrumNo());
detIDMapping.push_back(det->getID());
PARALLEL_CRITICAL(SofQWPolygon_spectramap) {
specNumberMapping.push_back(
outputWS->getSpectrum(qIndex - 1)->getSpectrumNo());
detIDMapping.push_back(det->getID());
}
}
}

/* PARALLEL_END_INTERUPT_REGION */
PARALLEL_END_INTERUPT_REGION
}
/* PARALLEL_CHECK_INTERUPT_REGION */
PARALLEL_CHECK_INTERUPT_REGION

normaliseOutput(outputWS, inputWS);

Expand Down

0 comments on commit 3c2f089

Please sign in to comment.