From c890ad4b8bda7a78fc3c80e78fbecc6c566991e8 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Mon, 2 Dec 2024 12:48:52 +0100 Subject: [PATCH] Run parallel examples during CI. (#1063) --- .github/run_examples.sh | 7 ++++++- .github/workflows/ci.yml | 4 +++- src/examples/parallel_hdf5_collective_io.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/run_examples.sh b/.github/run_examples.sh index 9af9a6ef1..a60bd6d3e 100755 --- a/.github/run_examples.sh +++ b/.github/run_examples.sh @@ -16,5 +16,10 @@ fi for f in "${examples_dir}"/*_bin do echo "-- ${f}" - "${f}" + if [[ "${f}" == *"parallel_"* ]] + then + mpiexec -np 2 "${f}" + else + "${f}" + fi done diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d502ef15c..d81dc1644 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,9 @@ jobs: run: | ! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG + - name: Examples + working-directory: ${{github.workspace}}/build/src/examples + run: $GITHUB_WORKSPACE/.github/run_examples.sh # Job testing several versions of hdf5 # =================================================== @@ -136,7 +139,6 @@ jobs: run: | ! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG - - name: Examples working-directory: ${{github.workspace}}/build/src/examples run: $GITHUB_WORKSPACE/.github/run_examples.sh diff --git a/src/examples/parallel_hdf5_collective_io.cpp b/src/examples/parallel_hdf5_collective_io.cpp index 7261b7cf1..1189702b0 100644 --- a/src/examples/parallel_hdf5_collective_io.cpp +++ b/src/examples/parallel_hdf5_collective_io.cpp @@ -92,7 +92,7 @@ int main(int argc, char** argv) { std::vector offset{std::size_t(mpi_rank), 0ul}; std::vector count{1ul, 2ul}; - dataset.select(offset, count).write(data, xfer_props); + dataset.select(offset, count).squeezeMemSpace({0}).write(data, xfer_props); check_collective_io(xfer_props); // Let's ensure that everything has been written do disk. @@ -104,7 +104,7 @@ int main(int argc, char** argv) { // MPI ranks don't have to read non-overlapping parts, but in this // example they happen to. Again all rank participate in this call. - dataset.select(offset, count).read(data, xfer_props); + dataset.select(offset, count).squeezeMemSpace({0}).read(data, xfer_props); check_collective_io(xfer_props); } catch (Exception& err) {