hemi
hemi copied to clipboard
portable interpolated look-up table using texture memory
Lookup class hemi::Table3D<T>
that creates an interface to a look-up table structure, using texture memory on GPU. Trilinear interpolation is implemented on CPU, and agrees to 5/6 decimal places when compared to the texture memory results.
The user calls readOnlyDevicePtr()
to return a pointer to the struct object hemi::table3<T>
that can be passed to the kernel. The similarity of Table3D<T>
and table3<t>
bothers me slightly so a better naming convention would be appreciated. The interpolation can then be performed by lookup_struct->lookup(x, y, z)
both in a CUDA kernel and in host code. The device code is ~20 times faster when performing millions of interpolations.
The current implementation is only for 3D LUTs, but it is straightforward to create 1D and 2D versions. There are also other limitations such as read-only access, but this could be improved on with surface objects. Also, the CPU implementation has no out-of-bounds array checking, for speed reasons. This could be changed.
See the two example programs added in /hemi/examples/simple