[Numpy-discussion] GPU Numpy

Nicolas Pinto pinto@mit....
Fri Aug 21 19:19:13 CDT 2009


from gpunumpy import *
> x=zeros(100,dtype='gpufloat') # Creates an array of 100 elements on the GPU
> y=ones(100,dtype='gpufloat')
> z=exp(2*x+y) # z in on the GPU, all operations on GPU with no transfer
> z_cpu=array(z,dtype='float') # z is copied to the CPU
> i=(z>2.3).nonzero()[0] # operation on GPU, returns a CPU integer array

PyCuda already supports this through the gpuarray interface. As soon as
Nvidia allows us to combine Driver and Runtime APIs, we'll be able to
integrate libraries like CUBLAS, CUFFT, and any other runtime-depedent
library. We could probably get access to CUBLAS/CUFFT source code as Nvidia
released the 1.1 version in the past:
but it would be easier to just use the libraries (and 1.1 is outdated now).

For those of you who are interested, we forked python-cuda recently and
started to add some numpy "sugar". The goal of python-cuda is to
*complement* PyCuda by providing an equivalent to the CUDA Runtime API
(understand: not Pythonic) using automatically-generated ctypes bindings.
With it you can use CUBLAS, CUFFT and the emulation mode (so you don't need
a GPU to develop):



Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090821/b0abedb8/attachment.html 

More information about the NumPy-Discussion mailing list