Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Install package
env:
SKBUILD_CMAKE_DEFINE: monoprop_ENABLE_CXX_UNIT_TESTS=OFF
monoprop_ENABLE_CXX_UNIT_TESTS: "OFF"
monoprop_ENABLE_MPI: "ON"
run: just build --group bench

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-26.04

env:
SKBUILD_CMAKE_DEFINE: monoprop_ENABLE_CXX_UNIT_TESTS=OFF
monoprop_ENABLE_CXX_UNIT_TESTS: "OFF"

steps:
- name: Checkout
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/qa-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ jobs:
runs-on: ubuntu-26.04
permissions:
contents: read
# The build type also selects the tree the test recipes run against.
# The profile also selects the build type, hence the tree the test recipes run against.
env:
SKBUILD_CMAKE_BUILD_TYPE: "AsanUbsan"
SKBUILD_CMAKE_DEFINE: "monoprop_SANITIZER=asan-ubsan"
monoprop_SANITIZER: "asan-ubsan"

steps:
- uses: actions/checkout@v7.0.1
Expand Down Expand Up @@ -170,8 +169,7 @@ jobs:
permissions:
contents: read
env:
SKBUILD_CMAKE_BUILD_TYPE: "Tsan"
SKBUILD_CMAKE_DEFINE: "monoprop_SANITIZER=tsan"
monoprop_SANITIZER: "tsan"

steps:
- uses: actions/checkout@v7.0.1
Expand Down Expand Up @@ -207,7 +205,7 @@ jobs:

- name: Install package
env:
SKBUILD_CMAKE_DEFINE: "monoprop_ENABLE_CXX_UNIT_TESTS=OFF"
monoprop_ENABLE_CXX_UNIT_TESTS: "OFF"
monoprop_ENABLE_MPI: "ON"
run: just build

Expand All @@ -222,7 +220,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.cfamily.compile-commands=build/editable/Release/compile_commands.json
-Dsonar.cfamily.compile-commands=build/editable/Release-mpi/compile_commands.json

clang-tidy:
needs: [cpp-changes]
Expand Down Expand Up @@ -250,7 +248,8 @@ jobs:

- name: Build (generates compile_commands.json)
env:
SKBUILD_CMAKE_DEFINE: "CMAKE_CXX_COMPILER=clang++;monoprop_ENABLE_CXX_UNIT_TESTS=OFF"
SKBUILD_CMAKE_DEFINE: "CMAKE_CXX_COMPILER=clang++"
monoprop_ENABLE_CXX_UNIT_TESTS: "OFF"
monoprop_ENABLE_MPI: "ON"
run: just build

Expand All @@ -273,7 +272,7 @@ jobs:
mapfile -t clang_tidy_inputs < <(
jq -r --arg source_root "$GITHUB_WORKSPACE/cpp/monoprop/" \
'.[].file | select(startswith($source_root)) | select(endswith(".cpp"))' \
build/editable/Release/compile_commands.json
build/editable/Release-mpi/compile_commands.json
)
else
clang_tidy_inputs=("${changed_cpp_files[@]}")
Expand All @@ -285,7 +284,7 @@ jobs:
'$files | map({name: ($workspace + .), lines: [[1, 2147483647]]})')

run-clang-tidy \
-p build/editable/Release \
-p build/editable/Release-mpi \
-source-filter='^${{ github.workspace }}/cpp/monoprop/.*$' \
-header-filter='^(.*/)?cpp/(include/)?monoprop/.*$' \
-exclude-header-filter='^.*/src/monoprop/bindings/.*$' \
Expand Down
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"intelliSenseMode": "linux-gcc-x64",
"compileCommands": [
"${workspaceFolder}/build/editable/Release/compile_commands.json",
"${workspaceFolder}/build/editable/Release-mpi/compile_commands.json",
"${workspaceFolder}/build/editable/Debug/compile_commands.json",
"${workspaceFolder}/build/release-gcc/compile_commands.json",
"${workspaceFolder}/build/coverage-gcc/compile_commands.json",
Expand Down
28 changes: 28 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"binaryDir": "${sourceDir}/build/editable/Release",
"generator": "Ninja"
},
{
"name": "skbuild-release-mpi",
"displayName": "scikit-build-core (Release, MPI, adopt existing tree)",
"description": "Adopt the MPI Release build tree generated by 'monoprop_ENABLE_MPI=ON uv sync' / scikit-build-core. Do NOT reconfigure this preset from CMake Tools; regenerate the tree with uv/scikit-build-core, then use this preset only to build and run the C++ CTest suite.",
"binaryDir": "${sourceDir}/build/editable/Release-mpi",
"generator": "Ninja"
},
{
"name": "skbuild-debug",
"displayName": "scikit-build-core (Debug, adopt existing tree)",
Expand All @@ -28,6 +35,17 @@
],
"jobs": 4
},
{
"name": "skbuild-release-mpi",
"displayName": "scikit-build-core (Release, MPI) - Build C++ unit tests",
"description": "Build the C++ unit test executable in the scikit-build-core MPI Release tree. Requires the tree to already exist (run 'monoprop_ENABLE_MPI=ON uv sync --all-extras').",
"configurePreset": "skbuild-release-mpi",
"targets": [
"monoprop_unit_tests.x",
"monoprop_link_export_probe.x"
],
"jobs": 4
},
{
"name": "skbuild-debug",
"displayName": "scikit-build-core (Debug) - Build C++ unit tests",
Expand All @@ -51,6 +69,16 @@
},
"inheritConfigureEnvironment": true
},
{
"name": "skbuild-release-mpi",
"displayName": "scikit-build-core (Release, MPI) - Run C++ unit tests",
"description": "Run the C++ CTest suite, including the MPI variants, from the scikit-build-core MPI Release tree.",
"configurePreset": "skbuild-release-mpi",
"output": {
"outputOnFailure": true
},
"inheritConfigureEnvironment": true
},
{
"name": "skbuild-debug",
"displayName": "scikit-build-core (Debug) - Run C++ unit tests",
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ plus the `-mpi` lists), which is what CI and the devcontainer install.
`just build [uv sync args…]` performs the build CI performs — the same recipe
GitHub Actions calls, so a lane can be reproduced locally.

Full instructions — prerequisites, MPI options, and running the example
Build options (MPI, sanitizers, C++ tests) can be set through environment
variables or config-settings such as `-C monoprop.mpi=ON`.
Full instructions — prerequisites, build options, and running the example
executable — are in the [building guide](https://docs.monoprop.algorithmiq.tech/building).
In particular, from-source builds require `hwloc` and `pkg-config` so CMake can
locate `hwloc`.
Expand All @@ -129,7 +131,8 @@ for the with/without-MPI details and the rank matrix. CI has explicit MPI-enable
lanes on Linux x86-64, Linux ARM64, and macOS; installing the `mpi` extra alone
does not enable the C++ MPI build. CI requires a registered MPI CTest variant,
and each whole-suite MPI run has a 600-second deadlock timeout. Source builds
select the MPI variant with `monoprop_ENABLE_MPI=ON` in the environment.
select the MPI variant with `monoprop_ENABLE_MPI=ON` in the environment (or
`-C monoprop.mpi=ON`).
Standalone MPI-enabled C++ programs must initialize MPI before constructing a
propagator and finalize it only after all propagators have been destroyed. The
exported CMake target preserves the package's MPI setting independently of any
Expand Down
15 changes: 8 additions & 7 deletions cpp/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@ ctest --test-dir build/editable/Release
```

For an MPI-enabled tree, rerun `uv sync` with `monoprop_ENABLE_MPI=ON` in the
environment.
environment. MPI builds go to their own tree, `build/editable/Release-mpi`, so
the MPI variants below are registered there.
## Running Tests

```bash
ctest --test-dir build/editable/Release # everything
ctest --test-dir build/editable/Release -L serial # serial variants only
ctest --test-dir build/editable/Release -L mpi # MPI variants
ctest --test-dir build/editable/Release -L mpi-2 # only the 2-rank run
ctest --test-dir build/editable/Release # everything
ctest --test-dir build/editable/Release -L serial # serial variants only
ctest --test-dir build/editable/Release-mpi -L mpi # MPI variants (MPI tree)
ctest --test-dir build/editable/Release-mpi -L mpi-2 # only the 2-rank run
```

Or drive the binary directly:

```bash
build/editable/Release/bin/monoprop_unit_tests.x --list_content
build/editable/Release/bin/monoprop_unit_tests.x --run_test=pauli_algebra_*
mpirun -n 2 build/editable/Release/bin/monoprop_unit_tests.x
mpirun -n 2 build/editable/Release-mpi/bin/monoprop_unit_tests.x
```

Because CTest discovery treats each `--list_content` line as a top-level test
Expand Down Expand Up @@ -137,7 +138,7 @@ runner indefinitely. For exhaustive
rank coverage, run `just test-mpi '1;2;4'` or configure
`-Dmonoprop_MPI_TEST_PROCS='1;2;4'`. To run a single case under MPI while
debugging, invoke the binary directly:
`mpirun -n 2 build/editable/Release/bin/monoprop_unit_tests.x --run_test=<case>`.
`mpirun -n 2 build/editable/Release-mpi/bin/monoprop_unit_tests.x --run_test=<case>`.

## Adding New Tests

Expand Down
Loading
Loading