Skip to content

Commit de6c8b9

Browse files
committed
test(init/fini): update tests with new initialization/finalization APIs
1 parent 0cb31f7 commit de6c8b9

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

perf_tests/test_main.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//@HEADER
1616

1717
#include "KokkosComm_include_mpi.hpp"
18+
#include "KokkosComm.hpp"
1819

1920
#include <Kokkos_Core.hpp>
2021
#include <benchmark/benchmark.h>
@@ -32,15 +33,12 @@ class NullReporter : public ::benchmark::BenchmarkReporter {
3233
// The main is rewritten to allow for MPI initializing and for selecting a
3334
// reporter according to the process rank
3435
int main(int argc, char **argv) {
35-
MPI_Init(&argc, &argv);
36-
37-
int rank;
38-
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
39-
40-
Kokkos::initialize();
36+
KokkosComm::initialize(argc, &argv);
4137

4238
::benchmark::Initialize(&argc, argv);
4339

40+
int rank;
41+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
4442
if (rank == 0)
4543
// root process will use a reporter from the usual set provided by
4644
// ::benchmark
@@ -51,7 +49,6 @@ int main(int argc, char **argv) {
5149
::benchmark::RunSpecifiedBenchmarks(&null);
5250
}
5351

54-
Kokkos::finalize();
55-
MPI_Finalize();
52+
KokkosComm::finalize();
5653
return 0;
57-
}
54+
}

unit_tests/test_main.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ int main(int argc, char *argv[]) {
8181
// Intialize google test
8282
::testing::InitGoogleTest(&argc, argv);
8383

84-
MPI_Init(&argc, &argv);
84+
KokkosComm::initialize(argc, &argv);
85+
8586
int rank, size;
8687
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
8788
MPI_Comm_size(MPI_COMM_WORLD, &size);
@@ -90,8 +91,6 @@ int main(int argc, char *argv[]) {
9091
<< KOKKOSCOMM_VERSION_PATCH << ")\n";
9192
}
9293

93-
Kokkos::initialize();
94-
9594
// Intialize google test
9695
::testing::InitGoogleTest(&argc, argv);
9796

@@ -105,9 +104,8 @@ int main(int argc, char *argv[]) {
105104
// run tests
106105
auto exit_code = RUN_ALL_TESTS();
107106

108-
// Finalize MPI before exiting
109-
Kokkos::finalize();
110-
MPI_Finalize();
107+
// Finalize KokkosComm before exiting
108+
KokkosComm::finalize();
111109

112110
return exit_code;
113111
}

0 commit comments

Comments
 (0)