Hello, everyone.

When using QEPCAD, the close() method isn't called on the spawned 
processes' pty descriptors, leading to each of said processes occupying its 
pty until the the script terminates. When the maximum number of ptys have 
been allocated, spawn() terminates with the error message "Pexpect: 
pty.fork() failed: out of pty devices".
The following code (attached as test-qepcad-error.py) triggers the error:

####
from sage.all import var
from sage.interfaces.qepcad import Qepcad

var('x')
while True:
  qe = Qepcad(x == x)
  qe.go()
  qe.go()
  qe.go()
  qe.finish()
  print qe.answer()
####

The sequence of calls is the same as when executing "qepcad(x == x)".
The following (attached as test-qepcad-noerror.py) has an ugly hack to 
close the pty descriptor, triggering no exception. 

####
from sage.all import var
from sage.interfaces.qepcad import Qepcad
import os

var('x')
while True:
  qe = Qepcad(x == x)
  qe.go()
  qe.go()
  qe.go()
  qe.finish()
  print qe.answer()
  qe._qex._expect.close()
  # Or:
  # os.close(qe._qex._expect.child_fd)
####

The spawn.close() function also has a timeout which would make 
QEPCAD-intensive programs annoying slow.
In both examples, you can "ls /dev/pts/ | wc -l" to see the number of used 
ptys while the program executes.
I'm using the os.close hack for the time being.

$ sage -v
Sage Version 6.4.1, Release Date: 2014-11-23
$ uname -a
Linux cuda 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 
x86_64 x86_64 x86_64 GNU/Linux
$ lshw -class processor
  *-cpu                   
       product: Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
       vendor: Intel Corp.
       physical id: 1
       bus info: cpu@0
       size: 1200MHz
       capacity: 1200MHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 
apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss 
ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc arch_perfmon pebs 
bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq 
dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 
sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb 
xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid cpufreq

Thanks for the help.
Cheers,

Henrique.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
from sage.all import var
from sage.interfaces.qepcad import Qepcad

var('x')
while True:
  qe = Qepcad(x == x)
  qe.go()
  qe.go()
  qe.go()
  qe.finish()
  print qe.answer()

from sage.all import var
from sage.interfaces.qepcad import Qepcad
import os

var('x')
while True:
  qe = Qepcad(x == x)
  qe.go()
  qe.go()
  qe.go()
  qe.finish()
  print qe.answer()
  qe._qex._expect.close()
  # Or:
  # os.close(qe._qex._expect.child_fd)

Reply via email to