Skip to content

Commit 0dbe490

Browse files
committed
wip
wip
1 parent d7b07fd commit 0dbe490

15 files changed

Lines changed: 178 additions & 173 deletions

File tree

smi-lib/docs/about/license.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description lang=en": "AMD SMI (virtualization) license agreement"
5+
"keywords": "amdsmi, amd, smi, virt, virtualization, gpu, sriov, linux, host, license, legal, mit"
6+
---
7+
8+
# License
9+
10+
```{include} ../../LICENSE
11+
```
File renamed without changes.

smi-lib/docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_version_info(filepath):
5656
version_number = "{}.{}.{}".format(version_major, version_minor, version_release)
5757

5858
# project info
59-
project = "AMD SMI (virtualization)"
59+
project = "AMD SMI for Virtualization"
6060
author = "Advanced Micro Devices, Inc."
6161
copyright = "Copyright (c) %Y Advanced Micro Devices, Inc. All rights reserved."
6262
version = version_number
@@ -70,23 +70,23 @@ def get_version_info(filepath):
7070
"link_main_doc": True,
7171
"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.",
7272
"nav_secondary_items": {
73+
"GitHub": "https://github.com/amd/MxGPU-Virtualization/tree/staging/smi-lib",
7374
"Community": "https://github.com/ROCm/ROCm/discussions",
7475
"Blogs": "https://rocm.blogs.amd.com/",
7576
"ROCm&#8482 Docs": "https://rocm.docs.amd.com",
7677
"ROCm Developer Hub": "https://www.amd.com/en/developer/resources/rocm-hub.html",
7778
},
7879
"show_toc_level": 4
7980
}
80-
html_title = "AMD SMI {} documentation".format(version_number)
81+
html_title = f"AMD SMI for Virtualization {version_number}"
8182
suppress_warnings = ["etoc.toctree"]
8283
external_toc_path = "./sphinx/_toc.yml"
8384

8485
external_projects_current_project = "amdsmi-virt"
8586
extensions = ["rocm_docs", "rocm_docs.doxygen"]
8687

8788
doxygen_root = "doxygen"
88-
doxysphinx_enabled = True
8989
doxygen_project = {
90-
"name": "AMD SMI C API reference",
90+
"name": "AMD SMI C/C++ API reference",
9191
"path": "doxygen/doxy_build/xml",
9292
}

smi-lib/docs/doxygen/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ IGNORE_PREFIX =
12631263
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
12641264
# The default value is: YES.
12651265

1266-
GENERATE_HTML = YES
1266+
GENERATE_HTML = NO
12671267

12681268
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
12691269
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of

smi-lib/docs/how_to/amdsmi_c_lib.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
myst:
33
html_meta:
44
"description lang=en": "Get started with the AMD SMI C library. Basic usage and examples."
5-
"keywords": "api, smi, lib, c, system, management, interface"
5+
"keywords": "api, smi, lib, c, system, management, interface, cpp"
66
---
77

8-
# AMD SMI C library usage and examples
8+
# AMD SMI C/C++ library usage and examples
99

10-
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.
1111

1212
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.
1313

smi-lib/docs/index.md

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
myst:
33
html_meta:
44
"description lang=en": "AMD SMI documentation and API reference."
5-
"keywords": "amdsmi, lib, cli, system, management, interface, admin, sys"
5+
"keywords": "amdsmi, lib, cli, system, management, interface, admin, sys, virtualization, virt"
66
---
77

8-
# AMD SMI documentation
8+
# AMD SMI for virtualization
99

10-
AMD SMI LIB 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 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.
1111

12-
```{note}
12+
```{important}
1313
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).
1414
```
1515

@@ -54,56 +54,31 @@ For additional information on build, installation, usage, versioning and API ref
5454

5555
:::{grid-item-card} Install
5656

57+
- [Install the library and CLI tool](./install/install.md)
5758
- [Build from source](./install/build.md)
58-
- [Library and CLI tool installation](./install/install.md)
5959
:::
6060

6161
:::{grid-item-card} How to
6262

63-
- [C library usage](./how_to/amdsmi_c_lib.md)
64-
- [Python library usage](./how_to/amdsmi_py_lib.md)
65-
- [CLI tool usage](./how_to/amdsmi_cli_usage.md)
63+
- [Use the C/C++ library](./how_to/amdsmi_c_lib.md)
64+
- [Use the Python library](./how_to/amdsmi_py_lib.md)
65+
- [Use the CLI tool](./how_to/amdsmi_cli_usage.md)
6666
:::
6767

6868
:::{grid-item-card} Reference
6969

70-
- [C API](./reference/amdsmi_c_api.md)
70+
- [C/C++ API](./reference/amdsmi_c_api.md)
7171
- [Files](../doxygen/doxy_build/html/files)
7272
- [Globals](../doxygen/doxy_build/html/globals)
7373
- [Data structures](../doxygen/doxy_build/html/annotated)
7474
- [Data fields](../doxygen/doxy_build/html/functions_data_fields)
7575
- [Python API](./reference/amdsmi_py_api.md)
7676
:::
7777

78-
:::{grid-item-card} General
78+
:::{grid-item-card} About
7979

80-
- [Library and CLI tool versioning](./general/versioning.md)
80+
- [Versioning](./about/versioning.md)
81+
- [License](./about/license.md)
8182
:::
8283

8384
::::
84-
85-
<style>
86-
#disclaimer {
87-
font-size: 0.8rem;
88-
}
89-
</style>
90-
91-
<div id="disclaimer">
92-
The information contained herein is for informational purposes only, and is
93-
subject to change without notice. While every precaution has been taken in the
94-
preparation of this document, it may contain technical inaccuracies, omissions
95-
and typographical errors, and AMD is under no obligation to update or otherwise
96-
correct this information. Advanced Micro Devices, Inc. makes no representations
97-
or warranties with respect to the accuracy or completeness of the contents of
98-
this document, and assumes no liability of any kind, including the implied
99-
warranties of noninfringement, merchantability or fitness for particular
100-
purposes, with respect to the operation or use of AMD hardware, software or
101-
other products described herein.
102-
103-
AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced
104-
Micro Devices, Inc. Other product names used in this publication are for
105-
identification purposes only and may be trademarks of their respective
106-
companies.
107-
108-
Copyright &copy; 2025 Advanced Micro Devices, Inc. All rights reserved.
109-
</div>

smi-lib/docs/install/build.md

Lines changed: 71 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,81 @@ myst:
77

88
<a id="amd-smi-library-build"></a>
99

10-
# AMD SMI LIBRARY AND TOOL BUILD
10+
# Build the AMD SMI library (virtualization)
1111

1212
## Requirements
1313

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.
1518

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.
1722

1823
## Build commands
1924

2025
### AMD SMI library build
2126

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.
2330

24-
- Run `make` in the smi-lib folder to build the library.
2531
- Run `make package` to create the AMD SMI Python package.
32+
2633
- Run `make test` to build and run the integration and unit tests.
34+
2735
- 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`.
3036

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
3246

3347
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.
3448

35-
- BUILD_TYPE:
49+
- `BUILD_TYPE`
3650

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`
4155

42-
- THREAD_SAFE:
56+
- `THREAD_SAFE`
4357

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`
4862

49-
- LOGGING:
63+
- `LOGGING`
5064

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`
5569

56-
- THREAD_SANITIZER:
70+
- `THREAD_SANITIZER`
5771

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`
6377

64-
- ADDRESS_SANITIZER:
78+
- `ADDRESS_SANITIZER`
6579

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`
7185

7286
## Folder structure
7387

@@ -104,11 +118,11 @@ AMD SMI stack contains a wrapper around C SMI Library. The Python API is a one-t
104118

105119
### Code
106120

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.
108122

109123
### Build
110124

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.
112126

113127
### Code style
114128

@@ -150,25 +164,26 @@ The CLI tool source code is organized in a structured hierarchy designed for mai
150164
##### Folder Structure
151165

152166
```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/
169184
```
170185

171-
##### Key Components
186+
##### Key components
172187

173188
**Include files (`inc/`)**
174189
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:
190205
- **`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).
191206

192207

193-
#### Build Requirements
208+
#### Build requirements
194209

195210
**Prerequisites**
196211
- Modern C++ compiler (g++11)
@@ -289,4 +304,4 @@ To add new commands or features:
289304

290305
**NIC-related issues**
291306
- **NIC not detected**: Verify AMD Pensando NIC drivers are installed and loaded
292-
- **Network permission errors**: Ensure proper network device access permissions
307+
- **Network permission errors**: Ensure proper network device access permissions

0 commit comments

Comments
 (0)