Skip to content

Commit

Permalink
misc: upgrade cuda version and add devcontainer for manylinux (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
guocuimi authored Feb 26, 2025
1 parent 0737c85 commit e855f1f
Show file tree
Hide file tree
Showing 17 changed files with 156 additions and 96 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For more config options, see https://aka.ms/devcontainer.json.
{
"name": "cuda12.4",
"name": "devel:cu12.4",
"build": {
"dockerfile": "Dockerfile",
"args": {
Expand Down
44 changes: 44 additions & 0 deletions .devcontainer/manylinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG BASE_IMAGE=vectorchai/scalellm_manylinux:cuda12.4
FROM ${BASE_IMAGE}

ARG USER=vscode
ARG UID=1000
ARG GID=1000
ARG TORCH_VERSION=2.6.0
ARG CUDA_VERSION=12.4
ARG PYTHON_VERSION=3.12

# Run as non-root user
RUN groupadd --gid ${GID} ${USER} \
&& useradd --uid ${UID} --gid ${GID} -m ${USER} --shell /bin/bash
RUN echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}

# Install tools
RUN yum -y update && yum -y install \
htop \
vim \
jq \
gdb

# Choose python 3.12
ENV PATH="/opt/python/cp312-cp312/bin:$PATH"

# Install torch and other dependencies
RUN python -m pip install --upgrade pip
RUN pip install --upgrade pip
RUN pip install torch==$TORCH_VERSION -i "https://download.pytorch.org/whl/cu${CUDA_VERSION//./}"
RUN pip install numpy jinja2
RUN pip install --upgrade setuptools wheel

# Set up bash prompt
RUN cat <<EOT >> /home/${USER}/.bashrc
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\e[0;33m\]\u@\h \w\[\e[m\]\[\033[32m\]\$(parse_git_branch)\[\033[00m\]$ "
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
EOT

ENTRYPOINT [ "/usr/bin/bash" ]
69 changes: 69 additions & 0 deletions .devcontainer/manylinux/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// For more config options, see https://aka.ms/devcontainer.json.
{
"name": "manylinux:cu12.4",
"build": {
"dockerfile": "Dockerfile",
"args": {
"BASE_IMAGE": "vectorchai/scalellm_manylinux:cuda12.4",
"TORCH_VERSION": "2.6.0",
"CUDA_VERSION": "12.4",
"USER": "${localEnv:USER:vscode}",
"UID": "${localEnv:UID:1000}",
"GID": "${localEnv:GID:1000}"
}
},
// Access GPUs from inside the container
"runArgs": [
"--gpus=all"
],
// Environment variables passed to the container.
"containerEnv": {
"HUGGING_FACE_HUB_TOKEN": "${localEnv:HUGGING_FACE_HUB_TOKEN}"
},
// Run as the current user
"remoteUser": "${localEnv:USER:vscode}",
"containerUser": "${localEnv:USER:vscode}",
"updateRemoteUserUID": true,
// Ports should be forwarded from inside container to the local machine
"forwardPorts": [],
// For a full avaiable list, see https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/go:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"llvm-vs-code-extensions.vscode-clangd",
"ms-python.python",
"ms-azuretools.vscode-docker",
"ziruiwang.nvidia-monitor",
"mutantdino.resourcemonitor"
],
"settings": {
"extensions.verifySignature": false,
"terminal.integrated.defaultProfile.linux": "bash",
"C_Cpp.clang_format_sortIncludes": true,
"C_Cpp.default.intelliSenseMode": "linux-clang-x64",
"C_Cpp.default.cppStandard": "c++17",
"cmake.loggingLevel": "info",
"cmake.configureOnOpen": false,
"cmake.configureOnEdit": false,
"cmake.automaticReconfigure": true,
"cmake.ctest.allowParallelJobs": true,
"python.testing.pytestEnabled": true,
"python.analysis.inlayHints.pytestParameters": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"third_party/**": true,
"build/**": true
}
}
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
cuda: ["11.8", "12.1", "12.4"]
cuda: ["11.8", "12.4", "12.6"]
torch: ["2.4.1", "2.5.1", "2.6.0"]
runs-on: [self-hosted, linux, release]
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_devel_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda: ["12.1", "12.4", "12.6", "12.8"]
cuda: ["12.4", "12.6", "12.8"]
gcc: ["12"]
include: # build cuda 11.8 with gcc 11
- cuda: "11.8"
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish_manylinux_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@ jobs:
strategy:
fail-fast: false
matrix:
cuda: ["11.8", "12.1", "12.4", "12.6"]
cuda: ["11.8", "12.4", "12.6"]
runs-on: [self-hosted, linux, build]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
cache-image: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
cache-binary: false

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.devel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN if [ -n "${CMAKE_VERSION}" ]; then bash ./install_cmake.sh; fi
RUN rm install_cmake.sh
RUN cmake --version

ARG NINJA_VERSION=1.11.1
ARG NINJA_VERSION=1.12.1
COPY ./common/install_ninja.sh install_ninja.sh
RUN if [ -n "${NINJA_VERSION}" ]; then bash ./install_ninja.sh; fi
RUN rm install_ninja.sh
Expand Down
6 changes: 4 additions & 2 deletions docker/Dockerfile.manylinux
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8

# Install dependencies for vcpkg
# Install dependencies
RUN yum -y update && yum -y install \
zip \
unzip \
Expand All @@ -17,7 +17,9 @@ RUN yum -y update && yum -y install \
curl \
perl \
perl-IPC-Cmd \
sudo
sudo \
automake \
libtool

# Show versions of gcc, g++, nvcc
RUN gcc --version; g++ --version; nvcc --version
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.manylinux_2_28
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH
# RUN if [ -n "${CMAKE_VERSION}" ]; then bash ./install_cmake.sh; fi
# RUN rm install_cmake.sh

ARG NINJA_VERSION=1.11.1
ARG NINJA_VERSION=1.12.1
COPY ./common/install_ninja.sh install_ninja.sh
RUN if [ -n "${NINJA_VERSION}" ]; then bash ./install_ninja.sh; fi
RUN rm install_ninja.sh
Expand Down
6 changes: 4 additions & 2 deletions docker/common/install_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ install_ubuntu() {
jq \
libtool \
unzip \
gdb
gdb \
automake

# Cleanup package manager
apt-get autoclean && apt-get clean
Expand All @@ -39,7 +40,8 @@ install_almalinux() {
vim \
jq \
libtool \
unzip
unzip \
automake

# Cleanup
yum clean all
Expand Down
3 changes: 2 additions & 1 deletion docker/common/install_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ command -v pip3 >/dev/null && pip3 uninstall -y cmake
rm -f /usr/local/bin/cmake

path="v${CMAKE_VERSION}"
file="cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz"
ARCH=$(uname -m)
file="cmake-${CMAKE_VERSION}-linux-${ARCH}.tar.gz"

# Download and install specific CMake version in /usr/local
pushd /tmp
Expand Down
Loading

0 comments on commit e855f1f

Please sign in to comment.