aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-01 17:28:26 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-01 17:28:26 -0700
commitea5c529ed7b7e17d1e66bc7cf4479d232ed0a896 (patch)
tree1e243678216ef70459cbae51b61ede073d75c4b0 /third_party
parentbfbe2bbe6a83a4acfa8f87aa5c8228e74b37bb61 (diff)
parent49978a87c80d85f8eea71e003265b788aa5febc3 (diff)
Merge pull request #22519 from jayfurmanek:nccl2_configure
PiperOrigin-RevId: 215310536
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nccl/nccl_configure.bzl13
-rw-r--r--third_party/nccl/system.BUILD.tpl4
2 files changed, 12 insertions, 5 deletions
diff --git a/third_party/nccl/nccl_configure.bzl b/third_party/nccl/nccl_configure.bzl
index ce9447096e..d78fe8f3aa 100644
--- a/third_party/nccl/nccl_configure.bzl
+++ b/third_party/nccl/nccl_configure.bzl
@@ -5,6 +5,7 @@
* `TF_NCCL_VERSION`: The NCCL version.
* `NCCL_INSTALL_PATH`: The installation path of the NCCL library.
+ * `NCCL_HDR_PATH`: The installation path of the NCCL header files.
"""
load(
@@ -15,6 +16,7 @@ load(
)
_NCCL_INSTALL_PATH = "NCCL_INSTALL_PATH"
+_NCCL_HDR_PATH = "NCCL_HDR_PATH"
_TF_NCCL_VERSION = "TF_NCCL_VERSION"
_TF_NCCL_CONFIG_REPO = "TF_NCCL_CONFIG_REPO"
@@ -68,7 +70,7 @@ def _find_nccl_header(repository_ctx, nccl_install_path):
return header_path
-def _check_nccl_version(repository_ctx, nccl_install_path, nccl_version):
+def _check_nccl_version(repository_ctx, nccl_install_path, nccl_hdr_path, nccl_version):
"""Checks whether the header file matches the specified version of NCCL.
Args:
@@ -79,7 +81,9 @@ def _check_nccl_version(repository_ctx, nccl_install_path, nccl_version):
Returns:
A string containing the library version of NCCL.
"""
- header_path = _find_nccl_header(repository_ctx, nccl_install_path)
+ header_path = repository_ctx.path("%s/nccl.h" % nccl_hdr_path)
+ if not header_path.exists:
+ header_path = _find_nccl_header(repository_ctx, nccl_install_path)
header_dir = str(header_path.realpath.dirname)
major_version = find_cuda_define(repository_ctx, header_dir, "nccl.h",
_DEFINE_NCCL_MAJOR)
@@ -138,10 +142,12 @@ def _nccl_configure_impl(repository_ctx):
else:
# Create target for locally installed NCCL.
nccl_install_path = repository_ctx.os.environ[_NCCL_INSTALL_PATH].strip()
- _check_nccl_version(repository_ctx, nccl_install_path, nccl_version)
+ nccl_hdr_path = repository_ctx.os.environ[_NCCL_HDR_PATH].strip()
+ _check_nccl_version(repository_ctx, nccl_install_path, nccl_hdr_path, nccl_version)
repository_ctx.template("BUILD", _NCCL_LOCAL_BUILD_TEMPLATE, {
"%{version}": nccl_version,
"%{install_path}": nccl_install_path,
+ "%{hdr_path}": nccl_hdr_path,
})
@@ -149,6 +155,7 @@ nccl_configure = repository_rule(
implementation=_nccl_configure_impl,
environ=[
_NCCL_INSTALL_PATH,
+ _NCCL_HDR_PATH,
_TF_NCCL_VERSION,
],
)
diff --git a/third_party/nccl/system.BUILD.tpl b/third_party/nccl/system.BUILD.tpl
index 7ca835dedf..a07f54955f 100644
--- a/third_party/nccl/system.BUILD.tpl
+++ b/third_party/nccl/system.BUILD.tpl
@@ -20,7 +20,7 @@ genrule(
"libnccl.so.%{version}",
"nccl.h",
],
- cmd = """cp "%{install_path}/include/nccl.h" "$(@D)/nccl.h" &&
- cp "%{install_path}/lib/libnccl.so.%{version}" "$(@D)/libnccl.so.%{version}" """,
+ cmd = """cp "%{hdr_path}/nccl.h" "$(@D)/nccl.h" &&
+ cp "%{install_path}/libnccl.so.%{version}" "$(@D)/libnccl.so.%{version}" """,
)