mirror of
https://github.com/dgirardeau/q3DMASC.git
synced 2026-08-29 08:34:48 +08:00
use ccQtHelpers::GetMaxThreadCount
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
//qCC_db
|
||||
#include <ccScalarField.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//Qt
|
||||
#include <QMutex>
|
||||
|
||||
@@ -194,7 +197,7 @@ bool ContextBasedFeature::prepare( const CorePoints& corePoints,
|
||||
bool cancelled = false;
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2))
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
|
||||
+4
-1
@@ -89,6 +89,9 @@ constexpr const char* LAS_FIELD_NAMES[22] = {"X",
|
||||
//CCLib
|
||||
#include <WeibullDistribution.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//system
|
||||
#include <assert.h>
|
||||
|
||||
@@ -424,7 +427,7 @@ static bool ComputeMathOpWithNearestNeighbor( const CorePoints& corePoints,
|
||||
error.clear();
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2))
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
//qPDALIO
|
||||
#include "../../../core/IO/qPDALIO/include/LASFields.h"
|
||||
|
||||
//qCC_plugins
|
||||
//CCPluginAPI
|
||||
#include <ccMainAppInterface.h>
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//Qt
|
||||
#include <QCoreApplication>
|
||||
@@ -209,7 +210,7 @@ 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(std::max(1, omp_get_max_threads() - 2))
|
||||
#pragma omp parallel for num_threads(ccQtHelpers::GetMaxThreadCount(omp_get_max_threads()))
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(cloud->size()); ++i)
|
||||
|
||||
+7
-3
@@ -30,6 +30,9 @@
|
||||
#include <ccScalarField.h>
|
||||
#include <ccPointCloud.h>
|
||||
|
||||
//CCPluginAPI
|
||||
#include <ccQtHelpers.h>
|
||||
|
||||
//qPDALIO
|
||||
#include "../../../core/IO/qPDALIO/include/LASFields.h"
|
||||
|
||||
@@ -1229,15 +1232,16 @@ bool Tools::PrepareFeatures(const CorePoints& corePoints, Feature::Set& features
|
||||
progressCb->setMethodTitle("Compute features");
|
||||
progressCb->setInfo(qPrintable(logMessage));
|
||||
}
|
||||
ccLog::Print(logMessage + " , nb threads " + QString::number(omp_get_max_threads() - 2) + ", nb points " + QString::number(pointCount));
|
||||
ccLog::Print(logMessage + ", nb points " + QString::number(pointCount));
|
||||
CCCoreLib::NormalizedProgress nProgress(progressCb, pointCount);
|
||||
nProgress.reset();
|
||||
|
||||
QMutex mutex;
|
||||
|
||||
#ifndef _DEBUG
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for num_threads(std::max(1, omp_get_max_threads() - 2))
|
||||
int num_threads = ccQtHelpers::GetMaxThreadCount(omp_get_max_threads());
|
||||
ccLog::Print("Using OpenMP with " + QString::number(num_threads) + " threads ");
|
||||
#pragma omp parallel for num_threads(num_threads)
|
||||
#endif
|
||||
#endif
|
||||
for (int i = 0; i < static_cast<int>(pointCount); ++i)
|
||||
|
||||
Reference in New Issue
Block a user