Ability to choose the number of threads (the 'threads' parameter was ignored!)

This commit is contained in:
Daniel Girardeau-Montaut
2022-05-24 13:27:06 +02:00
parent 8683f6c44c
commit ec688f9d6f
2 changed files with 14 additions and 4 deletions
+11 -4
View File
@@ -47,13 +47,20 @@ namespace {
}
}
PoissonReconLib::Parameters::Parameters()
int PoissonReconLib::Parameters::GetMaxThreadCount()
{
#ifdef WITH_OPENMP
threads = omp_get_num_procs();
return omp_get_num_procs();
#else
return std::thread::hardware_concurrency();
#endif
}
PoissonReconLib::Parameters::Parameters()
: threads(GetMaxThreadCount())
{
}
template <typename _Real>
class Vertex : public PointData<_Real>
{
@@ -714,9 +721,9 @@ bool PoissonReconLib::Reconstruct( const Parameters& params,
}
#ifdef WITH_OPENMP
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::OPEN_MP, std::thread::hardware_concurrency());
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::OPEN_MP, params.threads);
#else
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::THREAD_POOL, std::thread::hardware_concurrency());
ThreadPool::Init((ThreadPool::ParallelType)(int)ThreadPool::THREAD_POOL, params.threads);
#endif
PointStream<float> pointStream(inCloud);