From 5229c77d94bdae111fcba9efb353c67c7c58fa44 Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Mon, 22 Jun 2020 00:18:35 -0700 Subject: [PATCH] Add cuda_root filegroup target to the windows BUILD template. When I added this to the linux BUILD template, I forgot to add it here, too. Adjust cuda_configure.bzl.oss so that it copies the binaries with .exe extension on Windows. PiperOrigin-RevId: 317601952 Change-Id: I0712bcd926372cb9d067ead7f92270d52883bfd9 --- third_party/gpus/cuda/BUILD.windows.tpl | 8 ++++++++ third_party/gpus/cuda_configure.bzl | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/third_party/gpus/cuda/BUILD.windows.tpl b/third_party/gpus/cuda/BUILD.windows.tpl index e83da1429dd..55a9ec3d1ab 100644 --- a/third_party/gpus/cuda/BUILD.windows.tpl +++ b/third_party/gpus/cuda/BUILD.windows.tpl @@ -196,6 +196,14 @@ cc_library( data = [":cuda-nvvm"], ) +filegroup( + name = "cuda_root", + srcs = [ + "cuda/bin/fatbinary.exe", + "cuda/bin/bin2c.exe", + ], +) + bzl_library( name = "build_defs_bzl", srcs = ["build_defs.bzl"], diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl index 0b87ba1ae2a..3374965f415 100644 --- a/third_party/gpus/cuda_configure.bzl +++ b/third_party/gpus/cuda_configure.bzl @@ -1062,20 +1062,21 @@ def _create_local_cuda_repository(repository_ctx): )) # copy files mentioned in third_party/nccl/build_defs.bzl.tpl + file_ext = ".exe" if is_windows(repository_ctx) else "" copy_rules.append(make_copy_files_rule( repository_ctx, name = "cuda-bin", srcs = [ cuda_config.cuda_toolkit_path + "/bin/" + "crt/link.stub", - cuda_config.cuda_toolkit_path + "/bin/" + "nvlink", - cuda_config.cuda_toolkit_path + "/bin/" + "fatbinary", - cuda_config.cuda_toolkit_path + "/bin/" + "bin2c", + cuda_config.cuda_toolkit_path + "/bin/" + "nvlink" + file_ext, + cuda_config.cuda_toolkit_path + "/bin/" + "fatbinary" + file_ext, + cuda_config.cuda_toolkit_path + "/bin/" + "bin2c" + file_ext, ], outs = [ "cuda/bin/" + "crt/link.stub", - "cuda/bin/" + "nvlink", - "cuda/bin/" + "fatbinary", - "cuda/bin/" + "bin2c", + "cuda/bin/" + "nvlink" + file_ext, + "cuda/bin/" + "fatbinary" + file_ext, + "cuda/bin/" + "bin2c" + file_ext, ], ))