pyzes 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyzes-0.1.1/LICENSE +9 -0
- pyzes-0.1.1/PKG-INFO +247 -0
- pyzes-0.1.1/README.md +223 -0
- pyzes-0.1.1/pyproject.toml +43 -0
- pyzes-0.1.1/setup.cfg +4 -0
- pyzes-0.1.1/source/examples/__init__.py +14 -0
- pyzes-0.1.1/source/examples/pyzes_black_box_test.py +1030 -0
- pyzes-0.1.1/source/examples/pyzes_example.py +752 -0
- pyzes-0.1.1/source/pyzes.egg-info/PKG-INFO +247 -0
- pyzes-0.1.1/source/pyzes.egg-info/SOURCES.txt +11 -0
- pyzes-0.1.1/source/pyzes.egg-info/dependency_links.txt +1 -0
- pyzes-0.1.1/source/pyzes.egg-info/top_level.txt +2 -0
- pyzes-0.1.1/source/pyzes.py +1033 -0
pyzes-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 Intel Corporation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
pyzes-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyzes
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Python bindings for Intel Level-Zero Driver Library (Sysman API)
|
|
5
|
+
Author-email: Intel Corporation <secure@intel.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/oneapi-src/level-zero
|
|
8
|
+
Project-URL: Documentation, https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html
|
|
9
|
+
Project-URL: Repository, https://github.com/oneapi-src/level-zero
|
|
10
|
+
Project-URL: Issues, https://github.com/oneapi-src/level-zero/issues
|
|
11
|
+
Keywords: level-zero,gpu,intel,monitoring,sysman
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: System :: Hardware
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
|
|
25
|
+
# drivers.gpu.compute.pyzes
|
|
26
|
+
pyzes
|
|
27
|
+
======
|
|
28
|
+
|
|
29
|
+
Python bindings to the Intel Level-Zero-Driver Library
|
|
30
|
+
------------------------------------------------
|
|
31
|
+
|
|
32
|
+
Provides a Python interface to GPU management and monitoring functions.
|
|
33
|
+
|
|
34
|
+
This is a wrapper around the Level-Zero-Driver library.
|
|
35
|
+
For information about the Level-Zero-Driver library, see the spec document
|
|
36
|
+
https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html
|
|
37
|
+
|
|
38
|
+
Download the latest package from: https://github.com/oneapi-src/level-zero
|
|
39
|
+
|
|
40
|
+
The level-zero header file contains function documentation that is relevant
|
|
41
|
+
to this wrapper. The header file is distributed with driver (ze_api.h and zes_api.h)
|
|
42
|
+
|
|
43
|
+
This module does not handles allocating structs before returning the desired value.
|
|
44
|
+
Non-success codes are returned and respective error is printed.
|
|
45
|
+
|
|
46
|
+
REQUIREMENTS
|
|
47
|
+
------------
|
|
48
|
+
- **Python 3.10** (required)
|
|
49
|
+
- ctypes module (included in standard Python library)
|
|
50
|
+
- Level Zero driver installed on the system
|
|
51
|
+
|
|
52
|
+
INSTALLATION
|
|
53
|
+
------------
|
|
54
|
+
```bash
|
|
55
|
+
# Ensure you have Python 3.10 installed
|
|
56
|
+
python3.10 --version
|
|
57
|
+
|
|
58
|
+
# Install the package (when available)
|
|
59
|
+
pip install pyzes
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
USAGE
|
|
63
|
+
-----
|
|
64
|
+
```
|
|
65
|
+
>>> from pyzes import *
|
|
66
|
+
>>> rc = zesInit(0)
|
|
67
|
+
>>> driver_count = c_uint32(0)
|
|
68
|
+
>>> rc = pyzes.zesDriverGet(byref(driver_count), None)
|
|
69
|
+
>>> print(f"Driver Count: {driver_count.value}")
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## C Structure and its python module class ##
|
|
74
|
+
struct zes_process_state_t {
|
|
75
|
+
|
|
76
|
+
zes_structure_type_t stype
|
|
77
|
+
[in] type of this structure
|
|
78
|
+
|
|
79
|
+
const void *pNext
|
|
80
|
+
[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
|
81
|
+
|
|
82
|
+
uint32_t processId
|
|
83
|
+
[out] Host OS process ID.
|
|
84
|
+
|
|
85
|
+
uint64_t memSize
|
|
86
|
+
[out] Device memory size in bytes allocated by this process (may not necessarily be resident on the device at the time of reading).
|
|
87
|
+
|
|
88
|
+
uint64_t sharedSize
|
|
89
|
+
[out] The size of shared device memory mapped into this process (may not necessarily be resident on the device at the time of reading).
|
|
90
|
+
|
|
91
|
+
zes_engine_type_flags_t engines
|
|
92
|
+
[out] Bitfield of accelerator engine types being used by this process.
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Python Class
|
|
96
|
+
class zes_process_state_t(Structure):
|
|
97
|
+
_fields_ = [
|
|
98
|
+
("pid", c_uint32),
|
|
99
|
+
("command", c_char * ZES_STRING_PROPERTY_SIZE),
|
|
100
|
+
("memSize", c_uint64), # in bytes
|
|
101
|
+
("sharedMemSize", c_uint64),# in bytes
|
|
102
|
+
("engineType", zes_engine_type_flags_t),
|
|
103
|
+
("subdeviceId", c_uint32),
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
FUNCTIONS
|
|
108
|
+
---------
|
|
109
|
+
Python methods wrap Level-Zero-Driver functions, implemented in a C shared library.
|
|
110
|
+
Each function's use is the same:
|
|
111
|
+
- C function output parameters are filled in with values, and return codes are returned.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
ze_result_t zesDeviceGetProperties(
|
|
115
|
+
zes_device_handle_t hDevice,
|
|
116
|
+
zes_device_properties_t* pProperties);
|
|
117
|
+
|
|
118
|
+
>>> props = zes_device_properties_t()
|
|
119
|
+
>>> props.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES
|
|
120
|
+
>>> props.pNext = None
|
|
121
|
+
>>> pyzes.zesDeviceGetProperties(devices[i], byref(props))
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- C structs are converted into Python classes.
|
|
126
|
+
```
|
|
127
|
+
// C Function and typedef struct
|
|
128
|
+
|
|
129
|
+
ze_result_t zesDeviceGetProperties(
|
|
130
|
+
zes_device_handle_t hDevice,
|
|
131
|
+
zes_device_properties_t* pProperties);
|
|
132
|
+
|
|
133
|
+
typedef struct _zes_device_properties_t
|
|
134
|
+
{
|
|
135
|
+
zes_structure_type_t stype;
|
|
136
|
+
void* pNext;
|
|
137
|
+
ze_device_properties_t core;
|
|
138
|
+
uint32_t numSubdevices;
|
|
139
|
+
char serialNumber[ZES_STRING_PROPERTY_SIZE];
|
|
140
|
+
char boardNumber[ZES_STRING_PROPERTY_SIZE];
|
|
141
|
+
char brandName[ZES_STRING_PROPERTY_SIZE];
|
|
142
|
+
char modelName[ZES_STRING_PROPERTY_SIZE];
|
|
143
|
+
char vendorName[ZES_STRING_PROPERTY_SIZE];
|
|
144
|
+
char driverVersion[ZES_STRING_PROPERTY_SIZE]
|
|
145
|
+
} zes_device_properties_t;
|
|
146
|
+
|
|
147
|
+
>>>print(f"numSubdevices: {props.numSubdevices}")
|
|
148
|
+
>>>print(f"serialNumber: {props.serialNumber}")
|
|
149
|
+
>>>print(f"boardNumber: {props.boardNumber}")
|
|
150
|
+
>>>print(f"brandName: {props.brandName}")
|
|
151
|
+
>>>print(f"modelName: {props.modelName}")
|
|
152
|
+
>>>print(f"driverVersion: {props.driverVersion}")
|
|
153
|
+
>>>print(f"coreClockMHz: {props.core.coreClockRate}")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
HOW TO USE STRUCTURE CHAINING
|
|
157
|
+
```
|
|
158
|
+
>>> props = zes_device_properties_t()
|
|
159
|
+
>>> props.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES
|
|
160
|
+
>>> ext = zes_device_ext_properties_t()
|
|
161
|
+
>>> ext.stype = ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIES
|
|
162
|
+
>>> ext.pNext = None
|
|
163
|
+
>>> base.pNext = cast(pointer(ext), c_void_p)
|
|
164
|
+
>>> pyzes.zesDeviceGetProperties(devices[i], byref(props))
|
|
165
|
+
>>> print(f"Extension properties flags: {ext.flags}")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
For more information see the Level-Zero-Driver documentation.
|
|
169
|
+
|
|
170
|
+
VARIABLES
|
|
171
|
+
---------
|
|
172
|
+
All meaningful constants and enums are exposed in Python module.
|
|
173
|
+
|
|
174
|
+
SUPPORTED APIs
|
|
175
|
+
--------------
|
|
176
|
+
|
|
177
|
+
| API Function | Module | Since Version | Limitations |
|
|
178
|
+
|--------------|--------|---------------|-------------|
|
|
179
|
+
| `zesInit` | Device | 0.1.0 | None |
|
|
180
|
+
| `zesDriverGet` | Device | 0.1.0 | None |
|
|
181
|
+
| `zesDeviceGet` | Device | 0.1.0 | None |
|
|
182
|
+
| `zesDeviceGetProperties` | Device | 0.1.0 | None |
|
|
183
|
+
| `zesDriverGetDeviceByUuidExp` | Device | 0.1.0 | Experimental API |
|
|
184
|
+
| `zesDeviceProcessesGetState` | Device | 0.1.0 | None |
|
|
185
|
+
| **Memory Management** |-|-|-|
|
|
186
|
+
| `zesDeviceEnumMemoryModules` | Memory | 0.1.0 | None |
|
|
187
|
+
| `zesMemoryGetProperties` | Memory | 0.1.0 | None |
|
|
188
|
+
| `zesMemoryGetState` | Memory | 0.1.0 | None |
|
|
189
|
+
| `zesMemoryGetBandwidth` | Memory | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
190
|
+
| **Power Management** |-|-|-|
|
|
191
|
+
| `zesDeviceEnumPowerDomains` | Power | 0.1.0 | None |
|
|
192
|
+
| `zesPowerGetEnergyCounter` | Power | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
193
|
+
| **Frequency Management** |-|-|-|
|
|
194
|
+
| `zesDeviceEnumFrequencyDomains` | Frequency | 0.1.0 | None |
|
|
195
|
+
| `zesFrequencyGetState` | Frequency | 0.1.0 | None |
|
|
196
|
+
| **Temperature Monitoring** |-|-|-|
|
|
197
|
+
| `zesDeviceEnumTemperatureSensors` | Temperature | 0.1.0 | None |
|
|
198
|
+
| `zesTemperatureGetProperties` | Temperature | 0.1.0 | None |
|
|
199
|
+
| `zesTemperatureGetConfig` | Temperature | 0.1.0 | None |
|
|
200
|
+
| `zesTemperatureGetState` | Temperature | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
201
|
+
| **Engine Management** |-|-|-|
|
|
202
|
+
| `zesDeviceEnumEngineGroups` | Engine | 0.1.0 | Linux: Shows "no handles found" error when not in superuser mode |
|
|
203
|
+
| `zesEngineGetProperties` | Engine | 0.1.0 | None |
|
|
204
|
+
| `zesEngineGetActivity` | Engine | 0.1.0 | None |
|
|
205
|
+
|
|
206
|
+
RELEASE NOTES
|
|
207
|
+
-------------
|
|
208
|
+
Version 0.1.1
|
|
209
|
+
- Minor fixes: Removed unnecessary debug print statements
|
|
210
|
+
|
|
211
|
+
Version 0.1.0 (Initial Release)
|
|
212
|
+
- Initial release of pyzes Python bindings for Intel Level-Zero Driver Library
|
|
213
|
+
- Added pyzes.py module with Python binding wrapper functions
|
|
214
|
+
- Added pyzes_example.py and pyzes_black_box_test.py as sample applications
|
|
215
|
+
- Supported API modules:
|
|
216
|
+
- Device Management APIs
|
|
217
|
+
- Memory Management APIs
|
|
218
|
+
- Power Management APIs
|
|
219
|
+
- Frequency Management APIs
|
|
220
|
+
- Temperature Monitoring APIs
|
|
221
|
+
- Engine Management APIs
|
|
222
|
+
|
|
223
|
+
Notes:
|
|
224
|
+
Linux:
|
|
225
|
+
zesPowerGetEnergyCounter
|
|
226
|
+
zesTemperatureGetState
|
|
227
|
+
zesMemoryGetBandwidth
|
|
228
|
+
|
|
229
|
+
The above APIs needs user to be in superuser/root mode or have read permissions for telem nodes
|
|
230
|
+
Telem Node Directory: /sys/class/intel_pmt/telem(1/2/3/4)/telem
|
|
231
|
+
|
|
232
|
+
zesDeviceEnumEngineGroups shows no handles found error when not in super user mode.
|
|
233
|
+
|
|
234
|
+
# Contributing
|
|
235
|
+
|
|
236
|
+
See [CONTRIBUTING](CONTRIBUTING.md) for more information.
|
|
237
|
+
|
|
238
|
+
# License
|
|
239
|
+
|
|
240
|
+
Distributed under the MIT license. See [LICENSE](LICENSE) for more information.
|
|
241
|
+
|
|
242
|
+
# Security
|
|
243
|
+
|
|
244
|
+
See Intel's [Security Center](https://www.intel.com/content/www/us/en/security-center/default.html) for information on how to report a potential security issue or vulnerability.
|
|
245
|
+
|
|
246
|
+
See also [SECURITY](SECURITY.md).
|
|
247
|
+
|
pyzes-0.1.1/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# drivers.gpu.compute.pyzes
|
|
2
|
+
pyzes
|
|
3
|
+
======
|
|
4
|
+
|
|
5
|
+
Python bindings to the Intel Level-Zero-Driver Library
|
|
6
|
+
------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Provides a Python interface to GPU management and monitoring functions.
|
|
9
|
+
|
|
10
|
+
This is a wrapper around the Level-Zero-Driver library.
|
|
11
|
+
For information about the Level-Zero-Driver library, see the spec document
|
|
12
|
+
https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html
|
|
13
|
+
|
|
14
|
+
Download the latest package from: https://github.com/oneapi-src/level-zero
|
|
15
|
+
|
|
16
|
+
The level-zero header file contains function documentation that is relevant
|
|
17
|
+
to this wrapper. The header file is distributed with driver (ze_api.h and zes_api.h)
|
|
18
|
+
|
|
19
|
+
This module does not handles allocating structs before returning the desired value.
|
|
20
|
+
Non-success codes are returned and respective error is printed.
|
|
21
|
+
|
|
22
|
+
REQUIREMENTS
|
|
23
|
+
------------
|
|
24
|
+
- **Python 3.10** (required)
|
|
25
|
+
- ctypes module (included in standard Python library)
|
|
26
|
+
- Level Zero driver installed on the system
|
|
27
|
+
|
|
28
|
+
INSTALLATION
|
|
29
|
+
------------
|
|
30
|
+
```bash
|
|
31
|
+
# Ensure you have Python 3.10 installed
|
|
32
|
+
python3.10 --version
|
|
33
|
+
|
|
34
|
+
# Install the package (when available)
|
|
35
|
+
pip install pyzes
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
USAGE
|
|
39
|
+
-----
|
|
40
|
+
```
|
|
41
|
+
>>> from pyzes import *
|
|
42
|
+
>>> rc = zesInit(0)
|
|
43
|
+
>>> driver_count = c_uint32(0)
|
|
44
|
+
>>> rc = pyzes.zesDriverGet(byref(driver_count), None)
|
|
45
|
+
>>> print(f"Driver Count: {driver_count.value}")
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## C Structure and its python module class ##
|
|
50
|
+
struct zes_process_state_t {
|
|
51
|
+
|
|
52
|
+
zes_structure_type_t stype
|
|
53
|
+
[in] type of this structure
|
|
54
|
+
|
|
55
|
+
const void *pNext
|
|
56
|
+
[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext).
|
|
57
|
+
|
|
58
|
+
uint32_t processId
|
|
59
|
+
[out] Host OS process ID.
|
|
60
|
+
|
|
61
|
+
uint64_t memSize
|
|
62
|
+
[out] Device memory size in bytes allocated by this process (may not necessarily be resident on the device at the time of reading).
|
|
63
|
+
|
|
64
|
+
uint64_t sharedSize
|
|
65
|
+
[out] The size of shared device memory mapped into this process (may not necessarily be resident on the device at the time of reading).
|
|
66
|
+
|
|
67
|
+
zes_engine_type_flags_t engines
|
|
68
|
+
[out] Bitfield of accelerator engine types being used by this process.
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Python Class
|
|
72
|
+
class zes_process_state_t(Structure):
|
|
73
|
+
_fields_ = [
|
|
74
|
+
("pid", c_uint32),
|
|
75
|
+
("command", c_char * ZES_STRING_PROPERTY_SIZE),
|
|
76
|
+
("memSize", c_uint64), # in bytes
|
|
77
|
+
("sharedMemSize", c_uint64),# in bytes
|
|
78
|
+
("engineType", zes_engine_type_flags_t),
|
|
79
|
+
("subdeviceId", c_uint32),
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
FUNCTIONS
|
|
84
|
+
---------
|
|
85
|
+
Python methods wrap Level-Zero-Driver functions, implemented in a C shared library.
|
|
86
|
+
Each function's use is the same:
|
|
87
|
+
- C function output parameters are filled in with values, and return codes are returned.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
ze_result_t zesDeviceGetProperties(
|
|
91
|
+
zes_device_handle_t hDevice,
|
|
92
|
+
zes_device_properties_t* pProperties);
|
|
93
|
+
|
|
94
|
+
>>> props = zes_device_properties_t()
|
|
95
|
+
>>> props.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES
|
|
96
|
+
>>> props.pNext = None
|
|
97
|
+
>>> pyzes.zesDeviceGetProperties(devices[i], byref(props))
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- C structs are converted into Python classes.
|
|
102
|
+
```
|
|
103
|
+
// C Function and typedef struct
|
|
104
|
+
|
|
105
|
+
ze_result_t zesDeviceGetProperties(
|
|
106
|
+
zes_device_handle_t hDevice,
|
|
107
|
+
zes_device_properties_t* pProperties);
|
|
108
|
+
|
|
109
|
+
typedef struct _zes_device_properties_t
|
|
110
|
+
{
|
|
111
|
+
zes_structure_type_t stype;
|
|
112
|
+
void* pNext;
|
|
113
|
+
ze_device_properties_t core;
|
|
114
|
+
uint32_t numSubdevices;
|
|
115
|
+
char serialNumber[ZES_STRING_PROPERTY_SIZE];
|
|
116
|
+
char boardNumber[ZES_STRING_PROPERTY_SIZE];
|
|
117
|
+
char brandName[ZES_STRING_PROPERTY_SIZE];
|
|
118
|
+
char modelName[ZES_STRING_PROPERTY_SIZE];
|
|
119
|
+
char vendorName[ZES_STRING_PROPERTY_SIZE];
|
|
120
|
+
char driverVersion[ZES_STRING_PROPERTY_SIZE]
|
|
121
|
+
} zes_device_properties_t;
|
|
122
|
+
|
|
123
|
+
>>>print(f"numSubdevices: {props.numSubdevices}")
|
|
124
|
+
>>>print(f"serialNumber: {props.serialNumber}")
|
|
125
|
+
>>>print(f"boardNumber: {props.boardNumber}")
|
|
126
|
+
>>>print(f"brandName: {props.brandName}")
|
|
127
|
+
>>>print(f"modelName: {props.modelName}")
|
|
128
|
+
>>>print(f"driverVersion: {props.driverVersion}")
|
|
129
|
+
>>>print(f"coreClockMHz: {props.core.coreClockRate}")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
HOW TO USE STRUCTURE CHAINING
|
|
133
|
+
```
|
|
134
|
+
>>> props = zes_device_properties_t()
|
|
135
|
+
>>> props.stype = ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES
|
|
136
|
+
>>> ext = zes_device_ext_properties_t()
|
|
137
|
+
>>> ext.stype = ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIES
|
|
138
|
+
>>> ext.pNext = None
|
|
139
|
+
>>> base.pNext = cast(pointer(ext), c_void_p)
|
|
140
|
+
>>> pyzes.zesDeviceGetProperties(devices[i], byref(props))
|
|
141
|
+
>>> print(f"Extension properties flags: {ext.flags}")
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For more information see the Level-Zero-Driver documentation.
|
|
145
|
+
|
|
146
|
+
VARIABLES
|
|
147
|
+
---------
|
|
148
|
+
All meaningful constants and enums are exposed in Python module.
|
|
149
|
+
|
|
150
|
+
SUPPORTED APIs
|
|
151
|
+
--------------
|
|
152
|
+
|
|
153
|
+
| API Function | Module | Since Version | Limitations |
|
|
154
|
+
|--------------|--------|---------------|-------------|
|
|
155
|
+
| `zesInit` | Device | 0.1.0 | None |
|
|
156
|
+
| `zesDriverGet` | Device | 0.1.0 | None |
|
|
157
|
+
| `zesDeviceGet` | Device | 0.1.0 | None |
|
|
158
|
+
| `zesDeviceGetProperties` | Device | 0.1.0 | None |
|
|
159
|
+
| `zesDriverGetDeviceByUuidExp` | Device | 0.1.0 | Experimental API |
|
|
160
|
+
| `zesDeviceProcessesGetState` | Device | 0.1.0 | None |
|
|
161
|
+
| **Memory Management** |-|-|-|
|
|
162
|
+
| `zesDeviceEnumMemoryModules` | Memory | 0.1.0 | None |
|
|
163
|
+
| `zesMemoryGetProperties` | Memory | 0.1.0 | None |
|
|
164
|
+
| `zesMemoryGetState` | Memory | 0.1.0 | None |
|
|
165
|
+
| `zesMemoryGetBandwidth` | Memory | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
166
|
+
| **Power Management** |-|-|-|
|
|
167
|
+
| `zesDeviceEnumPowerDomains` | Power | 0.1.0 | None |
|
|
168
|
+
| `zesPowerGetEnergyCounter` | Power | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
169
|
+
| **Frequency Management** |-|-|-|
|
|
170
|
+
| `zesDeviceEnumFrequencyDomains` | Frequency | 0.1.0 | None |
|
|
171
|
+
| `zesFrequencyGetState` | Frequency | 0.1.0 | None |
|
|
172
|
+
| **Temperature Monitoring** |-|-|-|
|
|
173
|
+
| `zesDeviceEnumTemperatureSensors` | Temperature | 0.1.0 | None |
|
|
174
|
+
| `zesTemperatureGetProperties` | Temperature | 0.1.0 | None |
|
|
175
|
+
| `zesTemperatureGetConfig` | Temperature | 0.1.0 | None |
|
|
176
|
+
| `zesTemperatureGetState` | Temperature | 0.1.0 | Linux: Requires superuser or read permissions for telem nodes |
|
|
177
|
+
| **Engine Management** |-|-|-|
|
|
178
|
+
| `zesDeviceEnumEngineGroups` | Engine | 0.1.0 | Linux: Shows "no handles found" error when not in superuser mode |
|
|
179
|
+
| `zesEngineGetProperties` | Engine | 0.1.0 | None |
|
|
180
|
+
| `zesEngineGetActivity` | Engine | 0.1.0 | None |
|
|
181
|
+
|
|
182
|
+
RELEASE NOTES
|
|
183
|
+
-------------
|
|
184
|
+
Version 0.1.1
|
|
185
|
+
- Minor fixes: Removed unnecessary debug print statements
|
|
186
|
+
|
|
187
|
+
Version 0.1.0 (Initial Release)
|
|
188
|
+
- Initial release of pyzes Python bindings for Intel Level-Zero Driver Library
|
|
189
|
+
- Added pyzes.py module with Python binding wrapper functions
|
|
190
|
+
- Added pyzes_example.py and pyzes_black_box_test.py as sample applications
|
|
191
|
+
- Supported API modules:
|
|
192
|
+
- Device Management APIs
|
|
193
|
+
- Memory Management APIs
|
|
194
|
+
- Power Management APIs
|
|
195
|
+
- Frequency Management APIs
|
|
196
|
+
- Temperature Monitoring APIs
|
|
197
|
+
- Engine Management APIs
|
|
198
|
+
|
|
199
|
+
Notes:
|
|
200
|
+
Linux:
|
|
201
|
+
zesPowerGetEnergyCounter
|
|
202
|
+
zesTemperatureGetState
|
|
203
|
+
zesMemoryGetBandwidth
|
|
204
|
+
|
|
205
|
+
The above APIs needs user to be in superuser/root mode or have read permissions for telem nodes
|
|
206
|
+
Telem Node Directory: /sys/class/intel_pmt/telem(1/2/3/4)/telem
|
|
207
|
+
|
|
208
|
+
zesDeviceEnumEngineGroups shows no handles found error when not in super user mode.
|
|
209
|
+
|
|
210
|
+
# Contributing
|
|
211
|
+
|
|
212
|
+
See [CONTRIBUTING](CONTRIBUTING.md) for more information.
|
|
213
|
+
|
|
214
|
+
# License
|
|
215
|
+
|
|
216
|
+
Distributed under the MIT license. See [LICENSE](LICENSE) for more information.
|
|
217
|
+
|
|
218
|
+
# Security
|
|
219
|
+
|
|
220
|
+
See Intel's [Security Center](https://www.intel.com/content/www/us/en/security-center/default.html) for information on how to report a potential security issue or vulnerability.
|
|
221
|
+
|
|
222
|
+
See also [SECURITY](SECURITY.md).
|
|
223
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyzes"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Python bindings for Intel Level-Zero Driver Library (Sysman API)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Intel Corporation", email = "secure@intel.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["level-zero", "gpu", "intel", "monitoring", "sysman"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Operating System :: POSIX :: Linux",
|
|
23
|
+
"Operating System :: Microsoft :: Windows",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
"Topic :: System :: Hardware",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/oneapi-src/level-zero"
|
|
30
|
+
Documentation = "https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html"
|
|
31
|
+
Repository = "https://github.com/oneapi-src/level-zero"
|
|
32
|
+
Issues = "https://github.com/oneapi-src/level-zero/issues"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
package-dir = {"" = "source"}
|
|
36
|
+
py-modules = ["pyzes"]
|
|
37
|
+
packages = ["examples"]
|
|
38
|
+
|
|
39
|
+
[tool.coverage.run]
|
|
40
|
+
omit = [
|
|
41
|
+
"source/examples/*",
|
|
42
|
+
"test/*",
|
|
43
|
+
]
|
pyzes-0.1.1/setup.cfg
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
##
|
|
2
|
+
# Copyright (C) 2026 Intel Corporation
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
#
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Example scripts demonstrating pyzes usage.
|
|
10
|
+
|
|
11
|
+
These examples show how to use the pyzes module for Intel Level-Zero System Management.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0"
|