When building NCCL from source, do not rely on CUDA_TOOLKIT_PATH being defined to find bin2c.

PiperOrigin-RevId: 219698198
This commit is contained in:
A. Unique TensorFlower 2018-11-01 14:22:13 -07:00 committed by TensorFlower Gardener
parent f0dbcffb0e
commit 456e6927c0
2 changed files with 6 additions and 4 deletions

View File

@ -182,8 +182,9 @@ def device_link(name, srcs):
# Generate fatbin header from all cubins.
fatbin_hdr = name + ".fatbin.h"
fatbinary = "@local_config_nccl//:cuda/bin/fatbinary"
cmd = ("PATH=$$CUDA_TOOLKIT_PATH/bin:$$PATH " + # for bin2c
"$(location %s) -64 --cmdline=--compile-only --link " % fatbinary +
bin2c = "@local_config_nccl//:cuda/bin/bin2c"
cmd = ("$(location %s) -64 --cmdline=--compile-only " % fatbinary +
"--link --bin2c-path $$(dirname $(location %s)) " % bin2c +
"--compress-all %s --create=%%{name}.fatbin " % " ".join(images) +
"--embedded-fatbin=$@")
native.genrule(
@ -191,7 +192,7 @@ def device_link(name, srcs):
outs = [fatbin_hdr],
srcs = cubins,
cmd = cmd,
tools = [fatbinary],
tools = [fatbinary, bin2c],
)
# Generate the source file #including the headers generated above.

View File

@ -3,7 +3,7 @@
`nccl_configure` depends on the following environment variables:
* `TF_NCCL_VERSION`: The NCCL version.
* `TF_NCCL_VERSION`: Installed NCCL version or empty to build from source.
* `NCCL_INSTALL_PATH`: The installation path of the NCCL library.
* `NCCL_HDR_PATH`: The installation path of the NCCL header files.
"""
@ -44,6 +44,7 @@ _NCCL_ARCHIVE_BUILD_CONTENT = """
exports_files([
"cuda/bin/crt/link.stub",
"cuda/bin/fatbinary",
"cuda/bin/bin2c",
"nvlink",
])