From d9df710e02232f26900a6c4d39e82e1c38ce0eee Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 17 Aug 2022 00:54:56 -0400 Subject: [PATCH 1/3] revert prod_force OMP in #1360 Sometimes when box is quite small (i.e. box size < 2 * rcut), the same atom may repeat to appear in the neighbor list. This cause inaccurate results when using OMP. --- source/lib/src/prod_force.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/lib/src/prod_force.cc b/source/lib/src/prod_force.cc index 626b572b00..7da5cc11e1 100644 --- a/source/lib/src/prod_force.cc +++ b/source/lib/src/prod_force.cc @@ -37,17 +37,14 @@ prod_force_a_cpu( memset(force, 0, sizeof(FPTYPE) * nall * 3); // compute force of a frame - #pragma omp parallel for (int i_idx = start_index; i_idx < start_index + nloc; ++i_idx) { // deriv wrt center atom - #pragma omp single for (int aa = 0; aa < ndescrpt; ++aa) { force[i_idx * 3 + 0] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 0]; force[i_idx * 3 + 1] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 1]; force[i_idx * 3 + 2] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 2]; } // deriv wrt neighbors - #pragma omp for for (int jj = 0; jj < nnei; ++jj) { int j_idx = nlist[i_idx * nnei + jj]; if (j_idx < 0) continue; @@ -111,18 +108,15 @@ prod_force_r_cpu( } // compute force of a frame - #pragma omp parallel for (int ii = 0; ii < nloc; ++ii){ int i_idx = ii; // deriv wrt center atom - #pragma omp single for (int aa = 0; aa < ndescrpt; ++aa){ force[i_idx * 3 + 0] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 0]; force[i_idx * 3 + 1] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 1]; force[i_idx * 3 + 2] -= net_deriv[i_idx * ndescrpt + aa] * env_deriv[i_idx * ndescrpt * 3 + aa * 3 + 2]; } // deriv wrt neighbors - #pragma omp for for (int jj = 0; jj < nnei; ++jj){ int j_idx = nlist[i_idx * nnei + jj]; // if (j_idx > nloc) j_idx = j_idx % nloc; From 4da90149de0734501d3809842ec7552735b93f91 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 17 Aug 2022 01:35:47 -0400 Subject: [PATCH 2/3] do not update pip Signed-off-by: Jinzhe Zeng --- .github/workflows/test_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index f66665c116..639a2588a8 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -62,7 +62,7 @@ jobs: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - - run: python -m pip install -U pip>=21.3.1 + #- run: python -m pip install -U pip>=21.3.1 - run: pip install -e .[cpu,test] codecov env: CC: gcc-${{ matrix.gcc }} From a5f672ed8eb2d7d010703a8f99a18e48752e247e Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Wed, 17 Aug 2022 02:02:18 -0400 Subject: [PATCH 3/3] revert pining pip; setting env for setuptools>=64 Signed-off-by: Jinzhe Zeng --- .github/workflows/test_python.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index 639a2588a8..962fd8ccab 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -62,11 +62,12 @@ jobs: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - #- run: python -m pip install -U pip>=21.3.1 + - run: python -m pip install -U pip>=21.3.1 - run: pip install -e .[cpu,test] codecov env: CC: gcc-${{ matrix.gcc }} CXX: g++-${{ matrix.gcc }} TENSORFLOW_VERSION: ${{ matrix.tf }} + SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" - run: dp --version - run: pytest --cov=deepmd source/tests && codecov