Skip to content

fix: Update a3m and a3u script to resolve slurm nccl test failure#5308

Merged
agrawalkhushi18 merged 7 commits intoGoogleCloudPlatform:release-candidatefrom
agrawalkhushi18:rc-enrootfix2
Mar 4, 2026
Merged

fix: Update a3m and a3u script to resolve slurm nccl test failure#5308
agrawalkhushi18 merged 7 commits intoGoogleCloudPlatform:release-candidatefrom
agrawalkhushi18:rc-enrootfix2

Conversation

@agrawalkhushi18
Copy link
Copy Markdown
Contributor

@agrawalkhushi18 agrawalkhushi18 commented Mar 4, 2026

This PR resolves the error encountered while running NCCL test for a3 machines:
Error encountered in the NCCL tests:
mkdir: cannot create directory ‘/run/enroot’: Permission denied

Fix:
XDG_RUNTIME_DIR is a standard Linux environment variable defined by the XDG Base Directory Specification. It points to a directory specific to the logged-in user for storing small, temporary runtime files. Enroot uses this variable to determine where to create its workspace. If it's unset, Enroot falls back to a hardcoded system path (/run) which causes the crash.
We are resolving the Permission denied error by manually setting the XDG_RUNTIME_DIR environment variable to a user-specific, world-writable directory in /tmp (e.g., /tmp/enroot-runtime-$(id -u)). This ensures enroot uses a safe, writable workspace instead of defaulting to the restricted, root-owned /run/enroot path

Submission Checklist

NOTE: Community submissions can take up to 2 weeks to be reviewed.

Please take the following actions before submitting this pull request.

  • Fork your PR branch from the Toolkit "develop" branch (not main)
  • Test all changes with pre-commit in a local branch #
  • Confirm that "make tests" passes all tests
  • Add or modify unit tests to cover code changes
  • Ensure that unit test coverage remains above 80%
  • Update all applicable documentation
  • Follow Cluster Toolkit Contribution guidelines #

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue with enroot container imports in non-interactive shell environments by providing a more resilient way to set the XDG_RUNTIME_DIR. It also updates the automated testing infrastructure to validate these changes by pulling from a specific development branch, ensuring the fix is properly integrated and tested within the existing workflows.

Highlights

  • Enroot Runtime Directory Fix: Implemented a robust fix for enroot container imports by ensuring XDG_RUNTIME_DIR is properly set. The script now checks if the variable is unset and attempts to create a user-specific runtime directory, falling back to a writable /tmp location if necessary, which is crucial for non-interactive shell environments.
  • NCCL Test Script Update: Modified the test-nccl.yml Ansible playbook to clone the cluster-toolkit repository from the author's fork (agrawalkhushi18) and checkout a specific branch (rc-enrootfix2). This change facilitates testing of the enroot fix within the continuous integration pipeline.
Changelog
  • examples/machine-learning/a3-megagpu-8g/nccl-tests/import_pytorch_container.sh
    • Added logic to dynamically set XDG_RUNTIME_DIR for enroot operations, including a fallback to /tmp if the default user runtime directory is unavailable.
  • examples/machine-learning/a3-ultragpu-8g/nccl-tests/import_pytorch_container.sh
    • Incorporated logic to dynamically set XDG_RUNTIME_DIR for enroot operations, providing a fallback mechanism to /tmp for non-interactive shells.
  • tools/cloud-build/daily-tests/ansible_playbooks/test-validation/test-nccl.yml
    • Updated the git clone command to fetch the cluster-toolkit repository from the author's fork.
    • Added a git checkout command to switch to the rc-enrootfix2 branch for testing purposes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a workaround for enroot in non-interactive shells where XDG_RUNTIME_DIR is not set. However, it introduces a critical security vulnerability in the import_pytorch_container.sh scripts. The scripts set up a fallback XDG_RUNTIME_DIR in /tmp using a predictable path and insecure permissions (sudo chmod a+rw), which is highly susceptible to symlink attacks leading to local privilege escalation to root. Furthermore, the test-nccl.yml configuration was modified to use a personal fork and branch, which must be reverted. The new logic is also duplicated across two separate scripts, and it would be better to centralize it in a shared script to improve maintainability.

@agrawalkhushi18 agrawalkhushi18 changed the title fix2: Update the the script and nccl test file fix: Update a3m and a3u script to resolve nccl test failure Mar 4, 2026
@agrawalkhushi18 agrawalkhushi18 changed the title fix: Update a3m and a3u script to resolve nccl test failure fix: Update a3m and a3u script to resolve slurm nccl test failure Mar 4, 2026
@agrawalkhushi18 agrawalkhushi18 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Mar 4, 2026
@agrawalkhushi18 agrawalkhushi18 requested a review from gokamesh March 4, 2026 11:12
@agrawalkhushi18
Copy link
Copy Markdown
Contributor Author

The PR tests have passed for A3M and A3U:
PR-test-ml-a3-ultragpu-onspot-slurm
PR-test-ml-a3-megagpu-slurm-ubuntu

@agrawalkhushi18 agrawalkhushi18 marked this pull request as ready for review March 4, 2026 11:31
@agrawalkhushi18 agrawalkhushi18 requested review from a team and samskillman as code owners March 4, 2026 11:31
gokamesh
gokamesh previously approved these changes Mar 4, 2026
@agrawalkhushi18
Copy link
Copy Markdown
Contributor Author

PR tests for a3m and a3u are successful after modifications to the commands:

  1. A3M

  2. A3U-onspot

@agrawalkhushi18
Copy link
Copy Markdown
Contributor Author

We need to modify the git clone path in test-nccl.yml from main to current branch in order to test out our changes. So, reverted those changes in order to finalise the release to main. Ideally the recent working branch changes should be taken into account. That effort is being tracked under a separate ticket.

@agrawalkhushi18 agrawalkhushi18 merged commit 8eb5de0 into GoogleCloudPlatform:release-candidate Mar 4, 2026
16 of 78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-bugfix Added to release notes under the "Bug fixes" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants