From 4c4351673bf1857a1775a3671d8ef3143ecebad8 Mon Sep 17 00:00:00 2001 From: saadrahim <44449863+saadrahim@users.noreply.github.com> Date: Wed, 22 May 2019 15:32:32 -0600 Subject: [PATCH] Jenkinsfile (#65) * Changing Jenkinsfile to support runs without docker * Updating install file for build options * Fixing command execution * Fixing Jenkinsfile * fixing test execution * Removing junit search --- Jenkinsfile | 22 +++++------ install.sh | 109 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 97 insertions(+), 34 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 655f9dc7e0..c53a81da98 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ #!/usr/bin/env groovy // Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. // This shared library is available at https://github.com/ROCmSoftwarePlatform/rccl -@Library('rocJenkins') _ +@Library('rocJenkins@noDocker') _ // This is file for internal AMD use. // If you are interested in running your own Jenkins, please raise a github issue for assistance. @@ -32,10 +32,10 @@ rcclCI: def rccl = new rocProject('rccl') // customize for project - rccl.paths.build_command = './install.sh' + rccl.paths.build_command = './install.sh -t' // Define test architectures, optional rocm version argument is available - def nodes = new dockerNodes(['gfx906'], rccl) + def nodes = new dockerNodes(['RCCL'], rccl) boolean formatCheck = false @@ -50,7 +50,7 @@ rcclCI: LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=${project.compiler.compiler_path} ${project.paths.build_command} """ - platform.runCommand(this, command) + sh command } def testCommand = @@ -59,12 +59,12 @@ rcclCI: def command = """#!/usr/bin/env bash set -x - cd ${project.paths.project_build_prefix}/rccl-install/test - ./UnitTest --gtest_output=xml --gtest_color=yes + cd ${project.paths.project_build_prefix}/build/release/test + HSA_FORCE_FINE_GRAIN_PCIE=1 ./UnitTests --gtest_output=xml --gtest_color=yes """ - platform.runCommand(this, command) - junit "${project.paths.project_build_prefix}/rccl-install/*.xml" + sh command + //junit "${project.paths.project_build_prefix}/build/release/*.xml" } def packageCommand = @@ -80,10 +80,10 @@ rcclCI: sudo dpkg -i package/*.deb """ - platform.runCommand(this, command) - platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""") + + //platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""") } - buildProject(rccl, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand) + buildProjectNoDocker(rccl, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand) } \ No newline at end of file diff --git a/install.sh b/install.sh index a96261b4bc..1554736762 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,6 @@ #!/bin/bash # Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. -export RCCL_DIR=$PWD/rccl-internal -export RCCL_INSTALL=$PWD/rccl-install -export ROCM_PATH=/opt/rocm/bin - # ################################################# # helper functions # ################################################# @@ -12,10 +8,23 @@ function display_help() { echo "RCCL build & installation helper script" echo "./install [-h|--help] " - echo " [-h|--help] prints this help message" - echo " [-t|--test] run RCCL unit tests too" + echo " [-h|--help] prints this help message." + echo " [-p|--package_build] Build RCCL package." + echo " [-t|--tests_build] Build unit tests, but do not run." + echo " [-r|--run_tests] Run unit tests (must be built already.)" + echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm/rccl)." } +# ################################################# +# global variables +# ################################################# +build_package=false +install_prefix=/opt/rocm/rccl +build_tests=false +run_tests=false +run_tests_only=false +build_release=true +install_library=false # ################################################# # Parameter parsing # ################################################# @@ -23,7 +32,7 @@ function display_help() # check if we have a modern version of getopt that can handle whitespace and long parameters getopt -T if [[ $? -eq 4 ]]; then - GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,clients,debug,test --options hicdt -- "$@") + GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,package_build_only,tests_build,run_tests,prefix: --options hptr -- "$@") else echo "Need a new version of getopt" exit 1 @@ -36,17 +45,27 @@ fi eval set -- "${GETOPT_PARSE}" -run_tests=false - while true; do case "${1}" in -h|--help) - display_help - exit 0 - ;; - -t|--test) + display_help + exit 0 + ;; + -i|--install) + install_library=true + shift ;; + -p|--package_build) + build_package=true + shift ;; + -t|--tests_build) + build_tests=true + shift ;; + -r|--run_tests) run_tests=true shift ;; + --prefix) + install_prefix=${2} + shift 2 ;; --) shift ; break ;; *) echo "Unexpected command line parameter received; aborting"; exit 1 @@ -57,17 +76,61 @@ while true; do # Install the pre-commit hook #bash ./githooks/install -rm -rf build -mkdir build -cd build -if ($run_tests); then -CXX=$ROCM_PATH/hcc cmake -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$RCCL_INSTALL .. +rocm_path=/opt/rocm/bin +#build_dir=./build +# ################################################# +# prep +# ################################################# +# ensure a clean build environment +if [[ "${build_release}" == true ]]; then + rm -rf ${build_dir}/release else -CXX=$ROCM_PATH/hcc cmake -DCMAKE_INSTALL_PREFIX=$RCCL_INSTALL .. + rm -rf ${build_dir}/debug fi -make -j 8 install -if ($run_tests); then -# Optionally, run tests if they're enabled. -HSA_FORCE_FINE_GRAIN_PCIE=1 $RCCL_INSTALL/test/UnitTests + +# Create and go to the build directory. +mkdir -p build; cd build + +if ($build_release); then + mkdir -p release; cd release +else + mkdir -p debug; cd debug +fi + + +# build type +if [[ "${build_release}" == true ]]; then + #mkdir -p ${build_dir}/release/clients && cd ${build_dir}/release + cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Release" +else + #mkdir -p ${build_dir}/debug/clients && cd ${build_dir}/debug + cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Debug" +fi + + +#if !($run_tests_only); then +# cd build + +if ($build_tests); then + CXX=$rocm_path/hcc cmake -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../. +else + CXX=$rocm_path/hcc cmake -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../. +fi + +make -j$(nproc) + + if ($build_package); then + make package + fi +#fi + +# Optionally, run tests if they're enabled. +if ($run_tests); then + if (test -f "./test/UnitTests"); then + HSA_FORCE_FINE_GRAIN_PCIE=1 ./test/UnitTests + else + echo "Unit tests have not been built yet; please re-run script with -t to build unit tests." + exit 1 + fi fi