Skip to content

Commit

Permalink
Fix mpi tests on github CI; Add CMake conf vars for changing mpirun f…
Browse files Browse the repository at this point in the history
…lags
  • Loading branch information
cscjlan committed Aug 26, 2024
1 parent 33a89b4 commit a81247f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
43 changes: 25 additions & 18 deletions .github/workflows/cmake_single_platform.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake on a single platform
name: CMake build and test fsgrid

on:
push:
Expand All @@ -15,36 +13,45 @@ env:

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install OpenMPI
run: sudo apt-get install openmpi-bin libopenmpi-dev openmpi-common
run: >
sudo apt-get install
openmpi-bin
libopenmpi-dev
openmpi-common
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dproject_name=${{env.PROJECT_NAME}}
run: >
cmake
-B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-Dproject_name=${{env.PROJECT_NAME}}
-DMPI_TEST_NUM_PROCS=4
-DMPI_TEST_EXTRA_FLAGS=--oversubscribe
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: >
cmake
--build ${{github.workspace}}/build
--config ${{env.BUILD_TYPE}}
- name: Test
id: test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
run: >
ctest
-C ${{env.BUILD_TYPE}}
- name: Verbose re-run failed tests
# Only run if the test step failed
if: failure() && steps.test.outcome == 'failure'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure

run: >
ctest
-C ${{env.BUILD_TYPE}}
--rerun-failed
--output-on-failure
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ all:
-S $(source_dir) \
-DCMAKE_BUILD_TYPE:STRING=$${build_type} \
-Dproject_name=$(project_name) \
-DMPI_TEST_NUM_PROCS=4 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake \
--build $${build_dir} \
Expand Down
2 changes: 1 addition & 1 deletion tests/mpi_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ target_link_libraries(
# !!!!
set_property(TARGET ${testname}
PROPERTY CROSSCOMPILING_EMULATOR
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 4
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPI_TEST_NUM_PROCS} ${MPI_TEST_EXTRA_FLAGS}
)

gtest_add_tests(TARGET ${testname})

0 comments on commit a81247f

Please sign in to comment.