Skip to content

Commit

Permalink
Only reslove @local_cuda with Label
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhan committed Jul 17, 2023
1 parent bed1109 commit f65d5f5
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cuda/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ def detect_cuda_toolkit(repository_ctx):
cuda_path = None

bin_ext = ".exe" if _is_windows(repository_ctx) else ""
nvlink = Label("@rules_cuda//cuda/dummy:nvlink")
link_stub = Label("@rules_cuda//cuda/dummy:link.stub")
bin2c = Label("@rules_cuda//cuda/dummy:bin2c")
fatbinary = Label("@rules_cuda//cuda/dummy:fatbinary")
nvlink = "@rules_cuda//cuda/dummy:nvlink"
link_stub = "@rules_cuda//cuda/dummy:link.stub"
bin2c = "@rules_cuda//cuda/dummy:bin2c"
fatbinary = "@rules_cuda//cuda/dummy:fatbinary"
if cuda_path != None:
if repository_ctx.path(cuda_path + "/bin/nvlink" + bin_ext).exists:
nvlink = Label("@local_cuda//:cuda/bin/nvlink{}".format(bin_ext))
nvlink = str(Label("@local_cuda//:cuda/bin/nvlink{}".format(bin_ext)))
if repository_ctx.path(cuda_path + "/bin/crt/link.stub").exists:
link_stub = Label("@local_cuda//:cuda/bin/crt/link.stub")
link_stub = str(Label("@local_cuda//:cuda/bin/crt/link.stub"))
if repository_ctx.path(cuda_path + "/bin/bin2c" + bin_ext).exists:
bin2c = Label("@local_cuda//:cuda/bin/bin2c{}".format(bin_ext))
bin2c = str(Label("@local_cuda//:cuda/bin/bin2c{}".format(bin_ext)))
if repository_ctx.path(cuda_path + "/bin/fatbinary" + bin_ext).exists:
fatbinary = Label("@local_cuda//:cuda/bin/fatbinary{}".format(bin_ext))
fatbinary = str(Label("@local_cuda//:cuda/bin/fatbinary{}".format(bin_ext)))

nvcc_version_major = -1
nvcc_version_minor = -1
Expand All @@ -89,10 +89,10 @@ def detect_cuda_toolkit(repository_ctx):
# this is extracted from `nvcc --version`
nvcc_version_major = nvcc_version_major,
nvcc_version_minor = nvcc_version_minor,
nvlink_label = str(nvlink),
link_stub_label = str(link_stub),
bin2c_label = str(bin2c),
fatbinary_label = str(fatbinary),
nvlink_label = nvlink,
link_stub_label = link_stub,
bin2c_label = bin2c,
fatbinary_label = fatbinary,
)

def config_cuda_toolkit_and_nvcc(repository_ctx, cuda):
Expand Down

0 comments on commit f65d5f5

Please sign in to comment.