summaryrefslogtreecommitdiff
path: root/test/linalg_test.cu
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-09-19 14:36:13 -0400
committerStan Seibert <stan@mtrr.org>2011-09-19 14:36:13 -0400
commita21b05e4727403e2e061234289af9e60e6022e5a (patch)
tree7a7d4c5809c370f3e542cfc8cb0bec7c2e4f5cdc /test/linalg_test.cu
parentcfecff941fc619eb7269128afc62d9c11ae78aff (diff)
parenta38c56ff1e268298568077af7f03c8ac64c6fb82 (diff)
downloadchroma-a21b05e4727403e2e061234289af9e60e6022e5a.tar.gz
chroma-a21b05e4727403e2e061234289af9e60e6022e5a.tar.bz2
chroma-a21b05e4727403e2e061234289af9e60e6022e5a.zip
merge relayout branch
Diffstat (limited to 'test/linalg_test.cu')
-rw-r--r--test/linalg_test.cu128
1 files changed, 128 insertions, 0 deletions
diff --git a/test/linalg_test.cu b/test/linalg_test.cu
new file mode 100644
index 0000000..4e9c983
--- /dev/null
+++ b/test/linalg_test.cu
@@ -0,0 +1,128 @@
+//-*-c-*-
+
+#include "linalg.h"
+
+extern "C"
+{
+
+__global__ void float3add(float3 *a, float3 *b, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx] + b[idx];
+}
+
+__global__ void float3addequal(float3 *a, float3 *b)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] += b[idx];
+}
+
+__global__ void float3sub(float3 *a, float3 *b, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx] - b[idx];
+}
+
+__global__ void float3subequal(float3 *a, float3 *b)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] -= b[idx];
+}
+
+__global__ void float3addfloat(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx] + c;
+}
+
+__global__ void float3addfloatequal(float3 *a, float c)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] += c;
+}
+
+__global__ void floataddfloat3(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = c + a[idx];
+}
+
+__global__ void float3subfloat(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx] - c;
+}
+
+__global__ void float3subfloatequal(float3 *a, float c)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] -= c;
+}
+
+__global__ void floatsubfloat3(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = c - a[idx];
+}
+
+__global__ void float3mulfloat(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx]*c;
+}
+
+__global__ void float3mulfloatequal(float3 *a, float c)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] *= c;
+}
+
+__global__ void floatmulfloat3(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = c*a[idx];
+}
+
+__global__ void float3divfloat(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = a[idx]/c;
+}
+
+__global__ void float3divfloatequal(float3 *a, float c)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ a[idx] /= c;
+}
+
+__global__ void floatdivfloat3(float3 *a, float c, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = c/a[idx];
+}
+
+__global__ void dot(float3 *a, float3 *b, float *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = dot(a[idx],b[idx]);
+}
+
+__global__ void cross(float3 *a, float3 *b, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = cross(a[idx],b[idx]);
+}
+
+__global__ void norm(float3 *a, float *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = norm(a[idx]);
+}
+
+__global__ void minusfloat3(float3 *a, float3 *dest)
+{
+ int idx = blockIdx.x*blockDim.x + threadIdx.x;
+ dest[idx] = -a[idx];
+}
+
+} // extern "c"