-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add state parameter to do_iteration, sendrecv perf test
- Loading branch information
Showing
6 changed files
with
39 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
#include "test_utils.hpp" | ||
|
||
#include <thread> | ||
#include "KokkosComm.hpp" | ||
|
||
void i_am_sleepy(MPI_Comm comm, int macsleepface) { | ||
// Pretend to work ... | ||
std::this_thread::sleep_for(std::chrono::milliseconds(macsleepface)); | ||
// ... as a team | ||
MPI_Barrier(MPI_COMM_WORLD); | ||
template <typename Space, typename View> | ||
void send_recv(benchmark::State &state, MPI_Comm comm, const Space &space, int rank, const View &v) { | ||
if (0 == rank) { | ||
KokkosComm::send(space, v, 1, 0, MPI_COMM_WORLD); | ||
KokkosComm::recv(space, v, 1, 0, MPI_COMM_WORLD); | ||
} else { | ||
KokkosComm::recv(space, v, 0, 0, MPI_COMM_WORLD); | ||
KokkosComm::send(space, v, 0, 0, MPI_COMM_WORLD); | ||
} | ||
} | ||
|
||
|
||
|
||
void mpi_benchmark(benchmark::State &state) { | ||
int rank; | ||
void benchmark_sendrecv(benchmark::State &state) { | ||
int rank, size; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
MPI_Comm_size(MPI_COMM_WORLD, &size); | ||
if (size < 2) { | ||
state.SkipWithError("benchmark_sendrecv needs at least 2 ranks"); | ||
} | ||
|
||
auto space = Kokkos::DefaultExecutionSpace(); | ||
using view_type = Kokkos::View<double *>; | ||
view_type a("", 1000000); | ||
|
||
while(state.KeepRunning()) { | ||
do_iteration(state, MPI_COMM_WORLD, i_am_sleepy, rank % 5); | ||
do_iteration(state, MPI_COMM_WORLD, send_recv<Kokkos::DefaultExecutionSpace, view_type>, space, rank, a); | ||
} | ||
} | ||
|
||
BENCHMARK(mpi_benchmark)->UseManualTime()->Unit(benchmark::kMillisecond);; | ||
BENCHMARK(benchmark_sendrecv)->UseManualTime()->Unit(benchmark::kMillisecond); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#pragma once | ||
|
||
template <typename ViewType> | ||
struct PackTraits { | ||
}; | ||
template <typename ViewType> struct PackTraits {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters