Set USE_RCCL cmake option (dependent on USE_NCCL) [REDUX] (#34683)

Summary:
Refiled duplicate of https://github.com/pytorch/pytorch/issues/31341 which was reverted in commit 63964175b5.

This PR enables RCCL support when building Gloo as part of PyTorch for ROCm.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/34683

Reviewed By: glaringlee

Differential Revision: D25540578

Pulled By: ezyang

fbshipit-source-id: fcb02e5745d62e1b7d2e02048160e9e7a4b4df2d
This commit is contained in:
Jithun Nair 2021-01-06 06:55:10 -08:00 committed by Facebook GitHub Bot
parent 0ad6f06684
commit 45ec35827e
2 changed files with 16 additions and 0 deletions

View File

@ -173,6 +173,8 @@ option(USE_NATIVE_ARCH "Use -march=native" OFF)
cmake_dependent_option(
USE_NCCL "Use NCCL" ON
"USE_CUDA OR USE_ROCM;UNIX;NOT APPLE" OFF)
cmake_dependent_option(USE_RCCL "Use RCCL" ON
USE_NCCL OFF)
cmake_dependent_option(
USE_STATIC_NCCL "Use static NCCL" OFF
"USE_NCCL" OFF)

View File

@ -131,6 +131,20 @@ if is_hip_clang():
sources.write(line)
print("%s updated" % gloo_cmake_file)
gloo_cmake_file = "third_party/gloo/cmake/Modules/Findrccl.cmake"
if os.path.exists(gloo_cmake_file):
do_write = False
with open(gloo_cmake_file, "r") as sources:
lines = sources.readlines()
newlines = [line.replace('RCCL_LIBRARY', 'RCCL_LIBRARY_PATH') for line in lines]
if lines == newlines:
print("%s skipped" % gloo_cmake_file)
else:
with open(gloo_cmake_file, "w") as sources:
for line in newlines:
sources.write(line)
print("%s updated" % gloo_cmake_file)
hipify_python.hipify(
project_directory=proj_dir,
output_directory=out_dir,