Rui Lopes <[email protected]> writes: > I have a program where I have to perform a dot (scalar product) of an array > by a matrix. For e.g., consider the following code snippet: > > ####### > from pycuda import autoinit, gpuarray > import numpy as np > > a_cpu = np.array([0, 1], dtype = np.float32) > b_cpu = np.array([[0, 1, 2], [0, 1, 2]], dtype = np.float32) > dot_cpu = np.dot(a_cpu, b_cpu) #yelds a 1x3 np.array > > a_gpu = gpuarray.to_gpu(a_cpu) > b_gpu = gpuarray.to_gpu(b_cpu) > dot_gpu = gpuarray.dot(a_gpu,b_gpu) # yelds a 0d array??? > ########
GPUArray.dot is only good for vector.vector dot products right now. For now, the best advice is to implement a simple mat-vec kernel yourself. > So, I have two issues: > i) How to take the scalar result from dot_gpu? > ii) How to obtain the correct result? ( = numpy result) > > I could do the dot operation over each column, but then it will never > outperform the cpu equivalent, am I correct? Yes. Andreas _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
