Commit e5aabb02 authored by ESTERIE Pierre's avatar ESTERIE Pierre

Change omp_get_max_threads to omp_get_num_threads in adaptative task algo

parent c6fea616
......@@ -129,25 +129,21 @@ public:
FAdaptiveTask(tree_t* tree, kernel_t* kernel) :
_tree(*tree)
{
// Place kernel objects near their threads in memory to avoid NUMA
// latency
int threads = 1;
#pragma omp parallel shared(threads)
{
#pragma omp single nowait
{
threads = omp_get_max_threads();
}
}
#pragma omp parallel
#pragma omp master
threads = omp_get_num_threads();
_kernels.resize(threads);
#pragma omp parallel for shared(_kernels,kernel)
for(int i = 0; i < omp_get_num_threads(); ++i) {
if(i == omp_get_thread_num()) {
_kernels[i] = std::make_unique<kernel_t>(*kernel);
}
#pragma omp parallel num_threads(threads)
{
#pragma omp critical
{
_kernels[i] = std::make_unique<kernel_t>(*kernel);
}
}
}
......@@ -161,7 +157,7 @@ public:
{
#pragma omp single nowait
{
threads = omp_get_max_threads();
threads = omp_get_num_threads();
}
}
return std::string("threads: ") + std::to_string(threads);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment