ie_cpu_streams_executor.hpp
Go to the documentation of this file.
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @file ie_cpu_streams_executor.hpp
7  * @brief A header file for Inference Engine CPU-Streams-based Executor implementation.
8  */
9 
10 #pragma once
11 
12 #include <memory>
13 #include <string>
14 
16 
17 namespace InferenceEngine {
18 /**
19  * @class CPUStreamsExecutor
20  * @ingroup ie_dev_api_threading
21  * @brief CPU Streams executor implementation. The executor splits the CPU into groups of threads,
22  * that can be pinned to cores or NUMA nodes.
23  * It uses custom threads to pull tasks from single queue.
24  */
25 class INFERENCE_ENGINE_API_CLASS(CPUStreamsExecutor) : public IStreamsExecutor {
26 public:
27  /**
28  * @brief A shared pointer to a CPUStreamsExecutor object
29  */
30  using Ptr = std::shared_ptr<CPUStreamsExecutor>;
31 
32  /**
33  * @brief Constructor
34  * @param config Stream executor parameters
35  */
36  explicit CPUStreamsExecutor(const Config& config = {});
37 
38  /**
39  * @brief A class destructor
40  */
41  ~CPUStreamsExecutor() override;
42 
43  void run(Task task) override;
44 
45  void Execute(Task task) override;
46 
47  int GetStreamId() override;
48 
49  int GetNumaNodeId() override;
50 
51 private:
52  struct Impl;
53  std::unique_ptr<Impl> _impl;
54 };
55 
56 } // namespace InferenceEngine
CPUStreamsExecutor(const Config &config={})
Constructor.
~CPUStreamsExecutor() override
A class destructor.
int GetNumaNodeId() override
Return the id of current NUMA Node.
void Execute(Task task) override
Execute the task in the current thread using streams executor configuration and constraints.
int GetStreamId() override
Return the index of current stream.
void run(Task task) override
Execute InferenceEngine::Task inside task executor context.
std::shared_ptr< CPUStreamsExecutor > Ptr
A shared pointer to a CPUStreamsExecutor object.
Definition: ie_cpu_streams_executor.hpp:30
Interface for Streams Task Executor. This executor groups worker threads into so-called streams.
Definition: ie_istreams_executor.hpp:31
std::function< void()> Task
Inference Engine Task Executor can use any copyable callable without parameters and output as a task....
Definition: ie_itask_executor.hpp:25
A header file for Inference Engine Streams-based Executor Interface.
Inference Engine Plugin API namespace.
Defines IStreamsExecutor configuration.
Definition: ie_istreams_executor.hpp:52