Making hip-clang the default compiler; documentation update (#216)

* Making hip-clang the default compiler; documentation update

* Adding back --hip-clang to install.sh as a silent option for CI
此提交包含在:
Stanley Tsang
2020-06-04 11:58:27 -06:00
提交者 GitHub
父節點 2a4514772c
當前提交 dc403e0ca2
共有 2 個檔案被更改,包括 28 行新增12 行删除
+5 -4
查看文件
@@ -27,22 +27,23 @@ The root of this repository has a helper script 'install.sh' to build and instal
* `./install.sh -t` -- builds library including unit tests * `./install.sh -t` -- builds library including unit tests
* `./install.sh -r` -- runs unit tests (must be already built) * `./install.sh -r` -- runs unit tests (must be already built)
* `./install.sh -p` -- builds RCCL package * `./install.sh -p` -- builds RCCL package
* `./install.sh -hcc` -- builds RCCL with hcc compiler; note that hcc is now deprecated. (default:hip-clang)
* `./install.sh --prefix` -- specify custom path to install RCCL to (default:/opt/rocm) * `./install.sh --prefix` -- specify custom path to install RCCL to (default:/opt/rocm)
## Manual build ## Manual build
#### To build the library : #### To build the library :
```shell ```shell
$ git clone https://github.com/ROCmSoftwarePlatform/rccl.git $ git clone https://github.com/ROCmSoftwarePlatform/rccl.git
$ cd rccl $ cd rccl
$ mkdir build $ mkdir build
$ cd build $ cd build
$ CXX=/opt/rocm/bin/hcc cmake .. $ CXX=/opt/rocm/bin/hipcc cmake ..
$ make -j 8 $ make -j 8
``` ```
You may substitute an installation path of your own choosing by passing CMAKE_INSTALL_PREFIX. For example: You may substitute an installation path of your own choosing by passing CMAKE_INSTALL_PREFIX. For example:
```shell ```shell
$ CXX=/opt/rocm/bin/hcc cmake -DCMAKE_INSTALL_PREFIX=$PWD/rccl-install .. $ CXX=/opt/rocm/bin/hipcc cmake -DCMAKE_INSTALL_PREFIX=$PWD/rccl-install ..
``` ```
Note: ensure rocm-cmake is installed, `apt install rocm-cmake`. Note: ensure rocm-cmake is installed, `apt install rocm-cmake`.
@@ -81,4 +82,4 @@ Please refer to the [Library documentation](http://rccl.readthedocs.io/) for cur
All source code and accompanying documentation is copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. All source code and accompanying documentation is copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
All modifications are copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved. All modifications are copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
+23 -8
查看文件
@@ -13,7 +13,7 @@ function display_help()
echo " [-p|--package_build] Build RCCL package." echo " [-p|--package_build] Build RCCL package."
echo " [-t|--tests_build] Build unit tests, but do not run." echo " [-t|--tests_build] Build unit tests, but do not run."
echo " [-r|--run_tests] Run unit tests (must be built already.)" echo " [-r|--run_tests] Run unit tests (must be built already.)"
echo " [--hip-clang] Build library using hip-clang compiler." echo " [--hcc] Build library using deprecated hcc compiler (default:hip-clang)."
echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm)." echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm)."
} }
@@ -27,7 +27,7 @@ build_tests=false
run_tests=false run_tests=false
build_release=true build_release=true
install_library=false install_library=false
build_hip_clang=false build_hip_clang=true
# ################################################# # #################################################
# Parameter parsing # Parameter parsing
@@ -36,7 +36,7 @@ build_hip_clang=false
# check if we have a modern version of getopt that can handle whitespace and long parameters # check if we have a modern version of getopt that can handle whitespace and long parameters
getopt -T getopt -T
if [[ $? -eq 4 ]]; then if [[ $? -eq 4 ]]; then
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,hip-clang,prefix: --options hiptr -- "$@") GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,hcc,hip-clang,prefix: --options hiptr -- "$@")
else else
echo "Need a new version of getopt" echo "Need a new version of getopt"
exit 1 exit 1
@@ -67,6 +67,9 @@ while true; do
-r|--run_tests) -r|--run_tests)
run_tests=true run_tests=true
shift ;; shift ;;
--hcc)
build_hip_clang=false
shift ;;
--hip-clang) --hip-clang)
build_hip_clang=true build_hip_clang=true
shift ;; shift ;;
@@ -82,6 +85,14 @@ while true; do
rocm_path=/opt/rocm/bin rocm_path=/opt/rocm/bin
# throw error code after running a command in the install script
check_exit_code( )
{
if (( $1 != 0 )); then
exit $1
fi
}
# ################################################# # #################################################
# prep # prep
# ################################################# # #################################################
@@ -109,9 +120,9 @@ else
cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Debug" cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Debug"
fi fi
compiler=hcc compiler=hipcc
if [[ "${build_hip_clang}" == true ]]; then if [[ "${build_hip_clang}" == false ]]; then
compiler=hipcc compiler=hcc
fi fi
cmake_executable=cmake cmake_executable=cmake
@@ -121,21 +132,25 @@ if [[ -e /etc/redhat-release ]]; then
else else
apt install chrpath libomp-dev apt install chrpath libomp-dev
fi fi
check_exit_code "$?"
if ($build_tests); then if ($build_tests); then
CXX=$rocm_path/$compiler $cmake_executable -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../. CXX=$rocm_path/$compiler $cmake_executable $cmake_common_options -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
else else
CXX=$rocm_path/$compiler $cmake_executable -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../. CXX=$rocm_path/$compiler $cmake_executable $cmake_common_options -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
fi fi
check_exit_code "$?"
if ($install_library); then if ($install_library); then
make -j$(nproc) install make -j$(nproc) install
else else
make -j$(nproc) make -j$(nproc)
fi fi
check_exit_code "$?"
if ($build_package); then if ($build_package); then
make package make package
check_exit_code "$?"
fi fi
# Optionally, run tests if they're enabled. # Optionally, run tests if they're enabled.