21.02
|
Pool of threads to automatically split a kernel's execution among several threads. More...
#include <OMPScheduler.h>
Public Member Functions | |
OMPScheduler () | |
Constructor. More... | |
void | set_num_threads (unsigned int num_threads) override |
Sets the number of threads the scheduler will use to run the kernels. More... | |
unsigned int | num_threads () const override |
Returns the number of threads that the OMPScheduler has in its pool. More... | |
void | schedule (ICPPKernel *kernel, const Hints &hints) override |
Multithread the execution of the passed kernel if possible. More... | |
void | schedule_op (ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors) override |
Multithread the execution of the passed kernel if possible. More... | |
Public Member Functions inherited from IScheduler | |
IScheduler () | |
Default constructor. More... | |
virtual | ~IScheduler ()=default |
Destructor. More... | |
virtual void | set_num_threads_with_affinity (unsigned int num_threads, BindFunc func) |
Sets the number of threads the scheduler will use to run the kernels but also using a binding function to pin the threads to given logical cores. More... | |
virtual void | run_tagged_workloads (std::vector< Workload > &workloads, const char *tag) |
Execute all the passed workloads. More... | |
CPUInfo & | cpu_info () |
Get CPU info. More... | |
unsigned int | num_threads_hint () const |
Get a hint for the best possible number of execution threads. More... | |
Additional Inherited Members | |
Public Types inherited from IScheduler | |
enum | StrategyHint { STATIC, DYNAMIC } |
Strategies available to split a workload. More... | |
using | BindFunc = std::function< int(int, int)> |
Function to be used and map a given thread id to a logical core id. More... | |
using | Workload = std::function< void(const ThreadInfo &)> |
Signature for the workloads to execute. More... | |
Static Public Attributes inherited from IScheduler | |
static constexpr unsigned int | split_dimensions_all = std::numeric_limits<unsigned>::max() |
When arm_compute::ISchedular::Hints::_split_dimension is initialized with this value then the schedular is free to break down the problem space over as many dimensions as it wishes. More... | |
Pool of threads to automatically split a kernel's execution among several threads.
Definition at line 32 of file OMPScheduler.h.
OMPScheduler | ( | ) |
Constructor.
Definition at line 35 of file OMPScheduler.cpp.
|
overridevirtual |
Returns the number of threads that the OMPScheduler has in its pool.
Implements IScheduler.
Definition at line 40 of file OMPScheduler.cpp.
Referenced by OMPScheduler::schedule_op().
|
overridevirtual |
Multithread the execution of the passed kernel if possible.
The kernel will run on a single thread if any of these conditions is true:
[in] | kernel | Kernel to execute. |
[in] | hints | Hints for the scheduler. |
Implements IScheduler.
Definition at line 51 of file OMPScheduler.cpp.
References IKernel::window().
|
overridevirtual |
Multithread the execution of the passed kernel if possible.
The kernel will run on a single thread if any of these conditions is true:
[in] | kernel | Kernel to execute. |
[in] | hints | Hints for the scheduler. |
[in] | window | Window to use for kernel execution. |
[in] | tensors | Vector containing the tensors to operate on. |
Implements IScheduler.
Definition at line 57 of file OMPScheduler.cpp.
References ARM_COMPUTE_ERROR_ON_MSG, ThreadInfo::cpu_info, IScheduler::DYNAMIC, arm_compute::test::validation::info, IKernel::is_parallelisable(), Window::num_iterations(), OMPScheduler::num_threads(), ThreadInfo::num_threads, ICPPKernel::run_op(), IScheduler::Hints::split_dimension(), Window::split_window(), IScheduler::Hints::strategy(), tf_frozen_model_extractor::t, ThreadInfo::thread_id, and Window::validate().
|
overridevirtual |
Sets the number of threads the scheduler will use to run the kernels.
[in] | num_threads | If set to 0, then the number returned by omp_get_max_threads() will be used, otherwise the number of threads specified. |
Implements IScheduler.
Definition at line 45 of file OMPScheduler.cpp.