Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support toolkit_path in rules_cuda_dependencies #121

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cuda/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def detect_cuda_toolkit(repository_ctx):

# Some distributions instead put CUDA binaries in a seperate path
# Manually check and redirect there when necessary
alternative = repository_ctx.path('/usr/lib/nvidia-cuda-toolkit/bin/nvcc')
alternative = repository_ctx.path("/usr/lib/nvidia-cuda-toolkit/bin/nvcc")
if str(ptxas_path) == "/usr/bin/ptxas" and alternative.exists:
ptxas_path = alternative
cuda_path = str(ptxas_path.dirname.dirname)
Expand Down Expand Up @@ -206,8 +206,12 @@ local_cuda = repository_rule(
# remotable = True,
)

def rules_cuda_dependencies():
"""Populate the dependencies for rules_cuda. This will setup workspace dependencies (other bazel rules) and local toolchains."""
def rules_cuda_dependencies(toolkit_path = None):
"""Populate the dependencies for rules_cuda. This will setup workspace dependencies (other bazel rules) and local toolchains.

Args:
toolkit_path: Optionally specify the path to CUDA toolkit. If not specified, it will be detected automatically.
"""
maybe(
name = "bazel_skylib",
repo_rule = http_archive,
Expand All @@ -228,4 +232,4 @@ def rules_cuda_dependencies():
],
)

local_cuda(name = "local_cuda")
local_cuda(name = "local_cuda", toolkit_path = toolkit_path)