Skip to content

Update nccl test script to fix enroot directory issue in A3H#5324

Merged
agrawalkhushi18 merged 1 commit intoGoogleCloudPlatform:developfrom
agrawalkhushi18:a3-high-enroot
Mar 9, 2026
Merged

Update nccl test script to fix enroot directory issue in A3H#5324
agrawalkhushi18 merged 1 commit intoGoogleCloudPlatform:developfrom
agrawalkhushi18:a3-high-enroot

Conversation

@agrawalkhushi18
Copy link
Copy Markdown
Contributor

This PR resolves the error encountered while running NCCL test for a3h 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 #

@agrawalkhushi18 agrawalkhushi18 added the release-bugfix Added to release notes under the "Bug fixes" heading. label Mar 9, 2026
@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 a critical "Permission denied" error that prevented NCCL tests from running successfully on A3H machines. The fix ensures that the enroot container runtime correctly identifies and uses a user-specific, writable directory for its temporary files, thereby bypassing the previous issue where it attempted to write to a restricted system path. This change improves the reliability of NCCL test execution in environments where XDG_RUNTIME_DIR might not be pre-configured.

Highlights

  • NCCL Test Fix for A3H: Resolved a "Permission denied" error encountered when running NCCL tests on A3H machines by correctly configuring the XDG_RUNTIME_DIR environment variable for enroot.
Changelog
  • examples/machine-learning/a3-highgpu-8g/nccl-tests/import_pytorch_container.sh
    • Added conditional logic to check if XDG_RUNTIME_DIR is unset and, if so, attempts to set it to a user-specific directory in /run or falls back to a guaranteed writable location in /tmp.
    • Updated the commented PyTorch image version from 21.10-py3 to 23.10-py3.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 addresses a permission issue with enroot by setting the XDG_RUNTIME_DIR environment variable. However, the current implementation introduces a security vulnerability: the fallback mechanism creates a temporary directory in /tmp with a predictable name without proper ownership checks or error handling. This makes it susceptible to symlink attacks, allowing another user to pre-create the directory and potentially access sensitive runtime files. A suggested fix using mktemp -d has been provided in a review comment to create the directory securely and simplify the logic. This approach should also be considered for other similar scripts in the repository.

@agrawalkhushi18
Copy link
Copy Markdown
Contributor Author

These changes are working as intended in local build.

Copy link
Copy Markdown
Contributor

@SwarnaBharathiMantena SwarnaBharathiMantena left a comment

Choose a reason for hiding this comment

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

LGTM

@agrawalkhushi18 agrawalkhushi18 marked this pull request as ready for review March 9, 2026 09:24
@agrawalkhushi18 agrawalkhushi18 requested review from a team and samskillman as code owners March 9, 2026 09:24
@agrawalkhushi18 agrawalkhushi18 merged commit db31f62 into GoogleCloudPlatform:develop Mar 9, 2026
15 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