diff --git a/.github/workflows/test_cuda.yml b/.github/workflows/test_cuda.yml index adc20c27a9..7b95e6d37b 100644 --- a/.github/workflows/test_cuda.yml +++ b/.github/workflows/test_cuda.yml @@ -9,13 +9,19 @@ jobs: test_cuda: name: Test Python and C++ on CUDA runs-on: nvidia + # https://github.com/deepmodeling/deepmd-kit/pull/2884#issuecomment-1744216845 + container: + image: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + options: --gpus all if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA' || github.event_name == 'workflow_dispatch' steps: + - name: Make sudo and git work + run: apt-get update && apt-get install -y sudo git - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: '3.11' - cache: 'pip' + # cache: 'pip' - name: Setup MPI uses: mpi4py/setup-mpi@v1 with: @@ -26,14 +32,17 @@ jobs: && sudo dpkg -i cuda-keyring_1.0-1_all.deb \ && sudo apt-get update \ && sudo apt-get -y install cuda-11-8 libcudnn8=8.9.5.*-1+cuda11.8 + if: false # skip as we use nvidia image + - name: Set PyPI mirror for Aliyun cloud machine + run: python -m pip config --user set global.index-url https://mirrors.aliyun.com/pypi/simple/ - run: python -m pip install -U "pip>=21.3.1,!=23.0.0" - - run: pip install -v -e .[gpu,test,lmp,cu11] "ase @ https://github.com/rosswhitfield/ase/archive/edd03571aff6944b77b4a4b055239f3c3e4eeb66.zip" + - run: python -m pip install -v -e .[gpu,test,lmp,cu11] "ase @ https://github.com/rosswhitfield/ase/archive/edd03571aff6944b77b4a4b055239f3c3e4eeb66.zip" env: DP_BUILD_TESTING: 1 DP_VARIANT: cuda CUDA_PATH: /usr/local/cuda-11.8 - run: dp --version - - run: pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0 + - run: python -m pytest -s --cov=deepmd --cov=deepmd_cli source/tests --durations=0 - run: source/install/test_cc_local.sh env: OMP_NUM_THREADS: 1 @@ -45,10 +54,10 @@ jobs: DP_USE_MPICH2: 1 CUDA_PATH: /usr/local/cuda-11.8 - run: | - export LD_LIBRARY_PATH=${{ github.workspace }}/dp_test/lib:$CUDA_PATH/lib64:$LD_LIBRARY_PATH - export PATH=${{ github.workspace }}/dp_test/bin:$PATH - pytest -s --cov=deepmd source/lmp/tests - pytest -s --cov=deepmd source/ipi/tests + export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/dp_test/lib:$CUDA_PATH/lib64:$LD_LIBRARY_PATH + export PATH=$GITHUB_WORKSPACE/dp_test/bin:$PATH + python -m pytest -s --cov=deepmd source/lmp/tests + python -m pytest -s --cov=deepmd source/ipi/tests env: OMP_NUM_THREADS: 1 TF_INTRA_OP_PARALLELISM_THREADS: 1