CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
181 lines
6.7 KiB
CMake
181 lines
6.7 KiB
CMake
# Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
include_guard(GLOBAL)
|
|
|
|
# Install hipFile
|
|
|
|
# From the rocm-cmake repo
|
|
include(ROCMInstallTargets)
|
|
include(ROCMCreatePackage)
|
|
|
|
# Install the library
|
|
rocm_install(TARGETS hipfile)
|
|
|
|
# Install the headers
|
|
rocm_install(
|
|
DIRECTORY ${HIPFILE_ROOT_PATH}/include/
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
|
|
# Install AIS tools
|
|
if(AIS_INSTALL_TOOLS)
|
|
install(PROGRAMS tools/ais-check/ais-check DESTINATION bin)
|
|
if(TARGET ais-stats)
|
|
install(TARGETS ais-stats DESTINATION bin)
|
|
endif()
|
|
endif()
|
|
|
|
# Install example code
|
|
# Since the input DIRECTORY is `examples` don't include it in
|
|
# the DESTINATION path or you'll get `examples/examples/*` output
|
|
if(AIS_INSTALL_EXAMPLES)
|
|
install(
|
|
DIRECTORY ${HIPFILE_ROOT_PATH}/examples
|
|
DESTINATION share/doc/${CMAKE_PROJECT_NAME}
|
|
FILES_MATCHING
|
|
PATTERN "*.cpp"
|
|
PATTERN "*.h"
|
|
PATTERN "README.md"
|
|
)
|
|
|
|
# Create the installed CMakeLists.txt files from the templates.
|
|
# The CMakeLists.txt files in the examples tree use our build
|
|
# flags and infrastructure so we can ensure they are well-vetted
|
|
# and these can't be installed.
|
|
set(AIS_EXAMPLE_DIRS
|
|
aiscp
|
|
api
|
|
common
|
|
basics
|
|
async
|
|
)
|
|
foreach(example_dir ${AIS_EXAMPLE_DIRS})
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/examples/${example_dir}/CMakeLists.install.cmake"
|
|
"examples/${example_dir}/CMakeLists.txt"
|
|
@ONLY
|
|
)
|
|
install(FILES
|
|
"${CMAKE_CURRENT_BINARY_DIR}/examples/${example_dir}/CMakeLists.txt"
|
|
DESTINATION "share/doc/${CMAKE_PROJECT_NAME}/examples/${example_dir}/"
|
|
)
|
|
endforeach()
|
|
endif()
|
|
|
|
# When we have RELEASE/DEV builds set up, we can split
|
|
# where these dependencies are added.
|
|
# For now, just add both runtime & dev deps.
|
|
|
|
# AMD ROCm Runtime + Dev Dependencies
|
|
if(CMAKE_HIP_PLATFORM STREQUAL "amd")
|
|
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" _rocm_mm "${ROCM_VERSION}")
|
|
if(NOT _rocm_mm)
|
|
message(FATAL_ERROR
|
|
"ROCM_VERSION='${ROCM_VERSION}' does not match the expected "
|
|
"MAJOR.MINOR[.PATCH] form (e.g., 7.13.0).")
|
|
endif()
|
|
set(_rocm_major "${CMAKE_MATCH_1}")
|
|
set(_rocm_minor "${CMAKE_MATCH_2}")
|
|
if(_rocm_major GREATER 7 OR (_rocm_major EQUAL 7 AND _rocm_minor GREATER_EQUAL 11))
|
|
# 7.11+ ships runtime + dev as a single amdrocm-runtime-dev<MAJOR>.<MINOR>
|
|
# meta-package on repo.amd.com; rocm-core, hip-runtime-amd, and hip-dev
|
|
# do not exist there, so suppress rocm-cmake's auto-added rocm-core dep.
|
|
set(ROCM_DEP_ROCMCORE OFF CACHE BOOL "" FORCE)
|
|
rocm_package_add_deb_dependencies(DEPENDS "amdrocm-runtime-dev${_rocm_major}.${_rocm_minor}")
|
|
else()
|
|
rocm_package_add_dependencies(DEPENDS hip-runtime-amd) # Need minimum version
|
|
rocm_package_add_deb_dependencies(DEPENDS hip-dev) # Need minimum version
|
|
rocm_package_add_rpm_dependencies(DEPENDS hip-devel)
|
|
endif()
|
|
|
|
# Suppressing libmount RELEASE dependency for now for the following:
|
|
# 1) We currently default to DEV builds.
|
|
# 2) libmount naming convention is not consistent across distros.
|
|
# We need to figure out the ideal method for handling this case.
|
|
# openSUSE (RPM): libmount1
|
|
# rocky (RPM): libmount
|
|
# Ubuntu (DEB): libmount1
|
|
#rocm_package_add_dependencies(DEPENDS libmount)
|
|
rocm_package_add_deb_dependencies(DEPENDS libmount-dev)
|
|
rocm_package_add_rpm_dependencies(DEPENDS libmount-devel)
|
|
endif()
|
|
|
|
# NVIDIA Runtime Dependencies
|
|
if(CMAKE_HIP_PLATFORM STREQUAL "nvidia")
|
|
rocm_package_add_dependencies(DEPENDS libcufile)
|
|
endif()
|
|
|
|
# NVIDIA Development Dependencies
|
|
if(CMAKE_HIP_PLATFORM STREQUAL "nvidia")
|
|
rocm_package_add_deb_dependencies(DEPENDS libcufile-dev)
|
|
rocm_package_add_rpm_dependencies(DEPENDS libcufile-devel)
|
|
endif()
|
|
|
|
# Export the hipfile target
|
|
set(target_list hip::hipfile)
|
|
|
|
# Kitware recommends making the namespace match the package name
|
|
# to work with the Common Package Specification, but since the
|
|
# rest of ROCm doesn't do that, we'll stick with hip::
|
|
rocm_export_targets(
|
|
TARGETS ${target_list}
|
|
NAMESPACE hip::
|
|
)
|
|
|
|
# CPack license setup
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${HIPFILE_ROOT_PATH}/LICENSE.md")
|
|
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
|
|
|
# rocm-cmake sets CPACK_SET_DESTDIR on Linux, which conflicts with
|
|
# asking for relocatable packages
|
|
set(CPACK_PACKAGE_RELOCATABLE OFF)
|
|
set(CPACK_RPM_PACKAGE_RELOCATABLE OFF)
|
|
set(CPACK_DEB_PACKAGE_RELOCATABLE OFF)
|
|
|
|
# Some RPMs set dependencies on a library automatically instead
|
|
# of a manually defined package name via the AutoRequires &
|
|
# AutoProvides RPM features.
|
|
# ROCmCreatePackage however disables AUTOREQPROV by default.
|
|
# The RPM spec does not clearly state how setting AUTOREPROV &
|
|
# AUTOREQ / AUTOPROV to different values behaves. On observation,
|
|
# AUTOREQPROV supersedes the others and continues the build.
|
|
# Ref: https://ftp.rpm.org/max-rpm/s1-rpm-specref-preamble.html#S3-RPM-SPECREF-AUTOREQPROV
|
|
set(CPACK_RPM_PACKAGE_AUTOREQPROV "") # Intentionally set to an empty value so ROCmCreatePackage treats it as defined and does not override it.
|
|
set(CPACK_RPM_PACKAGE_AUTOPROV ON)
|
|
set(CPACK_RPM_PACKAGE_AUTOREQ OFF)
|
|
# Alternatively, we could set CPACK_RPM_PACKAGE_PROVIDES,
|
|
# but then we would have to maintain it...
|
|
|
|
# Set DEB/RPM Release Information
|
|
# rocm_create_package checks if following variables are defined in the environment:
|
|
# - CPACK_DEBIAN_PACKAGE_RELEASE
|
|
# - CPACK_RPM_PACKAGE_RELEASE
|
|
# - ROCM_LIBPATCH_VERSION
|
|
# If ENV{CPACK_*_PACKAGE_RELEASE} is not defined, it will fallback to use ${PROJECT_VERSION_TWEAK}.
|
|
# See https://github.com/ROCm/ROCm/blob/8aa43d132f0d541eb5303dc532f5931cb80ad87a/tools/rocm-build/envsetup.sh#L77-L78
|
|
# If ENV{ROCM_LIBPATCH_VERSION} is not defined, the ROCm version will not be appended to the project version.
|
|
# ROCM_LIBPATCH_VERSION is ROCM_VERSION with '.' replaced by '0'.
|
|
# See: https://github.com/ROCm/ROCm/blob/8aa43d132f0d541eb5303dc532f5931cb80ad87a/tools/rocm-build/envsetup.sh#L94
|
|
|
|
if(NOT DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE} AND NOT DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE})
|
|
set(PROJECT_VERSION_TWEAK "local")
|
|
endif()
|
|
|
|
# Prefer to include the ROCm libpatch version even on a non-release build.
|
|
if(NOT DEFINED ENV{ROCM_LIBPATCH_VERSION})
|
|
string(REPLACE "." "0" _rocm_libpatch_version "${ROCM_VERSION}")
|
|
set(ENV{ROCM_LIBPATCH_VERSION} "${_rocm_libpatch_version}")
|
|
endif()
|
|
|
|
# Create the package
|
|
#
|
|
# Note that you will just get a dev package if you have BUILD_SHARED_LIBS
|
|
# set to off (since there are no shared libraries to install).
|
|
rocm_create_package(
|
|
NAME "hipFile"
|
|
DESCRIPTION "The hipFile library"
|
|
MAINTAINER "hipfile-maintainer@amd.com"
|
|
)
|