diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index eac00c7..631319f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,8 +5,6 @@ name: CI # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [main] pull_request: branches: [main] @@ -137,10 +135,18 @@ jobs: - name: Run tests run: | export PYTHONPATH="$PWD/build" - mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py - mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py - mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py - mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests --ignore=tests/test_hmatrix.py --ignore=tests/test_logger.py + mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_cluster.py + mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_cluster.py + mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_cluster.py + mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_cluster.py + mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_distributed_operator.py + mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_distributed_operator.py + mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_distributed_operator.py + mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_distributed_operator.py + mpirun -np 1 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_ddm_solver.py + mpirun -np 2 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_ddm_solver.py + mpirun -np 3 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_ddm_solver.py + mpirun -np 4 ${{ matrix.MPIEXEC_PREFLAGS }} python3 -m pytest tests/test_ddm_solver.py python3 -m pytest tests/test_hmatrix.py python3 -m pytest tests/test_logger.py @@ -161,8 +167,18 @@ jobs: - name: Generate coverage reports if: matrix.CODE_COVERAGE == 'ON' run: | - lcov --ignore-errors mismatch --capture --base-directory ./ --directory build/ --output-file coverage.info - lcov --remove coverage.info '/usr/*' '*/hpddm/*' '*/pybind11/*' '*/lib/htool/*' --output-file ../coverage.info + # Capture coverage: both MPI (.gcda in /tmp/gcov-mpi) and serial (.gcda in build/) + lcov --ignore-errors mismatch \ + --capture \ + --base-directory $(pwd) \ + --directory build \ + --output-file coverage.info + + # Exclude third-party and system paths + lcov --remove coverage.info '/usr/*' '*/hpddm/*' '*/pybind11/*' '*/lib/htool/*' --output-file filtered.info + + # Convert absolute paths to relative paths for Codecov + lcov --extract filtered.info "${PWD}/src/*" --output-file coverage.info - uses: actions/upload-artifact@v4 with: @@ -180,9 +196,9 @@ jobs: fetch-depth: 0 - uses: actions/download-artifact@v4 - name: Upload coverage report - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: fail_ci_if_error: true - file: ./coverage.info + files: ./coverage.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true diff --git a/src/htool/misc/logger.hpp b/src/htool/misc/logger.hpp index 3f5d72d..1aa09da 100644 --- a/src/htool/misc/logger.hpp +++ b/src/htool/misc/logger.hpp @@ -29,13 +29,11 @@ class PythonLoggerWriter : public htool::IObjectWriter { case htool::LogLevel::INFO: logger.attr("info")(message); break; - default: - break; } } - - void set_log_level(htool::LogLevel log_level) override { - } + // LCOV_EXCL_START + void set_log_level(htool::LogLevel log_level) override {} + // LCOV_EXCL_STOP }; #endif diff --git a/tests/conftest.py b/tests/conftest.py index 07bb177..ed640fb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -268,6 +268,17 @@ def local_operator(request, generator, cluster, geometry): False, ) ) + assert ( + result[1][-1].local_target_renumbering.size + == target_local_cluster.get_size() + ) + assert ( + result[1][-1].local_source_renumbering.size + == source_cluster.get_size() + - source_local_cluster.get_size() + - source_local_cluster.get_offset() + ) + if request.param == "LocalAndExtraDiagonal": result[0] = "LocalAndExtraDiagonal" result[1].append( @@ -277,7 +288,6 @@ def local_operator(request, generator, cluster, geometry): Htool.LocalRenumbering(source_local_cluster), ) ) - return result else: return None diff --git a/tests/test_distributed_operator.py b/tests/test_distributed_operator.py index 1ac6117..2fc4b05 100644 --- a/tests/test_distributed_operator.py +++ b/tests/test_distributed_operator.py @@ -96,6 +96,11 @@ def test_distributed_operator( Y_2 = generator.mat_mat(X) assert np.linalg.norm(Y_1 - Y_2) / np.linalg.norm(Y_2) < epsilon + X = np.asfortranarray(np.random.rand(nb_cols, 1)) + Y_1 = distributed_operator @ X + Y_2 = generator.mat_mat(X) + assert np.linalg.norm(Y_1 - Y_2) / np.linalg.norm(Y_2) < epsilon + # Test sub matrix vector product test_offset = int(nb_cols / 10) test_size = int(nb_cols / 10)