Commit 71995752 authored by ESTERIE Pierre's avatar ESTERIE Pierre

Fix bad vector resizing with omp when constructing adaptive task algo

parent 1902e750
......@@ -127,21 +127,28 @@ public:
* \param kernel The kernel to use
*/
FAdaptiveTask(tree_t* tree, kernel_t* kernel) :
_tree(*tree)
_tree(*tree)
{
// Place kernel objects near their threads in memory to avoid NUMA
// latency
#pragma omp parallel
int threads = 1;
#pragma omp parallel shared(threads)
{
for(int i = 0; i < omp_get_num_threads(); ++i) {
if(i == omp_get_thread_num()) {
this->_kernels.emplace_back(new kernel_t(*kernel));
}
#pragma omp barrier
#pragma omp single nowait
{
threads = omp_get_max_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);
}
}
}
std::string name() const override {
......
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