Skip to content

Commit

Permalink
refs #6543 -- disabled OMP again
Browse files Browse the repository at this point in the history
to resolve strange problem with memory leak in DataHandling dll.
  • Loading branch information
abuts committed Feb 28, 2013
1 parent a2a5f68 commit d589aa3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Expand Up @@ -117,7 +117,7 @@ class DLLExport LoadDetectorInfo : public API::Algorithm
void readLibisisNXS(::NeXus::File *hFile, std::vector<detectorInfo> &detStruct,std::vector<int32_t>&detType,std::vector<float> &detOffset,std::vector<detid_t> &detList);
void readDetDotDatNXS(::NeXus::File *hFile, std::vector<detectorInfo> &detStruct,std::vector<int32_t>&detType,std::vector<float> &detOffset,std::vector<detid_t> &detList);

void setDetectorParams(const detectorInfo &params, detectorInfo &changed);
void setDetectorParams(const detectorInfo &params, detectorInfo &changed,bool doLogging=true);
void adjDelayTOFs(double lastOffset, bool &differentDelays, const std::vector<detid_t> &detectIDs=std::vector<detid_t>(), const std::vector<float> &delays=std::vector<float>());
void adjDelayTOFs(double lastOffset, bool &differentDelays, const detid_t * const detectIDs, const float * const delays, int numDetectors);
void adjustXs(const std::vector<detid_t> &detIDs, const std::vector<float> &offsets);
Expand Down
28 changes: 15 additions & 13 deletions Code/Mantid/Framework/DataHandling/src/LoadDetectorInfo.cpp
Expand Up @@ -423,7 +423,7 @@ void LoadDetectorInfo::readRAW(const std::string& fName)
* @param change :: if the parameters are successfully changed they are stored here
* @throw NotFoundError if a pointer to the specified detector couldn't be retrieved
*/
void LoadDetectorInfo::setDetectorParams(const detectorInfo &params, detectorInfo &change)
void LoadDetectorInfo::setDetectorParams(const detectorInfo &params, detectorInfo &change,bool doLogging)
{
Geometry::IDetector_const_sptr det = m_instrument->getDetector(params.detID);
// Set the detectors pressure.
Expand All @@ -445,7 +445,8 @@ void LoadDetectorInfo::setDetectorParams(const detectorInfo &params, detectorInf


// this operation has been successful if we are here, the following information is useful for logging
change = params;
if(doLogging)
change = params;
}

/** Decides if the bin boundaries for all non-monitor spectra will be the same and runs the appropriate
Expand Down Expand Up @@ -847,10 +848,10 @@ void LoadDetectorInfo::readNXS(const std::string& fName)

bool noneSet = true;
size_t detectorProblemCount(0);
PRAGMA(omp parallel for reduction(|| : differentOffsets))
//PRAGMA(omp parallel for reduction(|| : differentOffsets))
for(int i=0;i<int(nDetectors);i++)
{
PARALLEL_START_INTERUPT_REGION
// PARALLEL_START_INTERUPT_REGION

// check we have a supported code
switch (detType[i])
Expand All @@ -861,7 +862,7 @@ void LoadDetectorInfo::readNXS(const std::string& fName)

// the following detectors codes specify little or no analysis
case MONITOR_DEVICE :
PARALLEL_CRITICAL(different_mon_offset)
//PARALLEL_CRITICAL(different_mon_offset)
{
// throws invalid_argument if the detection delay time is different for different monitors
noteMonitorOffset(detOffset[i], detStruct[i].detID);
Expand All @@ -874,7 +875,7 @@ void LoadDetectorInfo::readNXS(const std::string& fName)

//we can't use data for detectors with other codes because we don't know the format, ignore the data and write to g_log.warning() once at the end
default :
PARALLEL_CRITICAL(problem_detector)
//PARALLEL_CRITICAL(problem_detector)
{
detectorProblemCount ++;
g_log.debug() << "Ignoring data for a detector with code " << detType[i] << std::endl;
Expand All @@ -889,7 +890,7 @@ void LoadDetectorInfo::readNXS(const std::string& fName)
{// could mean different detectors have different offsets and we need to do things thoroughly
if ( detectorOffset == UNSETOFFSET )
{
PARALLEL_CRITICAL(det_offset)
// PARALLEL_CRITICAL(det_offset)
{
if(detectorOffset == UNSETOFFSET) detectorOffset = detOffset[i];
if(detOffset[i] != detectorOffset) differentOffsets=true;
Expand All @@ -907,11 +908,11 @@ void LoadDetectorInfo::readNXS(const std::string& fName)
bool exception(false);
try
{
setDetectorParams(detStruct[i], log);
setDetectorParams(detStruct[i], log,false);
}
catch (Exception::NotFoundError &)
{// there are likely to be some detectors that we can't find in the instrument definition and we can't save parameters for these. We can't do anything about this just report the problem at the end
PARALLEL_CRITICAL(non_existing_detector)
//PARALLEL_CRITICAL(non_existing_detector)
{
missingDetectors.push_back(detStruct[i].detID);
}
Expand All @@ -925,18 +926,19 @@ void LoadDetectorInfo::readNXS(const std::string& fName)

if ( i % 100 == 0 )
{
//PARALLEL_CRITICAL(logging)
// PARALLEL_CRITICAL(logging)
{
sometimesLogSuccess(log, noneSet);
log = detStruct[i];
//sometimesLogSuccess(log, noneSet);
progress(static_cast<double>(i));
interruption_point();
}
}

}
PARALLEL_END_INTERUPT_REGION
//PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
//PARALLEL_CHECK_INTERUPT_REGION

sometimesLogSuccess(log, noneSet = true);
g_log.notice() << "Adjusting time of flight X-values by detector delay times, detector have the different offsets: "<< differentOffsets << std::endl;
Expand Down
Expand Up @@ -450,6 +450,7 @@ class LoadDetectorInfoTest : public CxxTest::TestSuite
if ( code[j] == "3" )
{
TS_ASSERT(par);
if(!par)return;
if (singleWallPressure)
{
TS_ASSERT_DELTA(par->value<double>(),boost::lexical_cast<double>(pressure[j]),1.e-3);
Expand All @@ -462,6 +463,7 @@ class LoadDetectorInfoTest : public CxxTest::TestSuite

par = pmap.get(baseComp,"wallT(m)");
TS_ASSERT(par);
if(!par)return;
if(singleWallPressure)
{
if(j<3)TS_ASSERT_DELTA(par->value<double>(), boost::lexical_cast<double>(wallThick[j]),1.e-3);
Expand Down

0 comments on commit d589aa3

Please sign in to comment.