Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed Dec 18, 2023
1 parent 70e0f71 commit 09f1982
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Install MPI
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev openmpi-bin
run: sudo apt-get update && sudo apt-get install -y libopenmpi-dev openmpi-bin cmake
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install MPI
run: sudo apt-get update && sudo apt-get install -y mpich
run: sudo apt-get update && sudo apt-get install -y mpich cmake
- name: Check out repository code
uses: actions/checkout@v4
- name: Build Kokkos
Expand Down
10 changes: 9 additions & 1 deletion unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(mpitest)

add_executable(test-mpi test_mpi.cpp)
add_test(NAME test-mpi-1
COMMAND mpirun -np 1 ./test-mpi
)
add_test(NAME test-mpi-2
COMMAND mpirun -np 2 ./test-mpi
)

add_executable(test-main test_main.cpp
test_initfinalize.cpp
Expand All @@ -29,6 +36,7 @@ add_executable(test-main test_main.cpp
target_link_libraries(test-main KokkosComm gtest gtest_mpi)

add_test(NAME test-main
COMMAND mpirun -np 2 ./test-main)
COMMAND mpirun -np 2 ./test-main
)


13 changes: 13 additions & 0 deletions unit_tests/test_mpi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <mpi.h>

int main(int argc, char *argv[]) {
// Initialize MPI before any call to gtest_mpi
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (0 == rank) {
std::cout << "Hello from rank " << rank << "\n";
}
MPI_Finalize();
return 0;
}

0 comments on commit 09f1982

Please sign in to comment.