diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d97cea7a4..d0c8d74dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Full documentation for rocm_smi_lib is available at [https://rocm.docs.amd.com/] ***All information listed below is for reference and subject to change.*** -## rocm_smi_lib for ROCm 6.3 +## rocm_smi_lib for ROCm 6.2.1 ### Added @@ -16,7 +16,8 @@ Full documentation for rocm_smi_lib is available at [https://rocm.docs.amd.com/] ### Optimized -- N/A +- **Improved handling of UnicodeEncodeErrors with non UTF-8 locales** +Non UTF-8 locales were causing crashing on UTF-8 special characters ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b6b7c48d2..3ad742534e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,6 +343,9 @@ if(CPACK_RPM_PACKAGE_RELEASE) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) endif() +# Cpack converts !/usr/bin/env python3 to /usr/libexec/platform-python in RHEL8. +# prevent the BRP(buildroot policy) script from checking and modifying interpreter directives +set(CPACK_RPM_SPEC_MORE_DEFINE "%undefine __brp_mangle_shebangs") # The line below doesn't currently work; it may be this issue: # https://bugzilla.redhat.com/show_bug.cgi?id=1811358 diff --git a/python_smi_tools/rocm_smi.py b/python_smi_tools/rocm_smi.py index 1214c5b9ef..dd3a64cc5a 100755 --- a/python_smi_tools/rocm_smi.py +++ b/python_smi_tools/rocm_smi.py @@ -24,7 +24,24 @@ import trace from io import StringIO from time import ctime from subprocess import check_output -from rsmiBindings import * +from typing import TYPE_CHECKING + +# only used for type checking +# pyright trips up and cannot find rsmiBindings without it +if TYPE_CHECKING: + from rsmiBindings import * + +try: + from rsmiBindings import * +except ImportError: + current_path = os.path.dirname(os.path.abspath(__file__)) + additional_path = f"{current_path}/../libexec/rocm_smi" + sys.path.append(additional_path) + try: + from rsmiBindings import * + except ImportError: + print(f"Still couldn't import 'rsmiBindings'. Make sure it's installed in {additional_path}") + sys.exit(1) # rocmSmiLib_cli version. Increment this as needed. # Major version - Increment when backwards-compatibility breaks @@ -33,7 +50,7 @@ from rsmiBindings import * # Hash version - Shortened commit hash. Print here and not with lib for consistency with amd-smi SMI_MAJ = 2 SMI_MIN = 3 -SMI_PAT = 0 +SMI_PAT = 1 # SMI_HASH is provided by rsmiBindings __version__ = '%s.%s.%s+%s' % (SMI_MAJ, SMI_MIN, SMI_PAT, SMI_HASH) @@ -196,7 +213,7 @@ def getBus(device, silent=False): # BDFID = ((DOMAIN & 0xFFFFFFFF) << 32) | ((PARTITION_ID & 0xF) << 28) | ((BUS & 0xFF) << 8) | # ((DEVICE & 0x1F) <<3 ) | (FUNCTION & 0x7) # bits [63:32] = domain - # bits [31:28] or bits [2:0] = partition id + # bits [31:28] or bits [2:0] = partition id # bits [27:16] = reserved # bits [15:8] = Bus # bits [7:3] = Device @@ -223,7 +240,7 @@ def getPartitionId(device, silent=False): # BDFID = ((DOMAIN & 0xFFFFFFFF) << 32) | ((PARTITION_ID & 0xF) << 28) | ((BUS & 0xFF) << 8) | # ((DEVICE & 0x1F) <<3 ) | (FUNCTION & 0x7) # bits [63:32] = domain - # bits [31:28] or bits [2:0] = partition id + # bits [31:28] or bits [2:0] = partition id # bits [27:16] = reserved # bits [15:8] = Bus # bits [7:3] = Device