Merge amd-staging into amd-master 20230710
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com>
Change-Id: I932f7e92939b6244a600c4f1bb92580aec9947ca
[ROCm/rocm_smi_lib commit: 18770368a7]
This commit is contained in:
@@ -117,12 +117,12 @@ CTestTestfile.cmake
|
|||||||
_deps
|
_deps
|
||||||
|
|
||||||
#
|
#
|
||||||
# ROCm files
|
# below files are generated via CMake
|
||||||
# Removes generated config headers like rocmsmi64Config.h & oamConfig.h
|
|
||||||
#
|
#
|
||||||
*Config.h
|
*Config.h
|
||||||
|
python_smi_tools/rsmiBindings.py
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fake SYSFS files
|
# Fake SYSFS files
|
||||||
#
|
#
|
||||||
/device/*
|
/device/*
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ find_program (GIT NAMES git)
|
|||||||
|
|
||||||
## Setup the package version based on git tags.
|
## Setup the package version based on git tags.
|
||||||
set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver")
|
set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver")
|
||||||
get_package_version_number("1.0.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
|
get_package_version_number("5.0.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
|
||||||
message("Package version: ${PKG_VERSION_STR}")
|
message("Package version: ${PKG_VERSION_STR}")
|
||||||
set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${VERSION_MAJOR}")
|
set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${VERSION_MAJOR}")
|
||||||
set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${VERSION_MINOR}")
|
set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${VERSION_MINOR}")
|
||||||
@@ -232,7 +232,7 @@ configure_package_config_file(
|
|||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rocm_smi-config-version.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/rocm_smi-config-version.cmake
|
||||||
VERSION "${AMD_SMI_LIBS_TARGET_VERSION_MAJOR}.${AMD_SMI_LIBS_TARGET_VERSION_MINOR}.${AMD_SMI_LIBS_TARGET_VERSION_PATCH}"
|
VERSION "${PKG_VERSION_STR}"
|
||||||
COMPATIBILITY SameMajorVersion
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ install(
|
|||||||
# Create cmake target
|
# Create cmake target
|
||||||
# Add all targets to the build-tree export set
|
# Add all targets to the build-tree export set
|
||||||
export(TARGETS ${ROCM_SMI_TARGET} ${OAM_TARGET}
|
export(TARGETS ${ROCM_SMI_TARGET} ${OAM_TARGET}
|
||||||
FILE "${PROJECT_BINARY_DIR}/rcom_smi_target.cmake")
|
FILE "${PROJECT_BINARY_DIR}/rocm_smi_target.cmake")
|
||||||
|
|
||||||
# Export the package for use from the build-tree
|
# Export the package for use from the build-tree
|
||||||
# (this registers the build-tree with a global CMake-registry)
|
# (this registers the build-tree with a global CMake-registry)
|
||||||
@@ -262,9 +262,11 @@ install(EXPORT rocm_smiTargets
|
|||||||
#License file
|
#License file
|
||||||
set(CPACK_RPM_PACKAGE_LICENSE "NCSA")
|
set(CPACK_RPM_PACKAGE_LICENSE "NCSA")
|
||||||
# install license file in share/doc/rocm_smi-asan folder
|
# install license file in share/doc/rocm_smi-asan folder
|
||||||
install(FILES ${CPACK_RESOURCE_FILE_LICENSE}
|
if( ENABLE_ASAN_PACKAGING )
|
||||||
|
install(FILES ${CPACK_RESOURCE_FILE_LICENSE}
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${ROCM_SMI}-asan RENAME LICENSE.txt
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${ROCM_SMI}-asan RENAME LICENSE.txt
|
||||||
COMPONENT asan)
|
COMPONENT asan)
|
||||||
|
endif()
|
||||||
install( FILES ${CPACK_RESOURCE_FILE_LICENSE}
|
install( FILES ${CPACK_RESOURCE_FILE_LICENSE}
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${ROCM_SMI} RENAME LICENSE.txt
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${ROCM_SMI} RENAME LICENSE.txt
|
||||||
COMPONENT dev)
|
COMPONENT dev)
|
||||||
|
|||||||
+6
-6
@@ -12,16 +12,16 @@ import os
|
|||||||
# Use ROCm installation path if running from standard installation
|
# Use ROCm installation path if running from standard installation
|
||||||
# With File Reorg rsmiBindings.py will be installed in /opt/rocm/libexec/rocm_smi.
|
# With File Reorg rsmiBindings.py will be installed in /opt/rocm/libexec/rocm_smi.
|
||||||
# relative path changed accordingly
|
# relative path changed accordingly
|
||||||
path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../lib/librocm_smi64.so'
|
path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@'
|
||||||
if not os.path.isfile(path_librocm):
|
if not os.path.isfile(path_librocm):
|
||||||
print('Unable to find %s . Trying /opt/rocm*' % path_librocm)
|
print('Unable to find %s . Trying /opt/rocm*' % path_librocm)
|
||||||
for root, dirs, files in os.walk('/opt', followlinks=True):
|
for root, dirs, files in os.walk('/opt', followlinks=True):
|
||||||
if 'librocm_smi64.so' in files:
|
if 'librocm_smi64.so.@VERSION_MAJOR@' in files:
|
||||||
path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so')
|
path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so.@VERSION_MAJOR@')
|
||||||
if os.path.isfile(path_librocm):
|
if os.path.isfile(path_librocm):
|
||||||
print('Using lib from %s' % path_librocm)
|
print('Using lib from %s' % path_librocm)
|
||||||
else:
|
else:
|
||||||
print('Unable to find librocm_smi64.so')
|
print('Unable to find librocm_smi64.so.@VERSION_MAJOR@')
|
||||||
|
|
||||||
# ----------> TODO: Support static libs as well as SO
|
# ----------> TODO: Support static libs as well as SO
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ try:
|
|||||||
rocmsmi = CDLL(path_librocm)
|
rocmsmi = CDLL(path_librocm)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('Unable to load the rocm_smi library.\n'\
|
print('Unable to load the rocm_smi library.\n'\
|
||||||
'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.\n'\
|
'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so.@VERSION_MAJOR@\n'\
|
||||||
'{0}Please refer to https://github.com/'\
|
'{0}Please refer to https://github.com/'\
|
||||||
'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\
|
'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\
|
||||||
.format('\33[33m', '\033[0m'))
|
.format('\33[33m', '\033[0m'))
|
||||||
@@ -638,4 +638,4 @@ rsmi_nps_mode_type = rsmi_nps_mode_type_t
|
|||||||
# Usage example to get corresponding names:
|
# Usage example to get corresponding names:
|
||||||
# nps_mode_type_l[rsmi_nps_mode_type_t.RSMI_MEMORY_PARTITION_NPS2]
|
# nps_mode_type_l[rsmi_nps_mode_type_t.RSMI_MEMORY_PARTITION_NPS2]
|
||||||
# will return string 'NPS2'
|
# will return string 'NPS2'
|
||||||
nps_mode_type_l = ['NPS1', 'NPS2', 'NPS4', 'NPS8']
|
nps_mode_type_l = ['NPS1', 'NPS2', 'NPS4', 'NPS8']
|
||||||
@@ -39,7 +39,7 @@ message("Package version: ${PKG_VERSION_STR}")
|
|||||||
|
|
||||||
# Debian package specific variables
|
# Debian package specific variables
|
||||||
# Set a default value for the package version
|
# Set a default value for the package version
|
||||||
get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
get_version_from_tag("5.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
||||||
|
|
||||||
# VERSION_* variables should be set by get_version_from_tag
|
# VERSION_* variables should be set by get_version_from_tag
|
||||||
if ( ${ROCM_PATCH_VERSION} )
|
if ( ${ROCM_PATCH_VERSION} )
|
||||||
@@ -54,6 +54,10 @@ set(${ROCM_SMI}_VERSION_PATCH "0")
|
|||||||
set(${ROCM_SMI}_VERSION_BUILD "0")
|
set(${ROCM_SMI}_VERSION_BUILD "0")
|
||||||
message("SOVERSION: ${SO_VERSION_STRING}")
|
message("SOVERSION: ${SO_VERSION_STRING}")
|
||||||
|
|
||||||
|
# Configure rsmiBindings.py.in with SO major version:
|
||||||
|
configure_file(
|
||||||
|
"${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindings.py.in"
|
||||||
|
"${COMMON_SRC_ROOT}/python_smi_tools/rsmiBindings.py")
|
||||||
|
|
||||||
# Create a configure file to get version info from within library
|
# Create a configure file to get version info from within library
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|||||||
@@ -345,8 +345,9 @@ RocmSMI::Initialize(uint64_t flags) {
|
|||||||
if (ConstructBDFID(devices_[i]->path(), &bdfid) != 0) {
|
if (ConstructBDFID(devices_[i]->path(), &bdfid) != 0) {
|
||||||
std::cerr << "Failed to construct BDFID." << std::endl;
|
std::cerr << "Failed to construct BDFID." << std::endl;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
} else {
|
||||||
|
devices_[i]->set_bdfid(bdfid);
|
||||||
}
|
}
|
||||||
devices_[i]->set_bdfid(bdfid);
|
|
||||||
}
|
}
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
throw amd::smi::rsmi_exception(RSMI_INITIALIZATION_ERROR,
|
throw amd::smi::rsmi_exception(RSMI_INITIALIZATION_ERROR,
|
||||||
|
|||||||
Reference in New Issue
Block a user