Skip to content

Commit

Permalink
speed up GitHub Actions (#2822)
Browse files Browse the repository at this point in the history
This PR speeds up multiple GitHub Actions in the following way:

- only install `cuda-nvcc` and `cuda-cudart-dev` instead of the whole
cudatoolkit
- skip installing clang as it's already shipped with the GitHub Action
image
- enable cache for all `setup-python`
- use Ninja instead of Make as the CMake generator

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Sep 15, 2023
1 parent 1a4a7ca commit 20a41d0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: sudo apt-get update && sudo apt-get install -y nvidia-cuda-toolkit
- run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
&& sudo apt-get update \
&& sudo apt-get -y install cuda-cudart-dev-11-8 cuda-nvcc-11-8
if: matrix.variant == 'cuda'
- run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
&& sudo apt-get update \
&& sudo apt-get -y install cuda-12-0
&& sudo apt-get -y install cuda-cudart-dev-12-0 cuda-nvcc-12-0
if: matrix.variant == 'cuda120'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -44,19 +50,19 @@ jobs:
&& sudo apt-get update \
&& sudo apt-get install -y rocm-dev hipcub-dev
if: matrix.variant == 'rocm'
- run: sudo apt-get update && sudo apt-get install -y clang
if: matrix.variant == 'clang'
- run: source/install/build_cc.sh
env:
DP_VARIANT: ${{ matrix.dp_variant }}
DOWNLOAD_TENSORFLOW: "FALSE"
CMAKE_GENERATOR: Ninja
if: matrix.variant != 'clang'
- run: source/install/build_cc.sh
env:
DP_VARIANT: cpu
DOWNLOAD_TENSORFLOW: "FALSE"
CC: clang
CXX: clang++
CMAKE_GENERATOR: Ninja
if: matrix.variant == 'clang'
- name: Test files exist
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
name: Install Python
with:
python-version: '3.11'
cache: 'pip'
- run: python -m pip install build
- name: Build sdist
run: python -m build --sdist
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Setup MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: mpich
- uses: lukka/get-cmake@latest
- run: python -m pip install tensorflow
- run: source/install/test_cc_local.sh
env:
OMP_NUM_THREADS: 1
TF_INTRA_OP_PARALLELISM_THREADS: 1
TF_INTER_OP_PARALLELISM_THREADS: 1
LMP_CXX11_ABI_0: 1
CMAKE_GENERATOR: Ninja
# test lammps
# ASE issue: https://gitlab.com/ase/ase/-/merge_requests/2843
# TODO: remove ase version when ase has new release
Expand Down
4 changes: 2 additions & 2 deletions source/install/build_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build
mkdir -p ${BUILD_TMP_DIR}
cd ${BUILD_TMP_DIR}
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DUSE_TF_PYTHON_LIBS=TRUE ${CUDA_ARGS} -DLAMMPS_VERSION=stable_2Aug2023 ..
make -j${NPROC}
make install
cmake --build . -j${NPROC}
cmake --install .

#------------------
echo "Congratulations! DeePMD-kit has been installed at ${INSTALL_PREFIX}"
6 changes: 3 additions & 3 deletions source/install/build_from_c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build
mkdir -p ${BUILD_TMP_DIR}
cd ${BUILD_TMP_DIR}
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DDEEPMD_C_ROOT=${DEEPMD_C_ROOT} -DLAMMPS_VERSION=stable_2Aug2023 ..
make -j${NPROC}
make install
make lammps
cmake --build . -j${NPROC}
cmake --install .
cmake --build . --target=lammps

#------------------
echo "Congratulations! DeePMD-kit has been installed at ${INSTALL_PREFIX}"
4 changes: 2 additions & 2 deletions source/install/package_c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DPACKAGE_C=TRUE \
-DUSE_TF_PYTHON_LIBS=TRUE \
..
make -j${NPROC}
make install
cmake --build . -j${NPROC}
cmake --install .

#------------------

Expand Down
4 changes: 2 additions & 2 deletions source/install/test_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build_tests
mkdir -p ${BUILD_TMP_DIR}
cd ${BUILD_TMP_DIR}
cmake -DINSTALL_TENSORFLOW=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DTENSORFLOW_ROOT=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
make -j${NPROC}
make install
cmake --build . -j${NPROC}
cmake --install .

#------------------
# go to a subdirectory...
Expand Down
4 changes: 2 additions & 2 deletions source/install/test_cc_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ BUILD_TMP_DIR=${SCRIPT_PATH}/../build_tests
mkdir -p ${BUILD_TMP_DIR}
cd ${BUILD_TMP_DIR}
cmake -DINSTALL_TENSORFLOW=FALSE -DUSE_TF_PYTHON_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
make -j${NPROC}
make install
cmake --build . -j${NPROC}
cmake --install .

#------------------
# go to a subdirectory...
Expand Down

0 comments on commit 20a41d0

Please sign in to comment.