cputopology.hpp
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*--------------------------------------------------------*/
/*
@file
@author Ravi Reddy Manumachu <ravi.manumachu@ucd.ie>
@version 1.0
*/
/*-----------------------------------------------------------*/
#ifndef _HCL_CPUTOPOLOGY_HPP_
#define _HCL_CPUTOPOLOGY_HPP_
/*-----------------------------------------------------------*/
namespace hcl {
namespace topology {
/*-----------------------------------------------------------*/
/**
* Returns the sibling for a CPU.
*
* @param sibling Sibling for a CPU.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getSibling(
const unsigned int cpu,
std::vector<unsigned int>& siblings
);
/*-----------------------------------------------------------*/
/**
* Returns the total number of threads per core.
*
* @param numTPerCore The number of threads per core.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getNumThreadsPerCore(
unsigned int* numTPerCore
);
/*-----------------------------------------------------------*/
/**
* Returns the total number of logical cores.
*
* @param numLogicalCPUs The number of logical CPUs.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getNumLogicalCpus(
unsigned int* numLogicalCPUs
);
/*-----------------------------------------------------------*/
/**
* Returns the total number of physical cores.
*
* @param numPhysicalCPUs The number of physical CPUs.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getNumPhysicalCpus(
unsigned int* numPhysicalCPUs
);
/*-----------------------------------------------------------*/
/**
* Returns the number of CPUs in a NUMA node.
*
* @param numaNode The NUMA node identifier.
* @param numCPUs The number of CPUs.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getNumCpus(
const unsigned int numaNode,
unsigned int* numCPUs
);
/*-----------------------------------------------------------*/
/**
* Returns the CPUs in a NUMA node.
*
* @param numaNode The NUMA node identifier.
* @param cpus The number of CPUs.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getCpus(
const unsigned int numaNode,
std::vector<unsigned int>& cpus
);
/*-----------------------------------------------------------*/
/**
* Returns the number of CPU NUMA nodes.
*
* @param numNUMAs The number of CPU NUMA nodes.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getNumCpuNumaNodes(
unsigned int* numNUMAs
);
/*-----------------------------------------------------------*/
/**
* Returns the CPU NUMA node that has the cpu.
*
* @param cpu The cpu.
* @param numaNode The numa node containing the cpu returned.
*
* @return HCL_SUCCESS if the query is successful.
*/
int
getCpuNumaNode(
const unsigned int cpu,
unsigned int* numaNode
);
/*-----------------------------------------------------------*/
}
}
/*-----------------------------------------------------------*/
#endif /*_HCL_CPUTOPOLOGY_HPP_ */
/*-------------------------------------------------------------------------*/