namespace ov::threading

Overview

namespace threading {

// typedefs

typedef std::function<void()> Task;
typedef tbb::enumerable_thread_specific<T> ThreadLocal;
typedef tbb::concurrent_queue<T> ThreadSafeQueue;
typedef tbb::concurrent_bounded_queue<T> ThreadSafeBoundedQueue;

// enums

enum StreamCreateType;

// templates

template ExecutorManager;
template IStreamsExecutor;
template ITaskExecutor;

// classes

class CPUStreamsExecutor;
class ImmediateExecutor;
template <typename T>
class ThreadSafeBoundedPriorityQueue;
template <typename T>
class ThreadSafeQueueWithSize;

// global functions

void get_cur_stream_info(
    const int stream_id,
    const bool cpu_reservation,
    const std::vector<std::vector<int>> org_proc_type_table,
    const std::vector<std::vector<int>> streams_info_table,
    StreamCreateType& stream_type,
    int& concurrency,
    int& core_type,
    int& numa_node_id,
    int& max_threads_per_core
    );

void reserve_cpu_by_streams_info(
    const std::vector<std::vector<int>> _streams_info_table,
    const int _numa_nodes,
    std::vector<std::vector<int>>& _cpu_mapping_table,
    std::vector<std::vector<int>>& _proc_type_table,
    std::vector<std::vector<int>>& _stream_processors,
    const int _cpu_status
    );

void update_proc_type_table(
    const std::vector<std::vector<int>> _cpu_mapping_table,
    const int _numa_nodes,
    std::vector<std::vector<int>>& _proc_type_table
    );

OPENVINO_API std::shared_ptr<ExecutorManager> executor_manager();

} // namespace threading

Detailed Documentation

Global Functions

void get_cur_stream_info(
    const int stream_id,
    const bool cpu_reservation,
    const std::vector<std::vector<int>> org_proc_type_table,
    const std::vector<std::vector<int>> streams_info_table,
    StreamCreateType& stream_type,
    int& concurrency,
    int& core_type,
    int& numa_node_id,
    int& max_threads_per_core
    )

Get current stream information.

Parameters:

stream_id

stream id

cpu_reservation

cpu reservation

org_proc_type_table

available processors in the platform

streams_info_table

streams information table

stream_type

stream create type

concurrency

the number of threads created at the same time

core_type

core type

numa_node_id

numa node id

max_threads_per_core

the max number of threads per cpu core

void reserve_cpu_by_streams_info(
    const std::vector<std::vector<int>> _streams_info_table,
    const int _numa_nodes,
    std::vector<std::vector<int>>& _cpu_mapping_table,
    std::vector<std::vector<int>>& _proc_type_table,
    std::vector<std::vector<int>>& _stream_processors,
    const int _cpu_status
    )

Reserve cpu resource by streams info.

Parameters:

_streams_info_table

streams info table

_numa_nodes

number of numa nodes

_cpu_mapping_table

CPU mapping table for each processor

_proc_type_table

summary table of number of processors per type

_stream_processors

processors grouped in stream which is used in core binding in cpu streams executor

_cpu_status

set cpu status

Returns:

void update_proc_type_table(
    const std::vector<std::vector<int>> _cpu_mapping_table,
    const int _numa_nodes,
    std::vector<std::vector<int>>& _proc_type_table
    )

Update proc_type_table.

Parameters:

_cpu_mapping_table

CPU mapping table for each processor

_numa_nodes

total number for nodes in system

_proc_type_table

summary table of number of processors per type

Returns: