You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"announcement": "This page documents AMD SMI for virtualization hosts only. See the <a href='https://rocm.docs.amd.com/projects/amdsmi/en/latest/'>AMD SMI</a> site for all other uses.",
This section is dedicated to explaining how to use the AMD System Management Interface (SMI) C library. It provides guidance on the basic setup and teardown of the library, which is essential for interacting with AMD hardware through the SMI API.
10
+
This section is dedicated to explaining how to use the AMD System Management Interface (SMI) C/C++ library. It provides guidance on the basic setup and teardown of the library, which is essential for interacting with AMD hardware through the SMI API.
11
11
12
12
The AMD SMI C library allows developers to query and control various aspects of AMD hardware, such as monitoring power usage, temperature, and performance metrics. To effectively use the library, it is important to follow the correct initialization and cleanup procedures.
AMD SMI LIB is a library that enables you to manage and monitor AMD Virtualization Enabled GPUs. It is a thread safe, extensible Cbased library. The library exposes both C and Python API interface.
10
+
AMD SMI is a library that enables you to manage and monitor AMD virtualization-enabled GPUs. It is a thread safe, extensible C-based library. The library exposes both C and Python API interfaces.
11
11
12
-
```{note}
12
+
```{important}
13
13
This is the AMD SMI for SR-IOV Linux host only. If you are looking for Linux baremetal or SR-IOV Linux guest AMD SMI, please go to the [AMD SMI documentation](https://rocm.docs.amd.com/projects/amdsmi/en/latest/index.html).
14
14
```
15
15
@@ -54,56 +54,31 @@ For additional information on build, installation, usage, versioning and API ref
54
54
55
55
:::{grid-item-card} Install
56
56
57
+
-[Install the library and CLI tool](./install/install.md)
57
58
-[Build from source](./install/build.md)
58
-
-[Library and CLI tool installation](./install/install.md)
Copy file name to clipboardExpand all lines: smi-lib/docs/install/build.md
+71-56Lines changed: 71 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,67 +7,81 @@ myst:
7
7
8
8
<aid="amd-smi-library-build"></a>
9
9
10
-
# AMD SMI LIBRARY AND TOOL BUILD
10
+
# Build the AMD SMI library (virtualization)
11
11
12
12
## Requirements
13
13
14
-
Before building the integration and unit tests, ensure that `gtest` and `gmock` are installed on your system. These libraries are required for building and running the tests. You can install them using your system's package manager or build them from source. Additionally, ensure that the `lcov` package is installed on your system before running the gen_coverage command, as it is necessary for generating code coverage reports.
14
+
Before building the integration and unit tests, ensure that `gtest` and `gmock`
15
+
are installed on your system. These libraries are required to build and
16
+
run the tests. You can install them using your system's package manager or
17
+
build them from source.
15
18
16
-
Minimum supported `lcov` version is 1.15.
19
+
Additionally, ensure that the `lcov` package is installed on your system before
20
+
running the `gen_coverage` command, as it is necessary for generating code
21
+
coverage reports. Minimum supported `lcov` version is 1.15.
17
22
18
23
## Build commands
19
24
20
25
### AMD SMI library build
21
26
22
-
When running make inside the gim folder, the AMD SMI library is built as well. Here are some useful commands for building the AMD SMI library:
27
+
Running `make` inside the `gim/` folder builds the AMD SMI library as well. Here are some useful commands for building the AMD SMI library:
28
+
29
+
- Run `make` in the `smi-lib/` folder to build the library.
23
30
24
-
- Run `make` in the smi-lib folder to build the library.
25
31
- Run `make package` to create the AMD SMI Python package.
32
+
26
33
- Run `make test` to build and run the integration and unit tests.
34
+
27
35
- Run `make all` to build everything mentioned above.
28
-
- Run `make gen_coverage` to calculate the code coverage of the AMD SMI library.
29
-
- If any changes are made to the interface folder, regenerate the Python wrapper by running `make python_wrapper` and replace the `amdsmi_wrapper.py` file in the py/interface folder with the one generated in the build folder `build/amdsmi/amdsmi_wrapper/amdsmi_wrapper.py`.
30
36
31
-
## AMD SMI LIBRARY Build Options
37
+
- Run `make gen_coverage` to calculate the code coverage of the AMD SMI
38
+
library.
39
+
40
+
- If any changes are made to the `interface/` folder, regenerate the Python
41
+
wrapper by running `make python_wrapper` and replace the `amdsmi_wrapper.py`
42
+
file in the py/interface folder with the one generated in the build folder
43
+
`build/amdsmi/amdsmi_wrapper/amdsmi_wrapper.py`.
44
+
45
+
## Build options
32
46
33
47
These options allow you to customize the build process, such as specifying the build type, enabling thread safety, enabling logging, and using the Thread Sanitizer.
34
48
35
-
- BUILD_TYPE:
49
+
-`BUILD_TYPE`
36
50
37
-
This option specifies the type of build you want to perform. Common values are Release and Debug.
38
-
Release builds are optimized for performance and do not include debugging information.
39
-
Debug builds include debugging information and are not optimized, making them suitable for development and debugging.
40
-
Default: Release
51
+
This option specifies the type of build you want to perform. Common values are `Release` and `Debug`.
52
+
Release builds are optimized for performance and do not include debugging information.
53
+
Debug builds include debugging information and are not optimized, making them suitable for development and debugging.
54
+
Default: `Release`
41
55
42
-
- THREAD_SAFE:
56
+
-`THREAD_SAFE`
43
57
44
-
This option indicates whether the build should include thread safety features.
45
-
When set to True, thread safety mechanisms (e.g., mutexes, locks) are enabled.
46
-
When set to False, thread safety mechanisms are disabled, which might improve performance but can lead to race conditions in multi-threaded environments.
47
-
Default: True
58
+
This option indicates whether the build should include thread safety features.
59
+
When set to `True`, thread safety mechanisms (for example, mutexes, locks) are enabled.
60
+
When set to `False`, thread safety mechanisms are disabled, which might improve performance but can lead to race conditions in multi-threaded environments.
61
+
Default: `True`
48
62
49
-
- LOGGING:
63
+
-`LOGGING`
50
64
51
-
This option controls whether logging is enabled in the build.
52
-
When set to True, logging code is included, which can help with debugging and monitoring.
53
-
When set to False, logging code is excluded, which might improve performance.
54
-
Default: False
65
+
This option controls whether logging is enabled in the build.
66
+
When set to `True`, logging code is included, which can help with debugging and monitoring.
67
+
When set to `False`, logging code is excluded, which might improve performance.
68
+
Default: `False`
55
69
56
-
- THREAD_SANITIZER:
70
+
-`THREAD_SANITIZER`
57
71
58
-
This option indicates whether the Thread Sanitizer should be enabled.
59
-
Thread Sanitizer is a tool that detects data races in multi-threaded programs.
60
-
When set to True, the build includes Thread Sanitizer instrumentation.
61
-
When set to False, Thread Sanitizer is not included.
62
-
Default: False
72
+
This option indicates whether the Thread Sanitizer should be enabled.
73
+
Thread Sanitizer is a tool that detects data races in multi-threaded programs.
74
+
When set to `True`, the build includes Thread Sanitizer instrumentation.
75
+
When set to `False`, Thread Sanitizer is not included.
76
+
Default: `False`
63
77
64
-
- ADDRESS_SANITIZER:
78
+
-`ADDRESS_SANITIZER`
65
79
66
-
This option indicates whether the Address Sanitizer should be enabled.
67
-
Address Sanitizer is a tool that detects memory errors such as buffer overflows, use-after-free, and memory leaks.
68
-
When set to True, the build includes Address Sanitizer instrumentation.
69
-
When set to False, Address Sanitizer is not included.
70
-
Default: False
80
+
This option indicates whether the Address Sanitizer should be enabled.
81
+
Address Sanitizer is a tool that detects memory errors such as buffer overflows, use-after-free, and memory leaks.
82
+
When set to `True`, the build includes Address Sanitizer instrumentation.
83
+
When set to `False`, Address Sanitizer is not included.
84
+
Default: `False`
71
85
72
86
## Folder structure
73
87
@@ -104,11 +118,11 @@ AMD SMI stack contains a wrapper around C SMI Library. The Python API is a one-t
104
118
105
119
### Code
106
120
107
-
The Python Wrapper source code can be found in smi-lib/py/interface folder.
121
+
The Python Wrapper source code can be found in `smi-lib/py/interface` folder.
108
122
109
123
### Build
110
124
111
-
The wrapper is built together with the SMI Library. For detailed instructions, refer to the [AMD SMI LIBRARY BUILD](#amd-smi-library-build) section.
125
+
The wrapper is built together with the AMD SMI library. For detailed instructions, refer to the [AMD SMI LIBRARY BUILD](#amd-smi-library-build) section.
112
126
113
127
### Code style
114
128
@@ -150,25 +164,26 @@ The CLI tool source code is organized in a structured hierarchy designed for mai
150
164
##### Folder Structure
151
165
152
166
```text
153
-
cli/
154
-
└── cpp/
155
-
├── cmake/ # Contains all CMake files used in the build
156
-
│ └── linux/
157
-
├── docs/
158
-
│ └── external/ # Contains documents
159
-
├── inc/ # Internal include files
160
-
├── src/ # Source files
161
-
│ ├── guest/ # Windows Guest-specific source files
162
-
│ └── host/ # Host-specific source files
163
-
└── utils/
164
-
├── scripts/ # Utility scripts
165
-
└── third_party/
166
-
└── inc/ # Third-party libraries
167
-
├── json/
168
-
└── tabulate/
167
+
smi-lib/
168
+
└── cli/
169
+
└── cpp/
170
+
├── cmake/ # Contains all CMake files used in the build
171
+
│ └── linux/
172
+
├── docs/
173
+
│ └── external/ # Contains documents
174
+
├── inc/ # Internal include files
175
+
├── src/ # Source files
176
+
│ ├── guest/ # Windows Guest-specific source files
177
+
│ └── host/ # Host-specific source files
178
+
└── utils/
179
+
├── scripts/ # Utility scripts
180
+
└── third_party/
181
+
└── inc/ # Third-party libraries
182
+
├── json/
183
+
└── tabulate/
169
184
```
170
185
171
-
##### Key Components
186
+
##### Key components
172
187
173
188
**Include files (`inc/`)**
174
189
Contains all header files that define the CLI tool's interfaces, including:
@@ -190,7 +205,7 @@ Contains all header files that define the CLI tool's interfaces, including:
190
205
-**`tabulate/`**: Table formatting library for structured output. Handles the alignment, spacing, and visual formatting of tabular data (like the monitor command output showing GPU metrics in neat columns).
191
206
192
207
193
-
#### Build Requirements
208
+
#### Build requirements
194
209
195
210
**Prerequisites**
196
211
- Modern C++ compiler (g++11)
@@ -289,4 +304,4 @@ To add new commands or features:
289
304
290
305
**NIC-related issues**
291
306
-**NIC not detected**: Verify AMD Pensando NIC drivers are installed and loaded
0 commit comments