If I change it to:

x = gpuarray.to_gpu(zeros(10, numpy.float32))
src = '''
__global__ void f(float *x)
{
 x[0] = exp(x[0]);
}
'''

Then it works fine, as it does if I write exp(0.0f) in the old code. My NVIDIA card does support double though, so it should work in either case.

Could it be a 32/64 bit issue? I have a 64 bit Win7 machine, but my Python, numpy, etc. are 32 bit and so I had to compile PyCUDA using 32 bits (but the NVIDIA driver is 64 bit). Probably this shouldn't work at all, but it seems to work fine for everything except exp.

Dan

On 03/03/2010 18:35, Ian Ozsvald wrote:
For reference - it works fine on my machine.  Using my machine (WinXP
32 bit, CUDA 2.3, pyCUDA 0.94 latest master, 9800GT) I get:
In [19]: %run dangoodman.py
kernel.cu
tmpxft_00000ebc_00000000-3_kernel.cudafe1.gpu
tmpxft_00000ebc_00000000-8_kernel.cudafe2.gpu
ptxas C:\DOCUME~1\parc\LOCALS~1\Temp/tmpxft_00000ebc_00000000-4_kernel.ptx,
line 66; warning : Double is not supported.
Demoting to float
[  5.26354425e-315   0.00000000e+000   0.00000000e+000   0.00000000e+000
    0.00000000e+000   0.00000000e+000   0.00000000e+000   0.00000000e+000
    0.00000000e+000   0.00000000e+000]

If I replace exp() with sin() then that works too (but the output in
x[0] is 0 as sin(0) is 0).

Noting Fabrizio's point the compiler is warning about Double in the
above output.

i.

On 3 March 2010 16:59, Dan Goodman<dg.pyc...@thesamovar.net>  wrote:
Hi all,

I have a really weird bug that I can't explain at all. The following code
crashes:

from numpy import zeros
from pycuda import autoinit
from pycuda import gpuarray
from pycuda import compiler
x = gpuarray.to_gpu(zeros(10))
src = '''
__global__ void f(double *x)
{
  x[0] = exp(0.0);
}
'''
gpu_mod = compiler.SourceModule(src)
gpu_func = gpu_mod.get_function("f")
gpu_func(x, block=(1,1,1), grid=(1,1))
print x.get()

Now if I replace exp(0.0) with just 0.0 it works fine. It doesn't crash with
sin(0.0) nor with expf. The output I get when I run it is:

[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: unknown
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuModuleUnload failed: unknown

I'm running PyCUDA 0.94. Not sure how to tell you which version exactly, but
the top line of the git log is:

commit 9528d732e1179aea0d0eacd9a3e12423a1545728
Merge: 955c1e5 9f26615
Author: Andreas Kloeckner<inf...@tiker.net>
Date:   Sun Jan 31 12:23:50 2010 -0500
    Merge branch 'master' of t:src/pycuda

I'm running the CUDA 3.0 beta on a GTX 295.

Any ideas?

Dan

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






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

Reply via email to