Skip to content

Commit

Permalink
Fail fast if required folders under CUDA/CUDNN/NCCL local paths are n…
Browse files Browse the repository at this point in the history
…ot available.

Failure should help to catch the issues before the actual compilation phase.

The instructions for local paths are [here](https://github.com/openxla/xla/blob/main/docs/hermetic_cuda.md?plain=1#L164).

PiperOrigin-RevId: 673958280
  • Loading branch information
tensorflower-gardener authored and Google-ML-Automation committed Sep 12, 2024
1 parent 7790d75 commit 0116756
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,24 @@ def create_build_file(

def _create_symlinks(repository_ctx, local_path, dirs):
for dir in dirs:
repository_ctx.symlink(
"{path}/{dir}".format(
path = local_path,
dir = dir,
),
dir,
dir_path = "{path}/{dir}".format(
path = local_path,
dir = dir,
)
if not repository_ctx.path(local_path).exists:
fail("%s directory doesn't exist!" % dir_path)
repository_ctx.symlink(dir_path, dir)

def _create_libcuda_symlinks(
repository_ctx,
lib_name_to_version_dict):
if repository_ctx.name == "cuda_driver":
repository_ctx.symlink("lib/libcuda.so.{}".format(
nvidia_driver_path = "lib/libcuda.so.{}".format(
lib_name_to_version_dict["%{libcuda_version}"],
), "lib/libcuda.so.1")
)
if not repository_ctx.path(nvidia_driver_path).exists:
fail("%s doesn't exist!" % nvidia_driver_path)
repository_ctx.symlink(nvidia_driver_path, "lib/libcuda.so.1")
repository_ctx.symlink("lib/libcuda.so.1", "lib/libcuda.so")

def use_local_path(repository_ctx, local_path, dirs):
Expand Down

0 comments on commit 0116756

Please sign in to comment.