From 06e890b1475243145d64c7d56dfb4a262a17b09f Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 9 Jul 2020 18:38:34 +0100 Subject: COMPMID-3565: Exposes interface to enable thread binding Expose `set_num_threads_with_affinity` as an interface to the `IScheduler` to allow binding of threads to given logical cores. Signed-off-by: Georgios Pinitas Change-Id: I062db7caafb0101972ba45d31ee9e61b26800127 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3481 Comments-Addressed: Arm Jenkins Reviewed-by: Michalis Spyrou Tested-by: Arm Jenkins --- arm_compute/runtime/CPP/CPPScheduler.h | 35 +++++----------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'arm_compute/runtime/CPP/CPPScheduler.h') diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h index 855535ebce..9d55ed448e 100644 --- a/arm_compute/runtime/CPP/CPPScheduler.h +++ b/arm_compute/runtime/CPP/CPPScheduler.h @@ -39,16 +39,6 @@ public: CPPScheduler(); /** Default destructor */ ~CPPScheduler(); - /** Sets the number of threads the scheduler will use to run the kernels. - * - * @param[in] num_threads If set to 0, then the maximum number of threads supported by C++11 will be used, otherwise the number of threads specified. - */ - void set_num_threads(unsigned int num_threads) override; - /** Returns the number of threads that the CPPScheduler has in his pool. - * - * @return Number of threads available in CPPScheduler. - */ - unsigned int num_threads() const override; /** Access the scheduler singleton * @@ -56,27 +46,12 @@ public: * @return The scheduler */ static CPPScheduler &get(); - /** Multithread the execution of the passed kernel if possible. - * - * The kernel will run on a single thread if any of these conditions is true: - * - ICPPKernel::is_parallelisable() returns false - * - The scheduler has been initialized with only one thread. - * - * @param[in] kernel Kernel to execute. - * @param[in] hints Hints for the scheduler. - */ + + // Inherited functions overridden + void set_num_threads(unsigned int num_threads) override; + void set_num_threads_with_affinity(unsigned int num_threads, BindFunc func) override; + unsigned int num_threads() const override; void schedule(ICPPKernel *kernel, const Hints &hints) override; - /** Multithread the execution of the passed kernel if possible. - * - * The kernel will run on a single thread if any of these conditions is true: - * - ICPPKernel::is_parallelisable() returns false - * - The scheduler has been initialized with only one thread. - * - * @param[in] kernel Kernel to execute. - * @param[in] hints Hints for the scheduler. - * @param[in] inputs Vector that contains the input tensors. - * @param[in] outputs Vector that contains the output tensors. - */ void schedule_op(ICPPKernel *kernel, const Hints &hints, const InputTensorMap &inputs, const OutputTensorMap &outputs) override; protected: -- cgit v1.2.1