Hi,

The attached script shows highly inconsistent results (> 10% error at
times) between the numpy and gpuarray dot products. The inconsistent
results seem to only appear for large gpuarrays of data type complex64 or
complex128. Any ideas on what's going on? Thanks!

Jesse
import pycuda.autoinit
from pycuda import gpuarray
import numpy

shapes = [(10000,), (100000,), (1000000,), (10000000,), \
    (100,100), (1000,1000), \
    (10,20,30), (40,50,60), (200,200,200)]
dtypes = [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128]
for dtype in dtypes:
    for shape in shapes:
        x = gpuarray.to_gpu(numpy.random.randn(*shape).astype(dtype))
        y = gpuarray.to_gpu(numpy.random.randn(*shape).astype(dtype))

        dot_cpu = numpy.dot(x.get().flatten(), y.get().flatten()) 
        dot_gpu = gpuarray.dot(x, y).get()

        print 'shape:', shape
        print 'data type:', dtype 
        print 'numpy computed dot product:', dot_cpu
        print 'gpuarray computed dot product:', dot_gpu
        print 'percent error:', abs(dot_cpu-dot_gpu)/abs(dot_cpu)*100, '%'
        print '\n'
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to