aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/OMP
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-10-04 12:35:58 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit4bd9fda69ce412c456a7f542b3d4c9076d0875b6 (patch)
tree8c3fc3edf6b33cedd49ead8c980df2fa6ea80242 /src/runtime/OMP
parentece307bd365ce0be0be7168fdafa95671480dbbb (diff)
downloadComputeLibrary-4bd9fda69ce412c456a7f542b3d4c9076d0875b6.tar.gz
COMPMID-603: Fix OMPScheduler.
Adds ThreadInfo in the OMPScheduler. Change-Id: I760ff9ea8af0431e024b4a4b1fc77ff88980f51a Reviewed-on: http://mpd-gerrit.cambridge.arm.com/90158 Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/runtime/OMP')
-rw-r--r--src/runtime/OMP/OMPScheduler.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/runtime/OMP/OMPScheduler.cpp b/src/runtime/OMP/OMPScheduler.cpp
index be8164121e..1dd2511990 100644
--- a/src/runtime/OMP/OMPScheduler.cpp
+++ b/src/runtime/OMP/OMPScheduler.cpp
@@ -51,32 +51,34 @@ unsigned int OMPScheduler::num_threads() const
void OMPScheduler::set_num_threads(unsigned int num_threads)
{
const unsigned int num_cores = omp_get_max_threads();
- _num_threads = num_threads == 0 ? num_cores : num_threads;
+ _num_threads = (num_threads == 0) ? num_cores : num_threads;
}
void OMPScheduler::schedule(ICPPKernel *kernel, unsigned int split_dimension)
{
ARM_COMPUTE_ERROR_ON_MSG(!kernel, "The child class didn't set the kernel");
+ ThreadInfo info;
+ info.cpu_info = _info;
+
const Window &max_window = kernel->window();
const unsigned int num_iterations = max_window.num_iterations(split_dimension);
- const unsigned int num_threads = std::min(num_iterations, _num_threads);
+ info.num_threads = std::min(num_iterations, _num_threads);
- if(!kernel->is_parallelisable() || 1 == num_threads)
+ if(!kernel->is_parallelisable() || info.num_threads == 1)
{
- kernel->run(max_window);
+ kernel->run(max_window, info);
}
else
{
- #pragma omp parallel num_threads(num_threads)
+ #pragma omp parallel num_threads(info.num_threads)
{
#pragma omp for
- for(unsigned int t = 0; t < num_threads; ++t)
+ for(int t = 0; t < info.num_threads; ++t)
{
- Window win = max_window.split_window(split_dimension, t, num_threads);
- win.set_thread_id(t);
- win.set_num_threads(num_threads);
- kernel->run(win);
+ Window win = max_window.split_window(split_dimension, t, info.num_threads);
+ info.thread_id = t;
+ kernel->run(win, info);
}
}
}