diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-09 16:39:40 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-08-09 16:39:40 -0400 |
commit | 4f3e0b7709bb64ffc24f2a003509d5f480848239 (patch) | |
tree | f64f5efd1238a03e76ae280871f490a32b863ac3 /src/tools.cu | |
parent | 135ad2ca5b5ade4c52ae98f8fc7545fcc88fb449 (diff) | |
download | chroma-4f3e0b7709bb64ffc24f2a003509d5f480848239.tar.gz chroma-4f3e0b7709bb64ffc24f2a003509d5f480848239.tar.bz2 chroma-4f3e0b7709bb64ffc24f2a003509d5f480848239.zip |
switch to indexing child nodes by start and stop indices instead of start and length; this reduces a bit of arithmetic when traversing the bounding volume hierarchy and makes the code in Geometry.build() more concise. add an untested cuda kernel to interleave the bits in three uint64 arrays.
Diffstat (limited to 'src/tools.cu')
-rw-r--r-- | src/tools.cu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools.cu b/src/tools.cu new file mode 100644 index 0000000..3d3fed7 --- /dev/null +++ b/src/tools.cu @@ -0,0 +1,17 @@ +//--*-c-*- + +extern "C" +{ + +__global__ void interleave(int nthreads, unsigned long long *x, unsigned long long *y, unsigned long long *z, int bits, unsigned long long *dest) +{ + int id = blockIdx.x*blockDim.x + threadIdx.x; + + if (id >= nthreads) + return; + + for (int i=0; i < bits; i++) + dest[id] |= (x[id] & 1 << i) << (2*i) | (y[id] & 1 << i) << (2*i+1) | (z[id] & 1 << i) << (2*i+2); +} + +} |