diff --git a/examples_ptx/mergeSort/mergeSort.cpp b/examples_ptx/mergeSort/mergeSort.cpp new file mode 100644 index 00000000..d4d1d24d --- /dev/null +++ b/examples_ptx/mergeSort/mergeSort.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include +#include +#include "../timing.h" +#include "../ispc_malloc.h" +#include "mergeSort_ispc.h" + +/* progress bar by Ross Hemsley; + * http://www.rosshemsley.co.uk/2011/02/creating-a-progress-bar-in-c-or-any-other-console-app/ */ +static inline void progressbar (unsigned int x, unsigned int n, unsigned int w = 50) +{ + if (n < 100) + { + x *= 100/n; + n = 100; + } + + if ((x != n) && (x % (n/100) != 0)) return; + + using namespace std; + float ratio = x/(float)n; + int c = ratio * w; + + cout << setw(3) << (int)(ratio*100) << "% ["; + for (int x=0; x