Skip to content

Commit

Permalink
Linux cuda separate cpu instruction and enable sccache (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Hien To <[email protected]>
  • Loading branch information
hiento09 and hiento09 authored Jun 17, 2024
1 parent cb0db39 commit ac43c71
Show file tree
Hide file tree
Showing 7 changed files with 285 additions and 119 deletions.
21 changes: 15 additions & 6 deletions .github/runners/actions-runner-ubuntu-cuda-11-7.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Use NVIDIA CUDA 12.0.0 development image with Ubuntu 18.04 as the base
FROM nvidia/cuda:11.7.1-devel-ubuntu18.04
FROM nvidia/cuda:11.7.1-devel-ubuntu20.04

ARG RUNNER_VERSION=2.311.0
# Docker and Docker Compose arguments

# Use 1001 and 121 for compatibility with GitHub-hosted runners
Expand Down Expand Up @@ -43,13 +42,21 @@ RUN apt-get update -y \
wget \
lsb-release \
openssl \
libssl-dev \
manpages-dev \
zip \
zstd \
pkg-config \
ccache \
cargo \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& rm -rf /var/lib/apt/lists/*

RUN cargo install sccache --locked

RUN chmod +x /root/.cargo/bin/sccache && cp /root/.cargo/bin/sccache /usr/local/bin/sccache

# Add Kitware's APT repository for CMake
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \
Expand Down Expand Up @@ -84,20 +91,22 @@ RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \

ENV HOME=/home/runner

ARG RUNNER_VERSION=2.317.0

# cd into the user directory, download and unzip the github actions runner
RUN cd /home/runner && mkdir actions-runner && cd actions-runner \
&& curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz

RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh

ADD start.sh start.sh
ADD ./start.sh /home/runner/start.sh

RUN chmod +x start.sh
RUN chmod +x /home/runner/start.sh

# Add /usr/local/cuda-11.7/compat to LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.7/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

USER runner
ENTRYPOINT ["/bin/bash", "/home/runner/start.sh"]

ENTRYPOINT ["./start.sh"]
USER runner
25 changes: 17 additions & 8 deletions .github/runners/actions-runner-ubuntu-cuda-12-0.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Use NVIDIA CUDA 12.0.0 development image with Ubuntu 18.04 as the base
FROM nvidia/cuda:12.0.0-devel-ubuntu18.04
FROM nvidia/cuda:12.0.0-devel-ubuntu20.04

ARG RUNNER_VERSION=2.311.0
# Docker and Docker Compose arguments

# Use 1001 and 121 for compatibility with GitHub-hosted runners
Expand Down Expand Up @@ -43,13 +42,21 @@ RUN apt-get update -y \
wget \
lsb-release \
openssl \
libssl-dev \
manpages-dev \
zip \
zstd \
pkg-config \
ccache \
cargo \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& rm -rf /var/lib/apt/lists/*

RUN cargo install sccache --locked

RUN chmod +x /root/.cargo/bin/sccache && cp /root/.cargo/bin/sccache /usr/local/bin/sccache

# Add Kitware's APT repository for CMake
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && \
Expand All @@ -75,6 +82,8 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get install -y --no-install-recommends git-lfs

ARG RUNNER_VERSION=2.317.0

RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \
&& groupadd docker --gid $DOCKER_GID \
&& usermod -aG sudo runner \
Expand All @@ -91,13 +100,13 @@ RUN cd /home/runner && mkdir actions-runner && cd actions-runner \

RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh

ADD start.sh start.sh
ADD ./start.sh /home/runner/start.sh

RUN chmod +x start.sh
RUN chmod +x /home/runner/start.sh

# Add /usr/local/cuda-12.0/compat to LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=/usr/local/cuda-12.0/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# Add /usr/local/cuda-11.7/compat to LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.7/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

USER runner
ENTRYPOINT ["/bin/bash", "/home/runner/start.sh"]

ENTRYPOINT ["./start.sh"]
USER runner
89 changes: 63 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,52 +61,84 @@ jobs:
include:
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-vulkan"
runs-on: "ubuntu-18-04-cuda-11-7"
cmake-flags: "-DLLAMA_VULKAN=ON -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_VULKAN=ON -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: true
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-cuda-11-7"
runs-on: "ubuntu-18-04-cuda-11-7"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON"
name: "amd64-avx2-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-cuda-12-0"
runs-on: "ubuntu-18-04-cuda-12-0"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON"
name: "amd64-avx-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx2-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "mac"
name: "amd64"
runs-on: "macos-13"
Expand Down Expand Up @@ -252,6 +284,11 @@ jobs:
run: |
choco install make sccache ninja -y
- name: Install ninja build on Linux
if: runner.os == 'Linux'
run: |
sudo apt install ninja-build -y
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: ilammy/[email protected]
Expand Down
89 changes: 63 additions & 26 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,52 +62,84 @@ jobs:
include:
- os: "linux"
name: "amd64-avx2"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: true
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512"
runs-on: "ubuntu-18-04"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-vulkan"
runs-on: "ubuntu-18-04-cuda-11-7"
cmake-flags: "-DLLAMA_VULKAN=ON -DLLAMA_NATIVE=OFF"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_VULKAN=ON -DLLAMA_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: true
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-cuda-11-7"
runs-on: "ubuntu-18-04-cuda-11-7"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON"
name: "amd64-avx2-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-cuda-12-0"
runs-on: "ubuntu-18-04-cuda-12-0"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON"
name: "amd64-avx-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: false
sccache-conf-path: ""
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512-cuda-11-7"
runs-on: "ubuntu-20-04-cuda-11-7"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx2-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_AVX2=OFF -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "linux"
name: "amd64-avx512-cuda-12-0"
runs-on: "ubuntu-20-04-cuda-12-0"
cmake-flags: "-DLLAMA_AVX512=ON -DLLAMA_NATIVE=OFF -DLLAMA_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja"
run-e2e: false
vulkan: false
sccache: true
sccache-conf-path: "/tmp/sccache.conf"
- os: "mac"
name: "amd64"
runs-on: "macos-13"
Expand Down Expand Up @@ -253,6 +285,11 @@ jobs:
run: |
choco install make sccache ninja -y
- name: Install ninja build on Linux
if: runner.os == 'Linux'
run: |
sudo apt install ninja-build -y
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: ilammy/[email protected]
Expand Down
Loading

0 comments on commit ac43c71

Please sign in to comment.