mirror of
https://github.com/dgirardeau/q3DMASC.git
synced 2026-08-29 08:34:48 +08:00
remove breaks from omp parallel loops
This commit is contained in:
@@ -23,9 +23,6 @@
|
||||
//qCC_db
|
||||
#include <ccScalarField.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//Qt
|
||||
#include <QMutex>
|
||||
|
||||
@@ -197,10 +194,12 @@ bool ContextBasedFeature::prepare( const CorePoints& corePoints,
|
||||
bool cancelled = false;
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
#pragma omp parallel for num_threads(omp_get_max_threads())
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
{
|
||||
if (!cancelled)
|
||||
{
|
||||
const CCVector3* P = corePoints.cloud->getPoint(i);
|
||||
CCCoreLib::ReferenceCloud Yk(&classCloud);
|
||||
@@ -262,10 +261,10 @@ bool ContextBasedFeature::prepare( const CorePoints& corePoints,
|
||||
{
|
||||
//process cancelled by the user
|
||||
errorMessage = "Process cancelled";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (progressCb)
|
||||
{
|
||||
|
||||
+6
-6
@@ -89,9 +89,6 @@ constexpr const char* LAS_FIELD_NAMES[22] = {"X",
|
||||
//CCLib
|
||||
#include <WeibullDistribution.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//system
|
||||
#include <assert.h>
|
||||
|
||||
@@ -427,10 +424,13 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints,
|
||||
error.clear();
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
bool cancelled = false;
|
||||
#pragma omp parallel for num_threads(omp_get_max_threads())
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
{
|
||||
if (!cancelled)
|
||||
{
|
||||
const CCVector3* P = corePoints.cloud->getPoint(i);
|
||||
CCCoreLib::ReferenceCloud Yk(&cloud2);
|
||||
@@ -474,16 +474,16 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints,
|
||||
if (progressCb)
|
||||
{
|
||||
mutex.lock();
|
||||
bool cancelled = !nProgress.oneStep();
|
||||
cancelled = !nProgress.oneStep();
|
||||
mutex.unlock();
|
||||
if (cancelled)
|
||||
{
|
||||
//process cancelled by the user
|
||||
error = "Process cancelled";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outSF->computeMinAndMax();
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccMainAppInterface.h>
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//Qt
|
||||
#include <QCoreApplication>
|
||||
@@ -210,10 +209,12 @@ bool Classifier::classify( const Feature::Source::Set& featureSources,
|
||||
int numberOfTrees = static_cast<int>(m_rtrees->getRoots().size());
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
bool cancelled = false;
|
||||
#pragma omp parallel for num_threads(omp_get_max_threads())
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(cloud->size()); ++i)
|
||||
{
|
||||
{
|
||||
//allocate the data matrix
|
||||
cv::Mat test_data;
|
||||
@@ -225,9 +226,11 @@ bool Classifier::classify( const Feature::Source::Set& featureSources,
|
||||
{
|
||||
errorMessage = cvex.msg.c_str();
|
||||
success = false;
|
||||
break;
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
if (!cancelled)
|
||||
{
|
||||
for (int fIndex = 0; fIndex < attributesPerSample; ++fIndex)
|
||||
{
|
||||
double value = wrappers[fIndex]->pointValue(i);
|
||||
@@ -258,8 +261,10 @@ bool Classifier::classify( const Feature::Source::Set& featureSources,
|
||||
{
|
||||
//process cancelled by the user
|
||||
success = false;
|
||||
break;
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classificationSF->computeMinAndMax();
|
||||
|
||||
+8
-8
@@ -30,9 +30,6 @@
|
||||
#include <ccScalarField.h>
|
||||
#include <ccPointCloud.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//qPDALIO
|
||||
#include "../../../core/IO/qPDALIO/include/LASFields.h"
|
||||
|
||||
@@ -1226,25 +1223,28 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features
|
||||
unsigned char octreeLevel = octree->findBestLevelForAGivenNeighbourhoodSizeExtraction(largestRadius);
|
||||
|
||||
unsigned pointCount = corePoints.size();
|
||||
QString logMessage = QString("Computing %1 features on cloud %2 (%3 core points)").arg(fas.featureCount).arg(sourceCloud->getName()).arg(pointCount);
|
||||
QString logMessage = QString("Computing %1 features on cloud %2 at %3 core points").arg(fas.featureCount).arg(sourceCloud->getName()).arg(pointCount);
|
||||
if (progressCb)
|
||||
{
|
||||
progressCb->setMethodTitle("Compute features");
|
||||
progressCb->setInfo(qPrintable(logMessage));
|
||||
}
|
||||
ccLog::Print(logMessage + ", nb points " + QString::number(pointCount));
|
||||
ccLog::Print(logMessage);
|
||||
CCCoreLib::NormalizedProgress nProgress(progressCb, pointCount);
|
||||
|
||||
QMutex mutex;
|
||||
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
int num_threads = ccQtHelpers::GetMaxThreadCount(omp_get_max_threads());
|
||||
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)
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
{
|
||||
if (!cancelled)
|
||||
{
|
||||
//spherical neighborhood extraction structure
|
||||
CCCoreLib::DgmOctree::NearestNeighboursSearchStruct nNSS;
|
||||
@@ -1384,7 +1384,7 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features
|
||||
if (progressCb)
|
||||
{
|
||||
mutex.lock();
|
||||
bool cancelled = !nProgress.oneStep();
|
||||
cancelled = !nProgress.oneStep();
|
||||
mutex.unlock();
|
||||
if (cancelled)
|
||||
{
|
||||
@@ -1392,9 +1392,9 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features
|
||||
ccLog::Warning("Process cancelled");
|
||||
errorStr = "Process cancelled, iteration " + QString::number(i);
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //for each point
|
||||
|
||||
} //for each cloud
|
||||
|
||||
Reference in New Issue
Block a user