From 2f44b81d4fac07a5a6d6db02ac4b228679dccddf Mon Sep 17 00:00:00 2001 From: Evghenii Date: Thu, 30 Jan 2014 09:51:32 +0100 Subject: [PATCH] first commit --- examples_ptx/bandwidthTest/Makefile_cpu | 12 +++ examples_ptx/bandwidthTest/Makefile_gpu | 14 ++++ examples_ptx/bandwidthTest/bandwidthTest.cpp | 76 +++++++++++++++++++ examples_ptx/bandwidthTest/bandwidthTest.ispc | 30 ++++++++ 4 files changed, 132 insertions(+) create mode 100644 examples_ptx/bandwidthTest/Makefile_cpu create mode 100644 examples_ptx/bandwidthTest/Makefile_gpu create mode 100644 examples_ptx/bandwidthTest/bandwidthTest.cpp create mode 100644 examples_ptx/bandwidthTest/bandwidthTest.ispc diff --git a/examples_ptx/bandwidthTest/Makefile_cpu b/examples_ptx/bandwidthTest/Makefile_cpu new file mode 100644 index 00000000..50b0381b --- /dev/null +++ b/examples_ptx/bandwidthTest/Makefile_cpu @@ -0,0 +1,12 @@ + +EXAMPLE=bandwidthTest +CPP_SRC=bandwidthTest.cpp +ISPC_SRC=bandwidthTest.ispc +ISPC_IA_TARGETS=avx1-i32x16 +ISPC_ARM_TARGETS=neon +#ISPC_FLAGS=-DDEBUG -g +CXXFLAGS=-g +CCFLAGS=-g +#NVCC_FLAGS=-Xptxas=-O0 + +include ../common.mk diff --git a/examples_ptx/bandwidthTest/Makefile_gpu b/examples_ptx/bandwidthTest/Makefile_gpu new file mode 100644 index 00000000..f11d8392 --- /dev/null +++ b/examples_ptx/bandwidthTest/Makefile_gpu @@ -0,0 +1,14 @@ +PROG=bandwidthTest +ISPC_SRC=bandwidthTest.ispc +#CU_SRC=bandwidthTest.cu +CXX_SRC=bandwidthTest.cpp bandwidthTest.cpp +PTXCC_REGMAX=64 +#PTXCC_FLAGS= -Xptxas=-O3 + +# LLVM_GPU=1 +NVVM_GPU=1 + +include ../common_gpu.mk + + + diff --git a/examples_ptx/bandwidthTest/bandwidthTest.cpp b/examples_ptx/bandwidthTest/bandwidthTest.cpp new file mode 100644 index 00000000..bf52630c --- /dev/null +++ b/examples_ptx/bandwidthTest/bandwidthTest.cpp @@ -0,0 +1,76 @@ +#include +#include +#include +#include +#include +#include +#include "../timing.h" +#include "../ispc_malloc.h" +#include "bandwidthTest_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