From a8f1e61f48fe11586c58f7e5664c2a05e852ee4d Mon Sep 17 00:00:00 2001 From: Liam Wrubleski Date: Mon, 21 Mar 2022 15:04:14 -0600 Subject: [PATCH] Packages for test and benchmark executables on all supported OSes using CPack. (#512) --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 18 +++++++++--------- cmake/Dependencies.cmake | 9 +++++---- test/CMakeLists.txt | 15 +++++++++------ 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2aae3109..58a4f68146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Full documentation for RCCL is available at [https://rccl.readthedocs.io](https://rccl.readthedocs.io) +## (Unreleased) RCCL-2.10.4 +### Added +- Packages for test and benchmark executables on all supported OSes using CPack. + ## RCCL-2.10.3 for ROCm 5.0.0 ### Added - Compatibility with NCCL 2.10.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index c64c96c2d2..50a7ca953f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,11 +296,8 @@ if(BUILD_FILE_REORG_BACKWARD_COMPATIBILITY) DESTINATION "./rccl/include/" ) endif() -set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip-rocclr (>= 3.5.0)") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-smi-lib (>= 4.0.0)") +rocm_package_add_dependencies(DEPENDS "hip-rocclr >= 3.5.0" "rocm-smi-lib >= 4.0.0") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) -set(CPACK_RPM_PACKAGE_REQUIRES "hip-rocclr >= 3.5.0") -set(CPACK_RPM_PACKAGE_REQUIRES "rocm-smi-lib >= 4.0.0") set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt" "${ROCM_PATH}") find_file (DEBIAN debian_version debconf.conf PATHS /etc) @@ -333,6 +330,14 @@ License: See LICENSE.txt for license information\n") Optimized primitives for collective multi-GPU communication") endif() +rocm_install_symlink_subdir(rccl) + +if(BUILD_TESTS) + rocm_package_setup_component(clients) + rocm_package_setup_client_component(tests) + add_subdirectory(test) +endif() + rocm_create_package( NAME rccl @@ -341,8 +346,3 @@ rocm_create_package( MAINTAINER "RCCL Maintainer " LDCONFIG) - - -if(BUILD_TESTS) - add_subdirectory(test) -endif() diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index ae6ee02eeb..124c268f29 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -52,7 +52,7 @@ if(NOT GTest_FOUND AND BUILD_TESTS OR INSTALL_DEPENDENCIES) GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.11.0 INSTALL_DIR ${GTEST_ROOT} - CMAKE_ARGS -DBUILD_GTEST=ON -DCMAKE_INSTALL_PREFIX= ${COMPILER_OVERRIDE} + CMAKE_ARGS -DBUILD_GTEST=ON -DCMAKE_INSTALL_PREFIX= ${COMPILER_OVERRIDE} -DBUILD_SHARED_LIBS=OFF LOG_DOWNLOAD TRUE LOG_CONFIGURE TRUE LOG_BUILD TRUE @@ -73,7 +73,7 @@ endif() # Find or download/install rocm-cmake project set( PROJECT_EXTERN_DIR ${CMAKE_CURRENT_BINARY_DIR}/extern ) -find_package(ROCM 0.6 QUIET CONFIG PATHS /opt/rocm) +find_package(ROCM 0.7.3 QUIET CONFIG PATHS /opt/rocm) if(NOT ROCM_FOUND) set(rocm_cmake_tag "master" CACHE STRING "rocm-cmake tag to download") file( @@ -103,7 +103,7 @@ if(NOT ROCM_FOUND) if(rocm_cmake_unpack_error_code) message(FATAL_ERROR "Error: unpacking ${CMAKE_CURRENT_BINARY_DIR}/rocm-cmake-${rocm_cmake_tag}.zip failed") endif() - find_package( ROCM 0.6 REQUIRED CONFIG PATHS ${PROJECT_EXTERN_DIR}/rocm-cmake ) + find_package( ROCM 0.7.3 REQUIRED CONFIG PATHS ${PROJECT_EXTERN_DIR}/rocm-cmake ) endif() include(ROCMSetupVersion) @@ -111,5 +111,6 @@ include(ROCMCreatePackage) include(ROCMInstallTargets) include(ROCMPackageConfigHelpers) include(ROCMInstallSymlinks) +include(ROCMCheckTargetIds) +include(ROCMClients) include( ROCMHeaderWrapper ) -include(ROCMCheckTargetIds OPTIONAL) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a40b610c03..1195d3ecdf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -108,12 +108,15 @@ if(BUILD_TESTS) # HIPCC adds /opt/rocm/lib as RPATH, even though the install process is supposed to # remove RPATH. It also occurs before any user-specified rpath, which effectively overrides the user rpath. # As a work-around, set the correct RPATH for the unit test executable as a post-install step - if (CMAKE_INSTALL_PREFIX MATCHES "${ROCM_PATH}") - # install_prefix/CMAKE_INSTALL_PREFIX was not explicitly specified, so look in build/release - add_custom_command( TARGET UnitTests POST_BUILD COMMAND chrpath ARGS -r ${CMAKE_BINARY_DIR}:${ROCM_PATH}/lib ${CMAKE_BINARY_DIR}/test/UnitTests) - else() - add_custom_command( TARGET UnitTests POST_BUILD COMMAND chrpath ARGS -r ${CMAKE_INSTALL_PREFIX}/lib:${ROCM_PATH}/lib ${CMAKE_INSTALL_PREFIX}/test/UnitTests) - endif() + # if (CMAKE_INSTALL_PREFIX MATCHES "${ROCM_PATH}") + # # install_prefix/CMAKE_INSTALL_PREFIX was not explicitly specified, so look in build/release + # add_custom_command( TARGET UnitTests POST_BUILD COMMAND chrpath ARGS -r ${CMAKE_BINARY_DIR}:${ROCM_PATH}/lib ${CMAKE_BINARY_DIR}/test/UnitTests) + # else() + # add_custom_command( TARGET UnitTests POST_BUILD COMMAND chrpath ARGS -r ${CMAKE_INSTALL_PREFIX}/lib:${ROCM_PATH}/lib ${CMAKE_INSTALL_PREFIX}/test/UnitTests) + # endif() + set_property(TARGET UnitTests PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${ROCM_PATH}/lib;${CMAKE_BINARY_DIR}") + set_property(TARGET UnitTests PROPERTY BUILD_RPATH "${CMAKE_BINARY_DIR};${ROCM_PATH}/lib") + rocm_install(TARGETS UnitTests COMPONENT tests) else() message("Not building unit tests") endif()