On 09/04/2010 18:07, Andreas Klöckner wrote:
On Freitag 09 April 2010, Dan Goodman wrote:
Hi all,

I'm having a problem using multiprocessing and pycuda on linux. I guess
I'm getting something fairly basic wrong, but couldn't find any
documentation. I expected the example below to work (and it does work on
Windows), but on Linux nothing happens, and nvcc gets stuck using 100%
processor usage and never returning:

from numpy import ones, int32
import multiprocessing
import pycuda
import pycuda.autoinit as autoinit
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
from pycuda.compiler import SourceModule

def doit(x):

      code = '''
      __global__ void test(double *x, int n)
      {
       int i = blockIdx.x * blockDim.x + threadIdx.x;
       if(i>=n) return;
       x[i] *= 2.0;
      }
      '''

      mod = SourceModule(code)
      f = mod.get_function('test')
      x = gpuarray.to_gpu(ones(100))
      f(x, int32(100), block=(100,1,1))
      return x.get()

if __name__=='__main__':

#    doit(1)

      pool = multiprocessing.Pool(1)
      result = pool.map(doit, [0])
      print result

I'm wondering if it has something to do with the way that
multiprocessing uses forking on Linux but not on Windows?

Thanks for any suggestions!

Btw, I'm on 64 bit Linux, GTX 280, and get the same problem with
OpenSUSE and Ubuntu.

Works for me on 2.5 with mp 2.6.2.1. What nvcc? Mine:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Fri_Feb_19_19:12:59_PST_2010
Cuda compilation tools, release 3.0, V0.2.1221

Andreas

Here are my versions:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Thu_Jul_30_09:24:36_PDT_2009
Cuda compilation tools, release 2.3, V0.2.1221

pycuda.VERSION
(0, 93)

Python 2.6.2

multiprocessing.__version__
'0.70a1'

Maybe I should try upgrading to nvcc 3.0? Do I need to use the 0.94 version of pycuda too?

Dan

_______________________________________________
PyCUDA mailing list
pyc...@host304.hostmonster.com
http://host304.hostmonster.com/mailman/listinfo/pycuda_tiker.net

Reply via email to