Skip to content

Commit

Permalink
enable node support (openvinotoolkit#17943)
Browse files Browse the repository at this point in the history
* enable node support on Linux

* fix code style issue

* enable node support on Windows

* fix merge conflict

* update for comments

* update for comments

* enable numa node id and socket id in proc_type_table and udpate inference unit test

* update get_streams_info_table() and smoke test cases in CPU unit test

* fix code style issue

* update numa node id and socket id in proc_type_table on windows

* update for comments

* update for comments

* update for comments
  • Loading branch information
wangleis authored Jun 20, 2023
1 parent 3519050 commit a9c4e4a
Show file tree
Hide file tree
Showing 14 changed files with 3,948 additions and 2,120 deletions.
53 changes: 29 additions & 24 deletions src/inference/dev_api/openvino/runtime/system_conf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,28 @@ OPENVINO_RUNTIME_API std::vector<std::vector<int>> get_proc_type_table();
* extend to support other CPU core type like ARM.
*
* The following are two example of processor type table.
* 1. Processor table of two socket CPUs XEON server
* 1. Processor table of 4 numa nodes and 2 socket server
*
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC
* 96 48 0 48 // Total number of two sockets
* 48 24 0 24 // Number of socket one
* 48 24 0 24 // Number of socket two
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC | PROC_NUMA_NODE_ID | PROC_SOCKET_ID
* 96 48 0 48 -1 -1
* 24 12 0 12 0 0
* 24 12 0 12 1 0
* 24 12 0 12 2 1
* 24 12 0 12 3 1
*
* 2. Processor table of one socket CPU desktop
* 2. Processor table of 1 numa node desktop
*
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC
* 32 8 16 8 // Total number of one socket
* ALL_PROC | MAIN_CORE_PROC | EFFICIENT_CORE_PROC | HYPER_THREADING_PROC | PROC_NUMA_NODE_ID | PROC_SOCKET_ID
* 32 8 16 8 -1 -1
*/
enum ColumnOfProcessorTypeTable {
ALL_PROC = 0, //!< All processors, regardless of backend cpu
MAIN_CORE_PROC = 1, //!< Processor based on physical core of Intel Performance-cores
EFFICIENT_CORE_PROC = 2, //!< Processor based on Intel Efficient-cores
HYPER_THREADING_PROC = 3, //!< Processor based on logical core of Intel Performance-cores
PROC_TYPE_TABLE_SIZE = 4 //!< Size of processor type table
PROC_NUMA_NODE_ID = 4, //!< Numa node id of processors in this row
PROC_SOCKET_ID = 5, //!< Socket id of processors in this row
PROC_TYPE_TABLE_SIZE = 6 //!< Size of processor type table
};

/**
Expand Down Expand Up @@ -229,24 +233,25 @@ OPENVINO_RUNTIME_API void set_cpu_used(const std::vector<int>& cpu_ids, const in
* 1. Four processors of two Pcore
* 2. Four processors of four Ecores shared L2 cache
*
* PROCESSOR_ID | SOCKET_ID | CORE_ID | CORE_TYPE | GROUP_ID | Used
* 0 0 0 3 0 0
* 1 0 0 1 0 0
* 2 0 1 3 1 0
* 3 0 1 1 1 0
* 4 0 2 2 2 0
* 5 0 3 2 2 0
* 6 0 4 2 2 0
* 7 0 5 2 2 0
* PROCESSOR_ID | NUMA_NODE_ID | SOCKET_ID | CORE_ID | CORE_TYPE | GROUP_ID | Used
* 0 0 0 0 3 0 0
* 1 0 0 0 1 0 0
* 2 0 0 1 3 1 0
* 3 0 0 1 1 1 0
* 4 0 0 2 2 2 0
* 5 0 0 3 2 2 0
* 6 0 0 4 2 2 0
* 7 0 0 5 2 2 0
*/
enum ColumnOfCPUMappingTable {
CPU_MAP_PROCESSOR_ID = 0, //!< column for processor id of the processor
CPU_MAP_SOCKET_ID = 1, //!< column for socket id of the processor
CPU_MAP_CORE_ID = 2, //!< column for hardware core id of the processor
CPU_MAP_CORE_TYPE = 3, //!< column for CPU core type corresponding to the processor
CPU_MAP_GROUP_ID = 4, //!< column for group id to the processor. Processors in one group have dependency.
CPU_MAP_USED_FLAG = 5, //!< column for resource management of the processor
CPU_MAP_TABLE_SIZE = 6 //!< Size of CPU mapping table
CPU_MAP_NUMA_NODE_ID = 1, //!< column for node id of the processor
CPU_MAP_SOCKET_ID = 2, //!< column for socket id of the processor
CPU_MAP_CORE_ID = 3, //!< column for hardware core id of the processor
CPU_MAP_CORE_TYPE = 4, //!< column for CPU core type corresponding to the processor
CPU_MAP_GROUP_ID = 5, //!< column for group id to the processor. Processors in one group have dependency.
CPU_MAP_USED_FLAG = 6, //!< column for resource management of the processor
CPU_MAP_TABLE_SIZE = 7 //!< Size of CPU mapping table
};

} // namespace ov
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//

/**
* @brief A header file that provides a set minimal required Streams Executor API.
* @file streams_executor.hpp
* @brief A header file that provides a set of CPU map and parser functions.
* @file cpu_map_info.hpp
*/
#pragma once

Expand All @@ -22,6 +22,7 @@ class CPU {
~CPU(){};
int _processors = 0;
int _numa_nodes = 0;
int _sockets = 0;
int _cores = 0;
std::vector<std::vector<int>> _proc_type_table;
std::vector<std::vector<int>> _cpu_mapping_table;
Expand All @@ -34,35 +35,58 @@ class CPU {
CPU& cpu_info();

#ifdef __linux__
/**
* @brief Parse nodes information to update _sockets, proc_type_table and cpu_mapping_table on Linux
* @param[in] node_info_table nodes information for this platform.
* @param[in] _numa_nodes total number for nodes in system
* @param[out] _sockets total number for sockets in system
* @param[out] _proc_type_table summary table of number of processors per type
* @param[out] _cpu_mapping_table CPU mapping table for each processor
* @return
*/
void parse_node_info_linux(const std::vector<std::string> node_info_table,
const int& _numa_nodes,
int& _sockets,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);

/**
* @brief Parse CPU cache infomation on Linux
* @param[in] _system_info_table system information for this platform.
* @param[in] system_info_table cpus information for this platform.
* @param[in] node_info_table nodes information for this platform.
* @param[out] _processors total number for processors in system.
* @param[out] _numa_nodes total number for nodes in system
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores in system
* @param[out] _proc_type_table summary table of number of processors per type
* @param[out] _cpu_mapping_table CPU mapping table for each processor
* @return
*/
void parse_cache_info_linux(const std::vector<std::vector<std::string>> _system_info_table,
void parse_cache_info_linux(const std::vector<std::vector<std::string>> system_info_table,
const std::vector<std::string> node_info_table,
int& _processors,
int& _numa_nodes,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
std::vector<std::vector<int>>& _cpu_mapping_table);

/**
* @brief Parse CPU frequency infomation on Linux
* @param[in] _system_info_table system information for this platform.
* @param[in] system_info_table cpus information for this platform.
* @param[in] node_info_table nodes information for this platform.
* @param[out] _processors total number for processors in system.
* @param[out] _numa_nodes total number for nodes in system
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores in system
* @param[out] _proc_type_table summary table of number of processors per type
* @param[out] _cpu_mapping_table CPU mapping table for each processor
* @return
*/
void parse_freq_info_linux(const std::vector<std::vector<std::string>> _system_info_table,
void parse_freq_info_linux(const std::vector<std::vector<std::string>> system_info_table,
const std::vector<std::string> node_info_table,
int& _processors,
int& _numa_nodes,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
Expand Down Expand Up @@ -106,6 +130,7 @@ void get_cpu_mapping_from_cores(const int _processors,
* @param[in] base_ptr buffer object pointer of Windows system infomation
* @param[in] len buffer object length of Windows system infomation
* @param[out] _processors total number for processors in system.
* @param[out] _numa_nodes total number for nodes in system
* @param[out] _sockets total number for sockets in system
* @param[out] _cores total number for physical CPU cores in system
* @param[out] _proc_type_table summary table of number of processors per type
Expand All @@ -115,6 +140,7 @@ void get_cpu_mapping_from_cores(const int _processors,
void parse_processor_info_win(const char* base_ptr,
const unsigned long len,
int& _processors,
int& _numa_nodes,
int& _sockets,
int& _cores,
std::vector<std::vector<int>>& _proc_type_table,
Expand Down
Loading

0 comments on commit a9c4e4a

Please sign in to comment.