Skip to content

Commit b52407a

Browse files
committed
remove file
1 parent 9acc492 commit b52407a

File tree

4 files changed

+236
-170
lines changed

4 files changed

+236
-170
lines changed

benchrunner/cxx/benchmarks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void *smergesort_cmp(void *const pbase, size_t total_elems, size_t size, __compa
2626
void *mergesort_par(void *const pbase, size_t total_elems, size_t size, __compar_fn_t cmp);
2727
void *cilksort(void *const pbase, size_t total_elems, size_t size, __compar_fn_t cmp);
2828
void *cilksort_par(void *const pbase, size_t total_elems, size_t size, __compar_fn_t cmp);
29+
template <typename T> T *bottomUpMergeSort(T *a, T *b, int n);
2930

3031
// Microbenchmarks.
3132
int64_t* __attribute__ ((noinline)) fill_array_seq(size_t total_elems, int64_t val);

benchrunner/cxx/main.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "benchmarks.h"
33
#include "insertionsort.cpp"
44
#include "quicksort.cpp"
5+
#include "mergesort.cpp"
56
#include "microbench.h"
67
#include "cbench.h"
78
#include <chrono>
@@ -38,5 +39,20 @@ int main(int argc, char *argv[]) {
3839

3940
slice_assert_sorted_2(out, arr_size);
4041

42+
std::cout << std::endl;
43+
std::cout << "Benchmarking mergesort sequential: " << std::endl;
44+
for (size_t i = 0; i < iters; i++) {
45+
int64_t *arr = fill_array_rand_seq(arr_size);
46+
int64_t *copyOut = new int64_t[arr_size];
47+
copyArray<int64_t>(arr, copyOut, arr_size);
48+
start = std::chrono::system_clock::now();
49+
out = bottomUpMergeSort<int64_t>(arr, copyOut, arr_size);
50+
end = std::chrono::system_clock::now();
51+
std::chrono::duration<double> elapsed_seconds = end - start;
52+
printf("itertime: %lf\n", elapsed_seconds.count());
53+
}
54+
55+
slice_assert_sorted_2(out, arr_size);
56+
4157
return 0;
4258
}

0 commit comments

Comments
 (0)