#6232: Consider CADO-NFS for inclusion
-------------------------------------------------+-------------------------
Reporter: malb | Owner: malb
Type: enhancement | Status: new
Priority: minor | Milestone: sage-
Component: packages: optional | wishlist
Keywords: linear algebra, factoring, | Resolution:
number theory | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------------------------+-------------------------
Changes (by zimmerma):
* cc: wbhart (added)
Comment:
I use this ticket to report an issue related to CADO-NFS. I'm not sure the
problem is due to Sage. I could open a separate ticket if needed.
The issue is the following. Some colleague wrote the following Sage code
to call CADO-NFS
from Sage:
{{{
import subprocess
def my_exec_factor(nbr):
cmd = ['/tmp/cado-nfs-1.1/factor.sh', str(nbr)]
process = subprocess.Popen(cmd, stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
print "Output :"
print output
raise subprocess.CalledProcessError(retcode, cmd)
return output
res=my_exec_factor(90377629292003121684002147101760858109247336549001090677693)
r=[]
for i in res.splitlines()[-6].split(' '):
r.append(Integer(i))
print r
}}}
When used with CADO-NFS 1.1, this code works fine.
However with CADO-NFS 2.1.1 it fails:
{{{
sage: %runfile /tmp/garambois.sage
Output :
(debug mode, temporary files will be kept in /tmp/cado.mru0w9AeIM)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File
"/usr/local/sage-6.0-x86_64-Linux/local/lib/python/encodings/__init__.py",
line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Current thread 0x00002b81297f1700 (most recent call first):
/tmp/cado-nfs-2.1.1/factor.sh: line 242: 13296 Aborted
"${TIMEOUT[@]}" $PYTHON $cadofactor "$t/param" N=$n
tasks.execpath="$bindir" tasks.threads=$cores tasks.workdir="$t"
slaves.hostnames="$hostnames" slaves.nrclients=$slaves
slaves.scriptpath="$scriptpath" "$server_address"
slaves.basepath="$t/client/" "$@"
FAILED ; data left in /tmp/cado.mru0w9AeIM
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call
last)
<ipython-input-1-cf20ddc02bb1> in <module>()
----> 1 get_ipython().magic(u'runfile /tmp/garambois.sage')
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2134 magic_name, _, magic_arg_s = arg_s.partition(' ')
2135 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2136 return self.run_line_magic(magic_name, magic_arg_s)
2137
2138
#-------------------------------------------------------------------------
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/IPython/core/interactiveshell.pyc in run_line_magic(self,
magic_name, line)
2060 args.append(sys._getframe(stack_depth).f_locals)
2061 with self.builtin_trap:
-> 2062 result = fn(*args)
2063 return result
2064
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/sage/misc/sage_extension.pyc in runfile(self, s)
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
189 # but it's overkill for just that one bit of state.
190 def magic_deco(arg):
--> 191 call = lambda f, *a, **k: f(*a, **k)
192
193 if callable(arg):
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/sage/misc/sage_extension.pyc in runfile(self, s)
77 """
78 from sage.misc.preparser import load_wrap
---> 79 return self.shell.ex(load_wrap(s, attach=False))
80
81 @line_magic
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/IPython/core/interactiveshell.pyc in ex(self, cmd)
2382 """Execute a normal python statement in user namespace."""
2383 with self.builtin_trap:
-> 2384 exec cmd in self.user_global_ns, self.user_ns
2385
2386 def ev(self, expr):
<string> in <module>()
/usr/local/sage-6.0-x86_64-Linux/local/lib/python2.7/site-
packages/sage/misc/preparser.pyc in load(filename, globals, attach)
1770 # Preparse in memory only for speed.
1771 exec_file_is(fpath)
-> 1772 exec preparse_file(open(fpath).read()) + "\n" in
globals
1773 elif fpath.endswith('.spyx') or fpath.endswith('.pyx'):
1774 exec_file_is(fpath)
<string> in <module>()
<string> in my_exec_factor(nbr)
CalledProcessError: Command '['/tmp/cado-nfs-2.1.1/factor.sh',
'90377629292003121684002147101760858109247336549001090677693']' returned
non-zero exit status 134
}}}
My guess is that there is an interaction between the version of Python
used by CADO-NFS 2.1.1 (Python 3) and the one used by Sage (Python 2.7).
(Note that CADO-NFS 1.1 did not use Python but Perl instead.)
Can anybody reproduce that problem? Any idea how to solve it?
Paul
--
Ticket URL: <http://trac.sagemath.org/ticket/6232#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.