Skip to content

Commit

Permalink
Merge branch 'master' of github.com:patflick/mxx
Browse files Browse the repository at this point in the history
  • Loading branch information
patflick committed Apr 25, 2016
2 parents 09a2ca0 + f777498 commit f96d491
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(mxx)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized --std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -msse3 -march=native -funroll-loops")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=native -funroll-loops")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")

# Add these standard paths to the search paths for FIND_LIBRARY
Expand Down
1 change: 1 addition & 0 deletions gtest/mxx_gtest_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);

mxx::env e(argc, argv);
mxx::env::set_exception_on_error();
mxx::comm c = mxx::comm();
//MPI_Init(&argc, &argv);

Expand Down
4 changes: 2 additions & 2 deletions include/mxx/algos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ std::vector<size_t> bucketing(std::vector<T>& input, Func key_func, size_t num_b

// [1st pass]: counting the number of elements per bucket
for (auto it = input.begin(); it != input.end(); ++it) {
MXX_ASSERT(0 <= key_func(*it) && key_func(*it) < num_buckets);
MXX_ASSERT(0 <= key_func(*it) && (size_t)key_func(*it) < num_buckets);
bucket_counts[key_func(*it)]++;
}

Expand Down Expand Up @@ -278,7 +278,7 @@ std::vector<size_t> bucketing_inplace(std::vector<T>& input, Func key_func, size

// [1st pass]: counting the number of elements per bucket
for (auto it = input.begin(); it != input.end(); ++it) {
MXX_ASSERT(0 <= key_func(*it) && key_func(*it) < num_buckets);
MXX_ASSERT(0 <= key_func(*it) && (size_t)key_func(*it) < num_buckets);
bucket_counts[key_func(*it)]++;
}
// get exclusive prefix sum
Expand Down
2 changes: 1 addition & 1 deletion include/mxx/benchmark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class hybrid_comm {
func(*this);
}
} else {
hybrid_comm hc(std::move(split_by_node(participate)));
hybrid_comm hc(split_by_node(participate));
if (participate) {
func(hc);
}
Expand Down
9 changes: 5 additions & 4 deletions include/mxx/timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ class section_timer_impl {
time_rep elapsed = duration(stop-start).count();
// TODO: reduce rather than allreduce
// TODO: use single reduction with custom operator
time_rep min = mxx::allreduce(elapsed, [](time_rep x, time_rep y){return std::min(x,y);}, comm);
time_rep max = mxx::allreduce(elapsed, [](time_rep x, time_rep y){return std::max(x,y);}, comm);
time_rep sum = mxx::allreduce(elapsed, std::plus<time_rep>(), comm);
double delapsed = elapsed;
double min = mxx::allreduce(delapsed, mxx::min<double>(), comm);
double max = mxx::allreduce(delapsed, mxx::max<double>(), comm);
double sum = mxx::allreduce(delapsed, std::plus<time_rep>(), comm);
// calc mean:
int p, rank;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &p);
time_rep mean = sum / (double)p;
double mean = sum / (double)p;
// only root process outputs the timings
if (rank == root)
ostr << std::setprecision(3) << std::scientific << "TIMER" << sep << min << sep << mean << sep << max << sep << depth << sep << name << std::endl;
Expand Down

0 comments on commit f96d491

Please sign in to comment.