This is with the version from the trunk
(7804dc6d1b40b506b02a5f7a0b7bde8771f1446c).
import pycuda.driver as cuda
import pycuda.compiler
import pycuda.autoinit
import pycuda.gpuarray as gpuarray
from pycuda.elementwise import ElementwiseKernel
zero_kernel = ElementwiseKernel(
"float *out",
"out[i] = pdf()",
"test",
preamble=
"""
__device__ float pdf()
{
return 0;
}
""")
size = 100
out_gpu = gpuarray.empty(size, float)
zero_kernel(out_gpu)
print all(out_gpu.get() == 0)
print all(out_gpu.get()[:size/2] == 0)
Produces output (for varying size):
False
True
The second half is the same as before the elementwise kernel call.
Oddly enough, demo_elementwise.py does not seem to produce this bug.
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda