From af58d29be64787cbacebcdd8a61873bba2473cea Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 06:41:05 -0400 Subject: [PATCH 1/6] speed up cuda120 and clang Signed-off-by: Jinzhe Zeng --- .github/workflows/build_cc.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cc.yml b/.github/workflows/build_cc.yml index 500b305ba9..9931455ded 100644 --- a/.github/workflows/build_cc.yml +++ b/.github/workflows/build_cc.yml @@ -26,6 +26,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: '3.11' + cache: 'pip' - run: python -m pip install tensorflow - run: sudo apt-get update && sudo apt-get install -y nvidia-cuda-toolkit if: matrix.variant == 'cuda' @@ -33,7 +34,7 @@ jobs: 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 @@ -44,8 +45,6 @@ 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 }} From 15070326d308c75d438518e64c5c965c997fa48c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 06:43:56 -0400 Subject: [PATCH 2/6] cache setup-python Signed-off-by: Jinzhe Zeng --- .github/workflows/build_wheel.yml | 1 + .github/workflows/test_cc.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 3e3a265159..85b2d6b884 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -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 diff --git a/.github/workflows/test_cc.yml b/.github/workflows/test_cc.yml index 9404f12937..3231005aad 100644 --- a/.github/workflows/test_cc.yml +++ b/.github/workflows/test_cc.yml @@ -11,6 +11,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: '3.11' + cache: 'pip' - name: Setup MPI uses: mpi4py/setup-mpi@v1 with: From 722569dec5badabfb27bd9402faace02d565f687 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 07:28:01 -0400 Subject: [PATCH 3/6] use ninja Signed-off-by: Jinzhe Zeng --- .github/workflows/build_cc.yml | 3 +++ .github/workflows/test_cc.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/build_cc.yml b/.github/workflows/build_cc.yml index 9931455ded..e5f1bca0f8 100644 --- a/.github/workflows/build_cc.yml +++ b/.github/workflows/build_cc.yml @@ -27,6 +27,7 @@ jobs: 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 if: matrix.variant == 'cuda' @@ -49,6 +50,7 @@ jobs: env: DP_VARIANT: ${{ matrix.dp_variant }} DOWNLOAD_TENSORFLOW: "FALSE" + CMAKE_GENERATOR: ninja if: matrix.variant != 'clang' - run: source/install/build_cc.sh env: @@ -56,6 +58,7 @@ jobs: DOWNLOAD_TENSORFLOW: "FALSE" CC: clang CXX: clang++ + CMAKE_GENERATOR: ninja if: matrix.variant == 'clang' - name: Test files exist run: | diff --git a/.github/workflows/test_cc.yml b/.github/workflows/test_cc.yml index 3231005aad..7c1144208f 100644 --- a/.github/workflows/test_cc.yml +++ b/.github/workflows/test_cc.yml @@ -16,6 +16,7 @@ jobs: 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: @@ -23,6 +24,7 @@ jobs: 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 From 70efd2dc9f8c2e378591aa2784161f29b38d64f9 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 07:35:30 -0400 Subject: [PATCH 4/6] install cuda 11.8 in the same way Signed-off-by: Jinzhe Zeng --- .github/workflows/build_cc.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_cc.yml b/.github/workflows/build_cc.yml index e5f1bca0f8..0075459450 100644 --- a/.github/workflows/build_cc.yml +++ b/.github/workflows/build_cc.yml @@ -29,7 +29,11 @@ jobs: 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 \ From ff2e7c7176427304fb86198be37f061873b9eb7d Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 08:35:19 -0400 Subject: [PATCH 5/6] Ninja should be uppercase Signed-off-by: Jinzhe Zeng --- .github/workflows/build_cc.yml | 4 ++-- .github/workflows/test_cc.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cc.yml b/.github/workflows/build_cc.yml index 0075459450..55a5a5c4d8 100644 --- a/.github/workflows/build_cc.yml +++ b/.github/workflows/build_cc.yml @@ -54,7 +54,7 @@ jobs: env: DP_VARIANT: ${{ matrix.dp_variant }} DOWNLOAD_TENSORFLOW: "FALSE" - CMAKE_GENERATOR: ninja + CMAKE_GENERATOR: Ninja if: matrix.variant != 'clang' - run: source/install/build_cc.sh env: @@ -62,7 +62,7 @@ jobs: DOWNLOAD_TENSORFLOW: "FALSE" CC: clang CXX: clang++ - CMAKE_GENERATOR: ninja + CMAKE_GENERATOR: Ninja if: matrix.variant == 'clang' - name: Test files exist run: | diff --git a/.github/workflows/test_cc.yml b/.github/workflows/test_cc.yml index 7c1144208f..fa37009730 100644 --- a/.github/workflows/test_cc.yml +++ b/.github/workflows/test_cc.yml @@ -24,7 +24,7 @@ jobs: TF_INTRA_OP_PARALLELISM_THREADS: 1 TF_INTER_OP_PARALLELISM_THREADS: 1 LMP_CXX11_ABI_0: 1 - CMAKE_GENERATOR: ninja + CMAKE_GENERATOR: Ninja # test lammps # ASE issue: https://gitlab.com/ase/ase/-/merge_requests/2843 # TODO: remove ase version when ase has new release From 6bf51ed04c8675920a75304c12bcb83730ccd432 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 12 Sep 2023 09:03:05 -0400 Subject: [PATCH 6/6] update scripts to be able to use any generator Signed-off-by: Jinzhe Zeng --- source/install/build_cc.sh | 4 ++-- source/install/build_from_c.sh | 6 +++--- source/install/package_c.sh | 4 ++-- source/install/test_cc.sh | 4 ++-- source/install/test_cc_local.sh | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/install/build_cc.sh b/source/install/build_cc.sh index 7cb9ca38ad..bfa3cd1ce4 100755 --- a/source/install/build_cc.sh +++ b/source/install/build_cc.sh @@ -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}" diff --git a/source/install/build_from_c.sh b/source/install/build_from_c.sh index b64a62eaff..3a48d3d46c 100755 --- a/source/install/build_from_c.sh +++ b/source/install/build_from_c.sh @@ -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}" diff --git a/source/install/package_c.sh b/source/install/package_c.sh index c250956e19..0c145b22af 100755 --- a/source/install/package_c.sh +++ b/source/install/package_c.sh @@ -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 . #------------------ diff --git a/source/install/test_cc.sh b/source/install/test_cc.sh index 6da5962899..55fe03bad8 100755 --- a/source/install/test_cc.sh +++ b/source/install/test_cc.sh @@ -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... diff --git a/source/install/test_cc_local.sh b/source/install/test_cc_local.sh index 5a400a15c2..ec1bfadd69 100755 --- a/source/install/test_cc_local.sh +++ b/source/install/test_cc_local.sh @@ -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...