diff --git a/README.md b/README.md index 0fae90ec48..56eca69c52 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,12 @@ In addition, HC Direct Function call support needs to be present on your machine The root of this repository has a helper script 'install.sh' to build and install RCCL on Ubuntu with a single command. It does not take a lot of options and hard-codes configuration that can be specified through invoking cmake directly, but it's a great way to get started quickly and can serve as an example of how to build/install. * `./install.sh` -- builds library including unit tests -* `./install.sh -i` -- builds and installs the library to /opt/rocm/rccl +* `./install.sh -i` -- builds and installs the library to /opt/rocm/rccl; installation path can be changed with --prefix argument (see below.) * `./install.sh -h` -- shows help * `./install.sh -t` -- builds library including unit tests +* `./install.sh -r` -- runs unit tests (must be already built) +* `./install.sh -p` -- builds RCCL package +* `./install.sh --prefix` -- specify custom path to install RCCL to (default:/opt/rocm) ## Manual build #### To build the library : diff --git a/install.sh b/install.sh index 1554736762..8f65c6e5cb 100755 --- a/install.sh +++ b/install.sh @@ -9,22 +9,24 @@ function display_help() echo "RCCL build & installation helper script" echo "./install [-h|--help] " echo " [-h|--help] prints this help message." + echo " [-i|--install] install RCCL library (see --prefix argument below.)" 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)." + echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm)." } # ################################################# # global variables # ################################################# +default_path=/opt/rocm build_package=false -install_prefix=/opt/rocm/rccl +install_prefix=$default_path build_tests=false run_tests=false -run_tests_only=false build_release=true install_library=false + # ################################################# # Parameter parsing # ################################################# @@ -32,7 +34,7 @@ install_library=false # 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,package_build_only,tests_build,run_tests,prefix: --options hptr -- "$@") + GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,prefix: --options hiptr -- "$@") else echo "Need a new version of getopt" exit 1 @@ -47,45 +49,42 @@ eval set -- "${GETOPT_PARSE}" while true; do case "${1}" in - -h|--help) + -h|--help) 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 ;; + -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 - ;; + --) shift ; break ;; + *) echo "Unexpected command line parameter received; aborting"; + exit 1 + ;; esac done -# Install the pre-commit hook -#bash ./githooks/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 + rm -rf build/release else - rm -rf ${build_dir}/debug + rm -rf build/debug fi @@ -101,29 +100,26 @@ 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 ($install_library); then + make -j$(nproc) install +else + make -j$(nproc) +fi - if ($build_package); then - make package - fi -#fi +if ($build_package); then + make package +fi # Optionally, run tests if they're enabled. if ($run_tests); then