On 2/16/2011 12:24 AM, Nathan Hillier wrote:
I'm back!

Running the following code:


# Sample source code from the Tutorial Introduction in the documentation.
import pycuda.autoinit
import pycuda.driver as drv
import numpy

from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
   const int i = threadIdx.x;
   dest[i] = a[i] * b[i];
}
""")

multiply_them = mod.get_function("multiply_them")

a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)

dest = numpy.zeros_like(a)
multiply_them(
         drv.Out(dest), drv.In(a), drv.In(b),
         block=(400,1,1), grid=(1,1))

print(dest-a*b)



generates this error:


Traceback (most recent call last):
   File "C:\Users\Nathan\workspace\PyCUDA Demo\src\main.py", line 13, in
<module>
""")
   File "C:\Python27\lib\site-packages\pycuda\compiler.py", line 238, in
__init__
     self.module = module_from_buffer(cubin)
pycuda._driver.LogicError: cuModuleLoadDataEx failed: invalid image -


At this point I feel I should probably mention my set up. I'm currently
running:
CUDA 3.2
Boost 1.44
The Python 2.7 Win32 PyCUDA binary from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycuda

I followed the tutorial from
http://wiki.tiker.net/PyCuda/Installation/Windows to get set up.
However, I'm not using Visual Studios to run the program. I'm not really
sure how/why you would use VS for python development. So I've been
attempting to use PyDev for Eclipse. This initially didn't work as nvcc
couldn't find the appropriate header files (located in the Visual Studio
include directory). So I tried editing the PATH and CUDA_INC_PATH
variables to no effect. Then I tried editing nvcc.profile which resulted
in a permission denied error when it tried to access the VS include
directory. In the end I just copied the contents of the VS include
directory into Python27\include\pycuda, which worked, but it seems
messy, and like it will probably become a problem for me later.

Anyway, if anyone has an idea on the cause of the above error or how I
should proceed with PyCuda in general, I would greatly appreciate the help.

Sorry if this has been overly verbose or broad.

Nathan



Boost should not be necessary if you use the precompiled pyCUDA package.

You could try:

1) run `C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat x86` to setup the msvc compiler environment before you run your script. You might have to adjust the actual path.

2) In case you have a 64 bit Windows OS and the CUDA toolkit installed, make sure the CUDA environment variables, CUDA_BIN_PATH etc., are set for 32 bit.

3) run your script from the same command prompt you used for 1) and 2), not from Eclipse, which might use a different environment.

4) Delete the CUDA cache directory. I found this necessary sometimes when switching between 32 and 64 bit CUDA.


Christoph


_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to