diff --git a/examples_ptx/radixSort/Makefile_cpu b/examples_ptx/radixSort/Makefile_cpu index a70ba750..70817d09 100644 --- a/examples_ptx/radixSort/Makefile_cpu +++ b/examples_ptx/radixSort/Makefile_cpu @@ -1,7 +1,7 @@ -EXAMPLE=sort -CPP_SRC=sort.cpp sort_serial.cpp -ISPC_SRC=sort.ispc +EXAMPLE=radixSort +CPP_SRC=radixSort.cpp +ISPC_SRC=radixSort.ispc ISPC_IA_TARGETS=avx1-i32x8 ISPC_ARM_TARGETS=neon #ISPC_FLAGS=-DDEBUG diff --git a/examples_ptx/radixSort/radixSort.cpp b/examples_ptx/radixSort/radixSort.cpp new file mode 100644 index 00000000..0be0f562 --- /dev/null +++ b/examples_ptx/radixSort/radixSort.cpp @@ -0,0 +1,102 @@ +#include +#include +#include +#include +#include +#include +#include "../timing.h" +#include "../ispc_malloc.h" +#include "radixSort_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