Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Accerate GitHub Actions using uv #3676

Merged
merged 11 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: python -m pip install uv
- run: python -m uv pip install --system tensorflow
- name: Download libtorch
run: |
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.2%2Bcpu.zip -O libtorch.zip
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
with:
mpi: mpich
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: python -m pip install uv
- run: python -m uv pip install --system tensorflow
- name: Download libtorch
run: |
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.2%2Bcpu.zip -O libtorch.zip
Expand All @@ -49,8 +50,8 @@ jobs:
# ASE issue: https://gitlab.com/ase/ase/-/merge_requests/2843
# TODO: remove ase version when ase has new release
- run: |
python -m pip install -U pip
python -m pip install -e .[cpu,test,lmp] mpi4py "ase @ https://gitlab.com/ase/ase/-/archive/8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f/ase-8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f.tar.gz"
export TENSORFLOW_ROOT=$(python -c 'import importlib,pathlib;print(pathlib.Path(importlib.util.find_spec("tensorflow").origin).parent)')
python -m uv pip install --system -e .[cpu,test,lmp] mpi4py "ase @ https://gitlab.com/ase/ase/-/archive/8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f/ase-8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f.tar.gz"
env:
DP_BUILD_TESTING: 1
if: ${{ !matrix.check_memleak }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ jobs:
&& sudo apt-get update \
&& sudo apt-get -y install cuda-12-3 libcudnn8=8.9.5.*-1+cuda12.3
if: false # skip as we use nvidia image
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
- run: python -m pip install "tensorflow>=2.15.0rc0" "torch>=2.2.0"
- run: python -m pip install -v -e .[gpu,test,lmp,cu12,torch] mpi4py "ase @ https://gitlab.com/ase/ase/-/archive/8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f/ase-8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f.tar.gz"
- run: python -m pip install -U uv
- run: python -m uv pip install --system "tensorflow>=2.15.0rc0" "torch>=2.2.0"
- run: |
export TENSORFLOW_ROOT=$(python -c 'import importlib,pathlib;print(pathlib.Path(importlib.util.find_spec("tensorflow").origin).parent)')
python -m uv pip install --system -v -e .[gpu,test,lmp,cu12,torch] mpi4py "ase @ https://gitlab.com/ase/ase/-/archive/8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f/ase-8c5aa5fd6448c5cfb517a014dccf2b214a9dfa8f.tar.gz"
env:
DP_VARIANT: cuda
DP_ENABLE_NATIVE_OPTIMIZATION: 1
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- uses: mpi4py/setup-mpi@v1
with:
mpi: openmpi
# https://github.com/pypa/pip/issues/11770
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
- run: pip install -e .[cpu,test,torch]
- run: python -m pip install -U uv
- run: uv pip install --system -e .[cpu,test,torch]
env:
# Please note that uv has some issues with finding
# existing TensorFlow package. Currently, it uses
# TensorFlow in the build dependency, but if it
# changes, setting `TENSORFLOW_ROOT`.
TENSORFLOW_VERSION: ${{ matrix.tf }}
DP_BUILD_TESTING: 1
- run: pip install horovod mpi4py
- run: uv pip install --system --no-build-isolation horovod mpi4py
env:
HOROVOD_WITH_TENSORFLOW: 1
HOROVOD_WITHOUT_PYTORCH: 1
Expand Down
8 changes: 5 additions & 3 deletions source/install/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM python:3.11 AS compile-image
ARG VARIANT=""
ARG CUDA_VERSION="12"
RUN python -m venv /opt/deepmd-kit
RUN python -m pip install uv
RUN python -m uv venv /opt/deepmd-kit
# Make sure we use the virtualenv
ENV PATH="/opt/deepmd-kit/bin:$PATH"
ENV VIRTUAL_ENV="/opt/deepmd-kit"
# Install package
COPY dist /dist
RUN if [ "${CUDA_VERSION}" = 11 ]; then pip install torch --index-url https://download.pytorch.org/whl/cu118; fi \
&& pip install "$(ls /dist/deepmd_kit${VARIANT}-*manylinux*_x86_64.whl)[gpu,cu${CUDA_VERSION},lmp,ipi,torch]" \
RUN if [ "${CUDA_VERSION}" = 11 ]; then uv pip install torch --index-url https://download.pytorch.org/whl/cu118; fi \
&& uv pip install "$(ls /dist/deepmd_kit${VARIANT}-*manylinux*_x86_64.whl)[gpu,cu${CUDA_VERSION},lmp,ipi,torch]" \
&& dp -h \
&& lmp -h \
&& dp_ipi \
Expand Down
Loading