[Build] fix: nvidia dockerfile issues#1539
Conversation
Summary of ChangesHello @AlpinDale, 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 several build-related issues within the NVIDIA Dockerfile. It refines the CUDA architecture support for PyTorch, enables the installation of pre-release Python packages, and integrates Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request updates the NVIDIA Dockerfile to fix some build issues. The main changes include replacing nixl with gdrcopy for GPU-direct RDMA, updating CUDA architecture lists, and allowing pre-release package installations. The changes are generally good and address the intended issues. I've provided a couple of suggestions to improve the Dockerfile's maintainability and efficiency by reducing redundancy and optimizing layer creation.
| ARG GDRCOPY_CUDA_VERSION=12.8 | ||
| # Keep in line with FINAL_BASE_IMAGE | ||
| ARG GDRCOPY_OS_VERSION=Ubuntu22_04 |
There was a problem hiding this comment.
These ARG declarations for GDRCOPY_CUDA_VERSION and GDRCOPY_OS_VERSION are duplicated from lines 71-73. To improve maintainability and avoid potential inconsistencies where one is updated but not the other, consider defining these arguments globally before the first FROM statement.
For example:
ARG GDRCOPY_CUDA_VERSION=12.8
ARG GDRCOPY_OS_VERSION=Ubuntu22_04
...
FROM ... as base
ARG GDRCOPY_CUDA_VERSION
ARG GDRCOPY_OS_VERSION
...
FROM base as dev
ARG GDRCOPY_CUDA_VERSION
ARG GDRCOPY_OS_VERSION
...This way, the default values are defined in a single place, reducing redundancy and risk of error.
| COPY tools/install_gdrcopy.sh install_gdrcopy.sh | ||
| RUN set -eux; \ | ||
| case "${TARGETPLATFORM}" in \ | ||
| linux/arm64) UUARCH="aarch64" ;; \ | ||
| linux/amd64) UUARCH="x64" ;; \ | ||
| *) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" >&2; exit 1 ;; \ | ||
| esac; \ | ||
| ./install_gdrcopy.sh "${GDRCOPY_OS_VERSION}" "${GDRCOPY_CUDA_VERSION}" "${UUARCH}"; \ | ||
| rm ./install_gdrcopy.sh |
There was a problem hiding this comment.
The indentation of the COPY and RUN instructions here is misleading, as it suggests they are part of the preceding RUN command's shell script, but they are separate Dockerfile instructions. This should be fixed for clarity.
Additionally, using separate COPY and RUN commands for a temporary script adds an unnecessary layer to the Docker image because the file from the COPY layer is not removed from the final image, even with rm in the RUN layer. This can be optimized by using a single RUN command with a --mount=type=bind flag to make the script available temporarily without adding it to any image layers. This improves both clarity and image size.
RUN --mount=type=bind,source=tools/install_gdrcopy.sh,target=install_gdrcopy.sh \
set -eux; \
case "${TARGETPLATFORM}" in \
linux/arm64) UUARCH="aarch64" ;; \
linux/amd64) UUARCH="x64" ;; \
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" >&2; exit 1 ;; \
esac; \
./install_gdrcopy.sh "${GDRCOPY_OS_VERSION}" "${GDRCOPY_CUDA_VERSION}" "${UUARCH}"
No description provided.