On Fri, 18 Nov 2011 07:24:32 +0000, "Boswell, Dan - GT&O JPN-MLJS" 
<daniel.d.bosw...@baml.com> wrote:
> Hi all,
> 
> There's a bug in python (http://bugs.python.org/issue3905) that affects 
> PyTools when PyCUDA creates a subprocess to run nvcc.  Fortunately this is 
> only the case for Windows machines, and specifically when PyCUDA is run in a 
> UI application (shell) which itself is run from the console; something that's 
> probably not very common.  Unfortunately for me, that is _exactly_ the 
> scenario for the IDE/shell that we use where I work (Windows XP, Python 
> 2.6.5).
> 
> Although the python bug remains open, there's a simple workaround which 
> involves passing subprocess.PIPE as the argument to _all_ the std* keywords 
> when using subprocess.Popen in prefork.py.  I've attached a patch, but let me 
> know if this is not the correct forum to do so, or if there's an alternative 
> process (e.g. a git pull request).
> 
> 
> One simple way of reproducing this is to use IDLE:
> 
> 1. From the Windows console run 'pythonw idlelib\idle.pyw -n', then in IDLE:
>   
>    >>> # This fails
>    >>> from subprocess import Popen, PIPE
>    >>> Popen(['nvcc', '--version'], stdout=PIPE)
> 
>    >>> # This works
>    >>> Popen(['nvcc', '--version'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
> 
> 2. Or run hello_gpu.py in that IDLE window
> 
> And you should get an error like the following
>       
>    [...]
>    File "C:\home\dbo\argh\ext\win32_vc9\lib\python2.6\subprocess.py", line 
> 773, in _make_inheritable
>       DUPLICATE_SAME_ACCESS)
>    WindowsError: [Error 6] The handle is invalid
> 
> 
> Hope that helps, and it would be good to get this into the official
> PyTools repo/distribution so that we don't have to maintain a patched
> version here! :)

Done. I've also uploaded 2011.5 with the patch on board, to make your
life easier.

Andreas

Attachment: pgpkiHYtgfS8F.pgp
Description: PGP signature

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

Reply via email to