[PyCUDA] PyCuda include path

2010-06-12 Thread Bryan Tong Minh
I could not find a bugtracker, so I'm posting this patch on this mailing list.

PyCuda had problems finding its header files using Python 2.6 on Windows. This
is because it is installed in Lib\site-packages\pycuda, while the header files
reside in Include\pycuda. To solve this, I replaced _find_pycuda_include_path()
in compiler.py with the attached code


Best regards,
Bryan


def _find_pycuda_include_path():
from imp import find_module
file, pathname, descr = find_module(pycuda)

from os.path import join, exists
installed_path = join(pathname, .., include, pycuda)
installed_path2 = join(pathname, .., '..', '..', include, pycuda)

development_path = join(pathname, .., src, cuda)
development_path2 = join(pathname, .., .., .., src, cuda)

import sys
usr_path = /usr/include/pycuda
usr_local_path = /usr/local/include/pycuda
prefix_path = join(sys.prefix, include , pycuda)

if exists(installed_path):
return installed_path
elif exists(installed_path2):
return installed_path2
elif exists(development_path):
return development_path
elif exists(development_path2):
return development_path2
else:
if sys.platform == linux2:
if exists(prefix_path):
return prefix_path
elif exists(usr_path):
return usr_path
elif exists(usr_local_path):
return usr_local_path

raise RuntimeError(could not find path to PyCUDA's C header files)



___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda


Re: [PyCUDA] PyCuda include path

2010-06-12 Thread Vu Nguyen
Bryan Tong Minh bryan.tongm...@... writes:

 
 I could not find a bugtracker, so I'm posting this patch on this mailing list.
 
 PyCuda had problems finding its header files using Python 2.6 on Windows. This
 is because it is installed in Lib\site-packages\pycuda, while the header files
 reside in Include\pycuda. To solve this, I replaced 
_find_pycuda_include_path()
 in compiler.py with the attached code
 
 Best regards,
 Bryan
 
 def _find_pycuda_include_path():
 from imp import find_module
 file, pathname, descr = find_module(pycuda)
 
 from os.path import join, exists
 installed_path = join(pathname, .., include, pycuda)
 installed_path2 = join(pathname, .., '..', '..', include, pycuda)
 
 development_path = join(pathname, .., src, cuda)
 development_path2 = join(pathname, .., .., .., src, cuda)
 
 import sys
 usr_path = /usr/include/pycuda
 usr_local_path = /usr/local/include/pycuda
 prefix_path = join(sys.prefix, include , pycuda)
 
 if exists(installed_path):
 return installed_path
 elif exists(installed_path2):
 return installed_path2
 elif exists(development_path):
 return development_path
 elif exists(development_path2):
 return development_path2
 else:
 if sys.platform == linux2:
 if exists(prefix_path):
 return prefix_path
 elif exists(usr_path):
 return usr_path
 elif exists(usr_local_path):
 return usr_local_path
 
 raise RuntimeError(could not find path to PyCUDA's C header files)
 
 

Thank you, this is a much better fix (I returned the absolute path, which 
worked 
for me).

I have gotten pycuda to work with Enthought Python distribution. However, I get 
this warning:

Warning (from warnings module):
  File C:\Enthought Python\lib\site-packages\pycuda\compiler.py, line 110
+stdout+stderr)
UserWarning: The CUDA compiler suceeded, but said the following:
kernel.cu
tmpxft_158c_-3_kernel.cudafe1.gpu
tmpxft_158c_-8_kernel.cudafe2.gpu

Is this something I should be worried about or can I just remove this check 
from 
compiler? It gives correct results, but this warning always shows up.

When I try using pycuda with Python(x,y), I always get ImportError: DLL 
invalid 
memory access originated from driver.py 1st line: import _driver. But I'm fine 
with Enthought's.

Thank you again.
-VN


___
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda