diff --git a/perf_tests/test_main.cpp b/perf_tests/test_main.cpp index 4898d6e4..f024f8c5 100644 --- a/perf_tests/test_main.cpp +++ b/perf_tests/test_main.cpp @@ -15,6 +15,7 @@ //@HEADER #include "KokkosComm_include_mpi.hpp" +#include "KokkosComm.hpp" #include #include @@ -32,15 +33,12 @@ class NullReporter : public ::benchmark::BenchmarkReporter { // The main is rewritten to allow for MPI initializing and for selecting a // reporter according to the process rank int main(int argc, char **argv) { - MPI_Init(&argc, &argv); - - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - - Kokkos::initialize(); + KokkosComm::initialize(argc, &argv); ::benchmark::Initialize(&argc, argv); + int rank; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) // root process will use a reporter from the usual set provided by // ::benchmark @@ -51,7 +49,6 @@ int main(int argc, char **argv) { ::benchmark::RunSpecifiedBenchmarks(&null); } - Kokkos::finalize(); - MPI_Finalize(); + KokkosComm::finalize(); return 0; -} \ No newline at end of file +} diff --git a/unit_tests/test_main.cpp b/unit_tests/test_main.cpp index d5dea47a..ec27c036 100644 --- a/unit_tests/test_main.cpp +++ b/unit_tests/test_main.cpp @@ -81,7 +81,8 @@ int main(int argc, char *argv[]) { // Intialize google test ::testing::InitGoogleTest(&argc, argv); - MPI_Init(&argc, &argv); + KokkosComm::initialize(argc, &argv); + int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); @@ -90,8 +91,6 @@ int main(int argc, char *argv[]) { << KOKKOSCOMM_VERSION_PATCH << ")\n"; } - Kokkos::initialize(); - // Intialize google test ::testing::InitGoogleTest(&argc, argv); @@ -105,9 +104,8 @@ int main(int argc, char *argv[]) { // run tests auto exit_code = RUN_ALL_TESTS(); - // Finalize MPI before exiting - Kokkos::finalize(); - MPI_Finalize(); + // Finalize KokkosComm before exiting + KokkosComm::finalize(); return exit_code; }