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! :)

Thanks,
Dan Boswell
Risk Technology, BoAML
daniel.d.bosw...@baml.com

----------------------------------------------------------------------
This message w/attachments (message) is intended solely for the use of the 
intended recipient(s) and may contain information that is privileged, 
confidential or proprietary. If you are not an intended recipient, please 
notify the sender, and then please delete and destroy all copies and 
attachments, and be advised that any review or dissemination of, or the taking 
of any action in reliance on, the information contained in or attached to this 
message is prohibited. 
Unless specifically indicated, this message is not an offer to sell or a 
solicitation of any investment products or other financial product or service, 
an official confirmation of any transaction, or an official statement of 
Sender. Subject to applicable law, Sender may intercept, monitor, review and 
retain e-communications (EC) traveling through its networks/systems and may 
produce any such EC to regulators, law enforcement, in litigation and as 
required by law. 
The laws of the country of each sender/recipient may impact the handling of EC, 
and EC may be archived, supervised and produced in countries other than the 
country in which you are located. This message cannot be guaranteed to be 
secure or free of errors or viruses. 

References to "Sender" are references to any subsidiary of Bank of America 
Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are 
Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a 
Condition to Any Banking Service or Activity * Are Not Insured by Any Federal 
Government Agency. Attachments that are part of this EC may have additional 
important disclosures and disclaimers, which you should read. This message is 
subject to terms available at the following link: 
http://www.bankofamerica.com/emaildisclaimer. By messaging with Sender you 
consent to the foregoing.

Attachment: prefork.patch
Description: prefork.patch

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

Reply via email to