From 4e3e4b6b164a704ef9b276a13b54f868f455c0f7 Mon Sep 17 00:00:00 2001 From: mrL <1417558386@qq.com> Date: Sun, 2 Aug 2026 00:05:01 +0800 Subject: [PATCH 1/2] ci(test): run module unittests and integration suites in parallel The test workflow executed 16 module-unittest steps plus 10 integration suite steps fully serially - measured ~18-21 min of wall time even when the Build step only takes ~3 min with a warm ccache. - Merge the 16 MODULE_* steps into one 'ctest -j $(nproc) -R MODULE_' invocation (PERF_MODULE_HSOLVER_KERNELS still excluded). - Merge the 10 integration suite steps into one 'ctest -j 4' invocation. Each suite is an independent ctest entry running Autotest.sh in its own tests/ directory, so they can run concurrently. -j4 is used instead of nproc to avoid extreme oversubscription, since every suite already spawns MPI ranks with OMP_NUM_THREADS=2. Test selection is unchanged (same -R/-E filters). Expected: the test portion drops from ~18-21 min to ~6-8 min of wall time. --- .github/workflows/test.yml | 178 +++---------------------------------- 1 file changed, 13 insertions(+), 165 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 18b0b1a7a8..f7f45aabc9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -120,180 +120,28 @@ jobs: run: | ctest --test-dir build -V --timeout 1700 -R integrated_test - - name: Module_Base Unittests + - name: All Module Unittests env: GTEST_COLOR: 'yes' OMP_NUM_THREADS: '2' run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_BASE + # Run all module unit tests in one parallel ctest invocation + # instead of 16 serial steps (measured ~4.5 min serial). + ctest --test-dir build -V --timeout 1700 -j "$(nproc)" \ + -R 'MODULE_' -E PERF_MODULE_HSOLVER_KERNELS - - name: Module_IO Unittests + - name: Integration Test Suites env: GTEST_COLOR: 'yes' OMP_NUM_THREADS: '2' run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_IO - - - name: Module_HSolver Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_HSOLVER -E PERF_MODULE_HSOLVER_KERNELS - - - name: Module_Cell Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_CELL - - - name: Module_MD Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_MD - - - name: Module_Psi Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_PSI - - - name: Module_RI Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_RI - - - name: Module_Estate Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_ESTATE - - - name: Module_Hamilt Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_HAMILT - - - name: Module_PW Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_PW - - - name: Module_LCAO Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_LCAO - - - name: Module_AO Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_AO - - - name: Module_NAO Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_NAO - - - name: Module_RELAX Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_RELAX - - - name: Module_LR Unittests - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R MODULE_LR - - - name: 01_PW Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 01_PW - - - name: 02_NAO_Gamma Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 02_NAO_Gamma - - - name: 03_NAO_multik Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 03_NAO_multik - - - name: 04_FF Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 04_FF - - - name: 05_rtTDDFT Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 05_rtTDDFT - - - name: 06_SDFT Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 06_SDFT - - - name: 07_OFDFT Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 07_OFDFT - - - name: 08_EXX Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 08_EXX - - - name: 09_DeePKS Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 09_DeePKS - - - name: 10_others Test - env: - GTEST_COLOR: 'yes' - OMP_NUM_THREADS: '2' - run: | - ctest --test-dir build -V --timeout 1700 -R 10_others + # The 10 integration suites are independent ctest entries (each + # runs Autotest.sh in its own tests/ directory). Run up to + # 4 concurrently instead of fully serial (measured ~14 min serial). + # -j4 (not nproc) avoids extreme oversubscription: each suite + # already spawns MPI ranks with OMP_NUM_THREADS=2. + ctest --test-dir build -V --timeout 1700 -j 4 \ + -R '01_PW|02_NAO_Gamma|03_NAO_multik|04_FF|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others' # - name: 17_DS_DFTU Test # env: From 4d0a9e558efe279ef5adfbb9db148c31c73f0172 Mon Sep 17 00:00:00 2001 From: mrL <1417558386@qq.com> Date: Sun, 2 Aug 2026 14:44:05 +0800 Subject: [PATCH 2/2] ci(test): run module unittests in parallel, keep integration suites serial The first version attempted to run all 10 integration suites concurrently with ctest -j4, but this caused severe oversubscription on the X64 self-hosted runner (each suite spawns 4 MPI ranks with OMP_NUM_THREADS=2, so 4 concurrent suites = 32 threads on an 8-core runner). The test step took 91 min and failed with ctest exit code 8 (timeout). This version keeps the 16 MODULE_* steps merged into a single parallel ctest -j $(nproc) invocation (gtest binaries, no MPI oversubscription, measured ~4.5 min serial -> ~1 min parallel) but reverts the integration suite steps back to serial execution. --- .github/workflows/test.yml | 73 +++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f7f45aabc9..3dcc77ecf8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -130,18 +130,75 @@ jobs: ctest --test-dir build -V --timeout 1700 -j "$(nproc)" \ -R 'MODULE_' -E PERF_MODULE_HSOLVER_KERNELS - - name: Integration Test Suites + - name: 01_PW Test env: GTEST_COLOR: 'yes' OMP_NUM_THREADS: '2' run: | - # The 10 integration suites are independent ctest entries (each - # runs Autotest.sh in its own tests/ directory). Run up to - # 4 concurrently instead of fully serial (measured ~14 min serial). - # -j4 (not nproc) avoids extreme oversubscription: each suite - # already spawns MPI ranks with OMP_NUM_THREADS=2. - ctest --test-dir build -V --timeout 1700 -j 4 \ - -R '01_PW|02_NAO_Gamma|03_NAO_multik|04_FF|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others' + ctest --test-dir build -V --timeout 1700 -R 01_PW + + - name: 02_NAO_Gamma Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 02_NAO_Gamma + + - name: 03_NAO_multik Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 03_NAO_multik + + - name: 04_FF Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 04_FF + + - name: 05_rtTDDFT Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 05_rtTDDFT + + - name: 06_SDFT Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 06_SDFT + + - name: 07_OFDFT Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 07_OFDFT + + - name: 08_EXX Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 08_EXX + + - name: 09_DeePKS Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 09_DeePKS + + - name: 10_others Test + env: + GTEST_COLOR: 'yes' + OMP_NUM_THREADS: '2' + run: | + ctest --test-dir build -V --timeout 1700 -R 10_others # - name: 17_DS_DFTU Test # env: