Hi all, Another piece of niceness just landed in PyCUDA git: Semi-transparent support for double-precision textures. This code papers over the complications and differences between floats and doubles as far as texturing is concerned. Here's how you use it.
Device-side:
8< ----------------------------------------------------
#include <pycuda-helpers.hpp>
texture<fp_tex_{float,double}, N, cudaReadMode...> my_tex;
{float,double} x = fp_tex1Dfetch(my_tex, i);
{float,double} y = fp_tex2D(my_tex, i, j);
{float,double} z = fp_tex3D(my_tex, i, j, k);
8< ----------------------------------------------------
(The proper inlcude path for pycuda-helpers.hpp is automatically set by
PyCUDA--no need to jump through extra hoops.)
Host-side, everything should be transparent if you use
http://documen.tician.de/pycuda/array.html#pycuda.gpuarray.GPUArray.bind_to_texref_ext
to bind a GPUArray to the texture reference. Note: only single-channel
textures are supported by this abstraction for now. For multi-D or other
binding paths, just set up the texture as if it consisted of int2's instead of
doubles.
I'd like to thank Nathan Bell at Nvidia for help in figuring out how to get
this to work.
The relevant bits in the code are here:
- http://git.tiker.net/pycuda.git/blob/HEAD:/src/cuda/pycuda-helpers.hpp
- Test: http://git.tiker.net/pycuda.git/blob/HEAD:/test/test_driver.py#l388
Andreas
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PyCuda mailing list [email protected] http://tiker.net/mailman/listinfo/pycuda_tiker.net
