Skip to content

Fix cuda build with Bzlmod#84

Merged
yuriivcs merged 1 commit intogoogle-ml-infra:mainfrom
meteorcloudy:fix_cuda
Sep 26, 2025
Merged

Fix cuda build with Bzlmod#84
yuriivcs merged 1 commit intogoogle-ml-infra:mainfrom
meteorcloudy:fix_cuda

Conversation

@meteorcloudy
Copy link
Copy Markdown
Contributor

With Bzlmod, repository_ctx.name returns the canonical repo name, but we need the original repo name used for checking cuda libraries.

Also added missing environ for _redist_repo

@meteorcloudy
Copy link
Copy Markdown
Contributor Author

@yuriivcs I tried to run the test on my machine with bazel test --config=bzlmod //cc/tests/gpu:all --config=build_cuda_with_nvcc --config=cuda --config=cuda_libraries_from_stubs

It builds correctly, but running failed with

error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory

This also happens to the workspace build, I guess I'm missing cuda installation on my machine?

@meteorcloudy
Copy link
Copy Markdown
Contributor Author

Looks like what I need is sudo apt-get install -y cuda-drivers

But the test still fails with

INFO: From Testing //cc/tests/gpu:vector_cuda_test:
==================== Test output for //cc/tests/gpu:vector_cuda_test:
Running main() from gmock_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from VectorCudaTest
[ RUN      ] VectorCudaTest.VectorCudaTest
================================================================================

for both workspace and bzlmod build.

Overall, I think the build works, but maybe my local setup is still not correct for running the test

@meteorcloudy
Copy link
Copy Markdown
Contributor Author

@yuriivcs

github-merge-queue Bot pushed a commit to bazelbuild/bazel that referenced this pull request Sep 23, 2025
This new attribute contains the original value of the `name` attribute
at the instantiation site of the repo rule (e.g., `rctx.original_name`
would be `foo` if `rctx.name` is `+ext+foo`).

Fixes #24467

Closes #25121.

RELNOTES: Added `repository_ctx.original_name`, which contains the
original value of the `name` attribute as specified at the repo rule
call site.

PiperOrigin-RevId: 722731393
Change-Id: I2f7dada0c44b6bd4c0d2622fa1e97223382a8547
(cherry picked from commit
8bcfb06)

Fixes #27033

Context: this would help
google-ml-infra/rules_ml_toolchain#84

---------

Co-authored-by: Fabian Meumertzheim <[email protected]>
@yuriivcs
Copy link
Copy Markdown
Collaborator

I haven't been able to fix this issue yet, will do it next week.

@meteorcloudy
Copy link
Copy Markdown
Contributor Author

@yuriivcs Since the issue is irrelevant to this PR, can we merge this first?

Copy link
Copy Markdown
Collaborator

@yuriivcs yuriivcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@yuriivcs yuriivcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yuriivcs yuriivcs merged commit a2e8c32 into google-ml-infra:main Sep 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants