Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into cleanup-test-configs
  • Loading branch information
IlyasMoutawwakil committed Mar 27, 2024
2 parents 173ee9b + dfd1887 commit eff98cb
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 18 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build Images

on:
workflow_dispatch:
push:
paths:
- "docker/**"
- ".github/workflows/build_images.yaml"

schedule:
- cron: "0 0 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build_cuda_images:
strategy:
fail-fast: false
matrix:
image:
[
{ torch_cuda: cu118, torch_pre_release: 0, cuda_version: 11.8.0 },
{ torch_cuda: cu121, torch_pre_release: 0, cuda_version: 12.1.1 },
]

runs-on: [single-gpu, nvidia-gpu, a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Build image
uses: docker/build-push-action@v5
with:
push: false
file: docker/cuda.dockerfile
tags: opt-bench-cuda:${{ matrix.image.cuda_version }}
cache-from: type=local,src=/mnt/hf_cache/opt_bench_cache/,mode=min
cache-to: type=local,dest=/mnt/hf_cache/opt_bench_cache/,mode=min
build-args: |
TORCH_CUDA=${{ matrix.image.torch_cuda }}
CUDA_VERSION=${{ matrix.image.cuda_version }}
TORCH_PRE_RELEASE=${{ matrix.image.torch_pre_release }}
build_rocm_images:
strategy:
fail-fast: false
matrix:
image:
[{ torch_rocm: rocm5.7, torch_pre_release: 0, rocm_version: 5.7.1 }]

runs-on: [amd-gpu]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build image
run: docker build
--file docker/rocm.dockerfile
--build-arg USER_ID=$(id -u)
--build-arg GROUP_ID=$(id -g)
--build-arg TORCH_ROCM=${{ matrix.image.torch_rocm }}
--build-arg ROCM_VERSION=${{ matrix.image.rocm_version }}
--build-arg TORCH_PRE_RELEASE=${{ matrix.image.torch_pre_release }}
--tag opt-bench-rocm:${{ matrix.image.rocm_version }}
.
18 changes: 0 additions & 18 deletions docker/cuda.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ ARG TORCH_CUDA=cu121
# Ignore interactive questions during `docker build`
ENV DEBIAN_FRONTEND noninteractive

# Run as non-root user
ARG USER_ID
ARG GROUP_ID

RUN addgroup --gid $GROUP_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user

# Install python
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 \
Expand All @@ -41,17 +34,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rm -rf /var/lib/apt/lists/* && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1

# Add local bin to PATH
ENV PATH="/home/user/.local/bin:${PATH}"

# Add user to sudoers
RUN adduser user sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

# Change user
USER user
WORKDIR /home/user

# Update pip
RUN pip install --upgrade pip

Expand Down

0 comments on commit eff98cb

Please sign in to comment.