summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2014-07-04 14:17:53 +0200
committerVolker Hoffmann <volker@cheleb.net>2014-07-04 14:17:53 +0200
commitc0be794f10da60cc2f97abbc55ce1eca3c815ce4 (patch)
treeb55ef111ab2be3cc902ae15cb45822f94963ab77
parent086f53870ade34c70f30c975650f2b77031e4864 (diff)
define an additional shared variable in a device function
-rw-r--r--functionTest.cu6
1 files changed, 4 insertions, 2 deletions
diff --git a/functionTest.cu b/functionTest.cu
index 8848d48..458554f 100644
--- a/functionTest.cu
+++ b/functionTest.cu
@@ -5,10 +5,12 @@
template <int nthreads>
__device__ void f2(int idx, float x_s[nthreads])
{
+ __shared__ float y_s[nthreads];
+ y_s[idx] = x_s[idx];
if(idx>0) {
- printf("%i %.2e %.2e\n", idx, x_s[idx], x_s[idx-1]);
+ printf("%i %.2e %.2e %.2e %.2e\n", idx, x_s[idx], x_s[idx-1], y_s[idx], y_s[idx-1]);
} else {
- printf("%i %.2e\n", idx, x_s[idx]);
+ printf("%i %.2e %.2e\n", idx, x_s[idx], y_s[idx]);
}
}