[RDHC] Update rocm-core package scripts to include rdhc script (#1482)
* Add rdhc script in to rocm-core package
* Create the rdhc symlink within the package itself.
* rdhc tool support is not enabled for windows.
* [RDHC] Check if the required pip pkgs are present and warn .
rdhc checks the required pip packages are present or not.
if not warns the user and exits gracefully.
Signed-off-by: Saravanan Solaiyappan <saravanan.solaiyappan@amd.com>
此提交包含在:
2 file changed
+104
-3
No files matched your search
@@ -126,6 +126,32 @@ if(BUILD_SHARED_LIBS)
|
|||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
COMPONENT CORE_RUNTIME )
|
COMPONENT CORE_RUNTIME )
|
||||||
|
|
||||||
|
if( NOT WIN32 )
|
||||||
|
# rdhc tool is developed and tested for Linux based systems only.
|
||||||
|
# rdhc tool is not supported on Windows.
|
||||||
|
# Install rdhc files
|
||||||
|
install ( FILES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/rdhc/README.md
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/rdhc/requirements.txt
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rdhc
|
||||||
|
COMPONENT CORE_RUNTIME)
|
||||||
|
|
||||||
|
install ( PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/rdhc/rdhc.py
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${CORE_TARGET}
|
||||||
|
COMPONENT CORE_RUNTIME )
|
||||||
|
|
||||||
|
# Create symlink for rdhc in bin directory
|
||||||
|
add_custom_target ( rdhc_symlink ALL
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||||
|
../${CMAKE_INSTALL_LIBEXECDIR}/${CORE_TARGET}/rdhc.py rdhc-link )
|
||||||
|
|
||||||
|
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/rdhc-link
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
RENAME rdhc
|
||||||
|
COMPONENT CORE_RUNTIME )
|
||||||
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
install ( FILES ${BUILD_DIR}/version
|
install ( FILES ${BUILD_DIR}/version
|
||||||
DESTINATION .info
|
DESTINATION .info
|
||||||
@@ -145,6 +171,33 @@ else()
|
|||||||
install ( FILES ${BUILD_DIR}/rocmmod
|
install ( FILES ${BUILD_DIR}/rocmmod
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
COMPONENT ${STATIC_COMP_TYPE} )
|
COMPONENT ${STATIC_COMP_TYPE} )
|
||||||
|
|
||||||
|
if( NOT WIN32 )
|
||||||
|
# rdhc tool is developed and tested for Linux based systems only.
|
||||||
|
# rdhc tool is not supported on Windows.
|
||||||
|
# Install rdhc files
|
||||||
|
install ( FILES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/rdhc/README.md
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/rdhc/requirements.txt
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/rdhc
|
||||||
|
COMPONENT ${STATIC_COMP_TYPE})
|
||||||
|
|
||||||
|
install ( PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/rdhc/rdhc.py
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${CORE_TARGET}
|
||||||
|
COMPONENT ${STATIC_COMP_TYPE} )
|
||||||
|
|
||||||
|
# Create symlink for rdhc in bin directory
|
||||||
|
add_custom_target ( rdhc_symlink_static ALL
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||||
|
../${CMAKE_INSTALL_LIBEXECDIR}/${CORE_TARGET}/rdhc.py rdhc-link-static )
|
||||||
|
|
||||||
|
install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/rdhc-link-static
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
RENAME rdhc
|
||||||
|
COMPONENT ${STATIC_COMP_TYPE} )
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Cmake module config file configurations
|
## Cmake module config file configurations
|
||||||
|
|||||||
@@ -7,10 +7,57 @@ import json
|
|||||||
import argparse
|
import argparse
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
import yaml
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from prettytable import PrettyTable
|
|
||||||
|
# Check for required packages before importing them
|
||||||
|
def check_required_packages():
|
||||||
|
"""Check if required Python packages are installed"""
|
||||||
|
missing_packages = []
|
||||||
|
required_packages = {
|
||||||
|
'prettytable': 'prettytable',
|
||||||
|
'yaml': 'PyYAML'
|
||||||
|
}
|
||||||
|
|
||||||
|
for import_name, package_name in required_packages.items():
|
||||||
|
try:
|
||||||
|
__import__(import_name)
|
||||||
|
except ImportError:
|
||||||
|
missing_packages.append(package_name)
|
||||||
|
|
||||||
|
if missing_packages:
|
||||||
|
print("\n" + "="*70)
|
||||||
|
print("WARNING: Missing Required Python Packages")
|
||||||
|
print("="*70)
|
||||||
|
print(f"\nThe following packages are required but not installed:")
|
||||||
|
for pkg in missing_packages:
|
||||||
|
print(f" - {pkg}")
|
||||||
|
|
||||||
|
print("\nTo install the missing packages, run:")
|
||||||
|
print(f" pip3 install {' '.join(missing_packages)}")
|
||||||
|
print("\nOr install all requirements:")
|
||||||
|
print(" pip3 install -r <ROCM_INSTALL_PATH>/share/rdhc/requirements.txt")
|
||||||
|
print(" Or\n pip3 install -r requirements.txt")
|
||||||
|
print("\n" + "="*70 + "\n")
|
||||||
|
|
||||||
|
print("Exiting...")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Check packages before importing
|
||||||
|
packages_available = check_required_packages()
|
||||||
|
|
||||||
|
# Now import the packages
|
||||||
|
try:
|
||||||
|
from prettytable import PrettyTable
|
||||||
|
import yaml
|
||||||
|
except ImportError:
|
||||||
|
print("WARNING: Unable to import the required Python Packages !!!!")
|
||||||
|
print("Exiting...")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# Define test status enum
|
# Define test status enum
|
||||||
class TestStatus(Enum):
|
class TestStatus(Enum):
|
||||||
@@ -1748,7 +1795,8 @@ def main():
|
|||||||
parser = argparse.ArgumentParser(description="ROCm Deployment Health Check Tool",
|
parser = argparse.ArgumentParser(description="ROCm Deployment Health Check Tool",
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
usage="sudo -E ./rdhc.py [options]",
|
usage="sudo -E ./rdhc.py [options]",
|
||||||
epilog="Usage examples:\n"+
|
epilog="Refer the README @<ROCM_INSTALL_PATH>/share/rdhc/README.md \n"+
|
||||||
|
"Usage examples:\n"+
|
||||||
"# Run quick test (default tests only)\n" +
|
"# Run quick test (default tests only)\n" +
|
||||||
"sudo -E ./rdhc.py\n" +
|
"sudo -E ./rdhc.py\n" +
|
||||||
"\n"+
|
"\n"+
|
||||||
|
|||||||
Reference in new issue
封鎖使用者