AMD-SMI-CLI - Packaging updates

Added fallback in amdsmi_init.py to access /opt/rocm/share/amd_smi
        if python package is not installed
    Made libamd_smi.so detection more reliable
    Added PyYaml dependency to pyproject.toml
    Added python3-clang dependency in CMakeLists
    Updated python3 version dependency in CMakeLists
    Update Readme
    Added Release Notes

Change-Id: Ie3b85fde7563dd84dce499f229aac1f94bcc2989
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
Maisam Arif
2023-05-18 16:00:45 -05:00
parent 2f18ec7539
commit da50f4f078
7 changed files with 89 additions and 26 deletions
+5 -5
View File
@@ -106,17 +106,17 @@ def main():
library_path = os.path.join(os.path.dirname(__file__), library)
line_to_replace = "_libraries['{}'] = ctypes.CDLL('{}')".format(library_name, library_path)
new_line = f"""from pathlib import Path
libamd_smi_optrocm = Path(__file__).parents[3] / "/lib/{library_name}"
libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/{library_name}")
libamd_smi_optrocm = Path("/opt/rocm/lib/{library_name}")
libamd_smi_parent_dir = Path(__file__).resolve().parent / "{library_name}"
libamd_smi_cwd = Path.cwd() / "{library_name}"
if libamd_smi_optrocm.is_file():
# try /opt/rocm/lib as a fallback
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm)
elif libamd_smi_cpack.is_file():
if libamd_smi_cpack.is_file():
# try to find library in install directory provided by CMake
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_cpack)
elif libamd_smi_optrocm.is_file():
# try /opt/rocm/lib as a fallback
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm)
elif libamd_smi_parent_dir.is_file():
# try to fall back to parent directory
_libraries['{library_name}'] = ctypes.CDLL(libamd_smi_parent_dir)