diff --git a/ContextBasedFeature.cpp b/ContextBasedFeature.cpp index acb6950..3486957 100644 --- a/ContextBasedFeature.cpp +++ b/ContextBasedFeature.cpp @@ -260,7 +260,7 @@ bool ContextBasedFeature::prepare( const CorePoints& corePoints, if (cancelled) { //process cancelled by the user - errorMessage = "Process cancelled"; + errorMessage = "[ContextBasedFeature] Process cancelled"; } } } diff --git a/PointFeature.cpp b/PointFeature.cpp index a7d0312..f9c1e39 100644 --- a/PointFeature.cpp +++ b/PointFeature.cpp @@ -425,7 +425,7 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints, #ifndef _DEBUG #if defined(_OPENMP) bool cancelled = false; -#pragma omp parallel for num_threads(omp_get_max_threads()) +#pragma omp parallel for #endif #endif for (int i = 0; i < static_cast(pointCount); ++i) @@ -479,7 +479,7 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints, if (cancelled) { //process cancelled by the user - error = "Process cancelled"; + error = "[Point feature] Process cancelled"; } } } diff --git a/q3DMASC.cpp b/q3DMASC.cpp index c551ff4..254e27b 100644 --- a/q3DMASC.cpp +++ b/q3DMASC.cpp @@ -618,11 +618,11 @@ void q3DMASCPlugin::doTrainAction() //prepare the features and the test cloud if (!toPrepareTest.empty()) { - progressDlg.show(); - QString error; masc::CorePoints corePointsTest; corePointsTest.cloud = corePointsTest.origin = testCloud; corePointsTest.role = mainCloudLabel; + progressDlg.show(); + QString error; if (!masc::Tools::PrepareFeatures(corePointsTest, toPrepareTest, error, &progressDlg, &generatedScalarFieldsTest)) { m_app->dispToConsole(error, ccMainAppInterface::ERR_CONSOLE_MESSAGE); diff --git a/q3DMASCClassifier.cpp b/q3DMASCClassifier.cpp index 2b141b7..91c9eab 100644 --- a/q3DMASCClassifier.cpp +++ b/q3DMASCClassifier.cpp @@ -210,7 +210,7 @@ bool Classifier::classify( const Feature::Source::Set& featureSources, #ifndef _DEBUG #if defined(_OPENMP) bool cancelled = false; -#pragma omp parallel for num_threads(omp_get_max_threads()) +#pragma omp parallel for #endif #endif for (int i = 0; i < static_cast(cloud->size()); ++i) diff --git a/q3DMASCTools.cpp b/q3DMASCTools.cpp index 181625c..cfa22a5 100644 --- a/q3DMASCTools.cpp +++ b/q3DMASCTools.cpp @@ -1236,16 +1236,16 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features #ifndef _DEBUG #if defined(_OPENMP) - int num_threads = omp_get_max_threads(); - ccLog::Print("Using OpenMP with " + QString::number(num_threads) + " threads "); bool cancelled = false; -#pragma omp parallel for num_threads(num_threads) +#pragma omp parallel for #endif #endif for (int i = 0; i < static_cast(pointCount); ++i) { if (!cancelled) { + QString localErrorStr; + //spherical neighborhood extraction structure CCCoreLib::DgmOctree::NearestNeighboursSearchStruct nNSS; { @@ -1329,7 +1329,7 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features if (!feature->computeValue(nNSS.pointsInNeighbourhood, nNSS.queryPoint, outputValue)) { //an error occurred - errorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud1->getName(); + localErrorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud1->getName(); success = false; break; } @@ -1345,7 +1345,7 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features if (!feature->computeValue(nNSS.pointsInNeighbourhood, nNSS.queryPoint, outputValue)) { //an error occurred - errorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud2->getName(); + localErrorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud2->getName(); success = false; break; } @@ -1364,7 +1364,7 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features if (!feature->computeValue(nNSS.pointsInNeighbourhood, nNSS.queryPoint, outputValue)) { //an error occurred - errorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud1->getName(); + localErrorStr = "An error occurred during the computation of feature " + feature->toString() + "on cloud " + feature->cloud1->getName(); success = false; break; } @@ -1375,24 +1375,34 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features if (!success) { - break; + ccLog::Warning(localErrorStr); + ccLog::Warning("(!success) with currentScale " + QString::number(currentScale) + " point " + QString::number(i)); } } //for each scale } + if (!success) + { + mutex.lock(); + cancelled = true; + errorStr = "Process cancelled (features computation not successful), point " + QString::number(i) + " (using OpenMP with " + QString::number(omp_get_num_threads()) + " threads)"; + ccLog::Warning(errorStr); + mutex.unlock(); + } + if (progressCb) { mutex.lock(); cancelled = !nProgress.oneStep(); - mutex.unlock(); if (cancelled) { //process cancelled by the user - ccLog::Warning("Process cancelled"); - errorStr = "Process cancelled, iteration " + QString::number(i); + errorStr = "Process cancelled, point " + QString::number(i) + " (using OpenMP with " + QString::number(omp_get_num_threads()) + " threads)"; + ccLog::Warning(errorStr); success = false; } + mutex.unlock(); } } } //for each point