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
80 lines
3.0 KiB
CMake
80 lines
3.0 KiB
CMake
# Redhat package building for NCCL
|
|
|
|
find_program(RPMBUILD_EXECUTABLE rpmbuild)
|
|
find_program(SED_EXECUTABLE sed)
|
|
|
|
# Set package directories
|
|
set(RPMPREPDIR "${CMAKE_BINARY_DIR}/redhat")
|
|
set(PKGDIR "${CMAKE_BINARY_DIR}/pkg/rpm")
|
|
set(RPMGEN_IN nccl.spec.in)
|
|
set(RPMGEN nccl.spec)
|
|
set(RPMFILES ${RPMGEN})
|
|
set(RPMTARGETS ${RPMPREPDIR}/${RPMGEN})
|
|
|
|
# Get current timestamp in RFC 2822 format
|
|
execute_process(COMMAND date -R
|
|
OUTPUT_VARIABLE PKG_TIMESTAMP
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# Get architecture
|
|
set(ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
|
set(PKG_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
|
|
|
# Get multiarch tuple
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-multiarch
|
|
OUTPUT_VARIABLE PKG_MULTIARCH
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_QUIET)
|
|
|
|
if(NOT PKG_MULTIARCH)
|
|
# Hardwire the PKG_MULTIARCH directory as the RHEL6 distribution agnostic compiler (gcc 4.8.3) doesn't set it
|
|
set(PKG_MULTIARCH "${ARCH}-linux-gnu")
|
|
endif()
|
|
|
|
# Custom target for redhat package preparation
|
|
add_custom_target(redhat_prep ALL
|
|
# Create redhat prep directory
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${RPMPREPDIR}
|
|
COMMENT "Preparing Redhat package files"
|
|
)
|
|
|
|
# Generate spec file from template
|
|
add_custom_command(
|
|
TARGET redhat_prep
|
|
COMMAND ${SED_EXECUTABLE} -e 's/\\$$\{nccl:Major\}/${NCCL_MAJOR}/g'
|
|
-e 's/\\$$\{nccl:Minor\}/${NCCL_MINOR}/g'
|
|
-e 's/\\$$\{nccl:Patch\}/${NCCL_PATCH}/g'
|
|
-e 's/\\$$\{nccl:Suffix\}/${NCCL_SUFFIX}/g'
|
|
-e 's/\\$$\{cuda:Major\}/${CUDA_MAJOR}/g'
|
|
-e 's/\\$$\{cuda:Minor\}/${CUDA_MINOR}/g'
|
|
-e 's/\\$$\{pkg:Revision\}/${PKG_REVISION}/g'
|
|
-e 's/\\$$\{pkg:Timestamp\}/${PKG_TIMESTAMP}/g'
|
|
-e 's/\\$$\{pkg:Arch\}/${PKG_ARCH}/g'
|
|
-e 's/\\$$\{pkg:MultiArch\}/${PKG_MULTIARCH}/g'
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${RPMGEN_IN} > ${RPMPREPDIR}/${RPMGEN}
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${RPMGEN_IN}
|
|
)
|
|
|
|
# Build the package
|
|
add_custom_target(redhat_build
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${PKGDIR}
|
|
COMMAND ${RPMBUILD_EXECUTABLE} --define "_sourcedir ${CMAKE_BINARY_DIR}/pkg/txz"
|
|
--define "_rpmdir ${PKGDIR}"
|
|
--define "_builddir ${PKGDIR}/build/"
|
|
--define "_buildrootdir ${PKGDIR}/buildroot/"
|
|
-bb ${CMAKE_BINARY_DIR}/redhat/nccl.spec
|
|
WORKING_DIRECTORY ${RPMPREPDIR}
|
|
DEPENDS redhat_prep nccl_static txz_build
|
|
COMMENT "Building Redhat package with rpmbuild"
|
|
)
|
|
|
|
# Custom target for cleaning redhat package
|
|
add_custom_target(redhat_clean
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${RPMPREPDIR}
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PKGDIR}
|
|
COMMENT "Cleaning Redhat package build files"
|
|
)
|
|
|
|
# Add redhat targets to the main project
|
|
add_dependencies(redhat_build nccl_static txz_build)
|