-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fb9155
commit da5db77
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Start with a base image that includes CUDA | ||
FROM nvidia/cuda:11.3.1-cudnn8-runtime-ubuntu20.04 | ||
|
||
# Label the image | ||
LABEL description="Python 3.11 with PyTorch, CUDA support, and a user named ci with sudo access" | ||
|
||
# Install necessary packages for Python 3.11 and sudo | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends software-properties-common sudo && \ | ||
add-apt-repository ppa:deadsnakes/ppa && \ | ||
apt-get update && \ | ||
apt-get install -y python3.11 python3.11-venv python3.11-dev python3-pip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a non-root user 'ci' with a password and give sudo privileges | ||
RUN useradd -ms /bin/bash ci && \ | ||
echo 'ci:password' | chpasswd && \ | ||
echo 'ci ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/ci | ||
|
||
# Switch to user 'ci' | ||
USER ci | ||
WORKDIR /home/ci | ||
|
||
# Set up the virtual environment in user's home directory | ||
RUN python3.11 -m venv venv | ||
ENV PATH="/home/ci/venv/bin:$PATH" | ||
|
||
# Install PyTorch with CUDA support | ||
RUN pip install --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-linux-gpu: | ||
runs-on: self-hosted | ||
strategy: | ||
fail-fast: false | ||
# matrix: | ||
# python-version: ["3.9"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Run Tests | ||
run: | | ||
docker run -u ci:ci --gpus all --rm -v ${{ github.workspace }}:/app cuda11_py11:latest \ | ||
bash -c "cd /app && \ | ||
sudo bash ./.github/workflows/setup_env.sh && \ | ||
pip install -e . && \ | ||
python -m unittest discover tests" | ||
- name: Display Speed Test | ||
run: cat speed_test.txt | ||
|
||
|
||
- name: Upload Test Results as Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: speed-test-results | ||
path: speed_test.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
apt-get update | ||
apt-get install -y libx11-6 libgl1-mesa-glx libxrender1 libglu1-mesa libglib2.0-0 libegl1-mesa-dev libgles2-mesa-dev libosmesa6-dev |