Skip to content

Commit

Permalink
use trimean for exchange-strong
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed Aug 17, 2020
1 parent d151a93 commit 6770d3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ add_executable(exchange-weak exchange_weak.cu)
target_link_libraries(exchange-weak stencil::stencil)
add_args(exchange-weak)

add_executable(exchange-strong exchange_strong.cu)
add_executable(exchange-strong exchange_strong.cu statistics.cpp)
target_link_libraries(exchange-strong stencil::stencil)
add_args(exchange-strong)

Expand Down
11 changes: 8 additions & 3 deletions bin/exchange_strong.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <nvToolsExt.h>

#include "statistics.hpp"

#include "argparse/argparse.hpp"
#include "stencil/stencil.hpp"

Expand Down Expand Up @@ -136,17 +138,20 @@ int main(int argc, char **argv) {

dd.realize();


Statistics stats;
MPI_Barrier(MPI_COMM_WORLD);

double elapsed = MPI_Wtime();
for (int iter = 0; iter < nIters; ++iter) {
if (0 == rank) {
std::cerr << "exchange " << iter << "\n";
}
double elapsed = MPI_Wtime();
dd.exchange();
elapsed = MPI_Wtime() - elapsed;
MPI_Allreduce(MPI_IN_PLACE, &elapsed, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
stats.insert(elapsed);
}
MPI_Allreduce(MPI_IN_PLACE, &elapsed, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);

#ifdef STENCIL_SETUP_STATS
if (0 == rank) {
Expand Down Expand Up @@ -188,7 +193,7 @@ int main(int argc, char **argv) {
methodStr.c_str(), useNaivePlacement, x, y, z, x * y * z, dd.exchange_bytes_for_method(MethodFlags::CudaMpi),
dd.exchange_bytes_for_method(MethodFlags::CudaMpiColocated),
dd.exchange_bytes_for_method(MethodFlags::CudaMemcpyPeer),
dd.exchange_bytes_for_method(MethodFlags::CudaKernel), nIters, numSubdoms, numNodes, size, elapsed);
dd.exchange_bytes_for_method(MethodFlags::CudaKernel), nIters, numSubdoms, numNodes, size, stats.trimean());
}
#endif // STENCIL_EXCHANGE_STATS

Expand Down

0 comments on commit 6770d3c

Please sign in to comment.