Is it possible that code works on local machine but hangs on remote?

29 views
Skip to first unread message

Paul Royik

unread,
Nov 23, 2015, 12:31:25 PM11/23/15
to sympy
I noticed this issue with simplify function.
Is this possible?

Ondřej Čertík

unread,
Nov 23, 2015, 12:42:58 PM11/23/15
to sympy
On Mon, Nov 23, 2015 at 10:31 AM, Paul Royik <distan...@gmail.com> wrote:
> I noticed this issue with simplify function.
> Is this possible?

It's possible, e.g. maybe you use a different Python or SymPy
versions, perhaps you executed things differently, or perhaps there is
some hardware difference that causes Python to behave differently
(e.g. cache things differently).

If you post us more information, we can have a look at what is going on.

Ondrej

Paul Royik

unread,
Nov 23, 2015, 12:55:03 PM11/23/15
to sympy
Python 2.7, last version of sympy.
Code is absolutely the same.

How to detect hardware difference? How to clear cache?

What info should I post?

Ondřej Čertík

unread,
Nov 23, 2015, 1:53:45 PM11/23/15
to sympy
Is it running the the exact same hardware?

Cache is clear when you start it a script. You can also clear it by hand:

https://github.com/sympy/sympy/wiki/Faq#how-do-i-clear-the-cache

Send a minimal script that hangs, and we can try it on different
computers and see if we can reproduce the issue. Then we'll go from
there.

Ondrej
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/fb3fa210-3c73-4ae1-b8d3-aa00351a73aa%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Paul Royik

unread,
Nov 23, 2015, 1:56:53 PM11/23/15
to sympy
minimal script is simplify(3*b**(1/Integer(3))-3, fu=True)

Ondřej Čertík

unread,
Nov 23, 2015, 2:01:26 PM11/23/15
to sympy
I had to also execute var("b"):

In [1]: var("b")
Out[1]: b

In [2]: simplify(3*b**(1/Integer(3))-3, fu=True)
Out[2]:
3 ___
3⋅╲╱ b - 3


It return immediately. Can you run this on your remote machine, let it
run for a while in an IPython notebook and then hit ctrl-c? It should
print a stacktrace. We'll have to debug it.

When you say you use the latest sympy, do you mean the latest release
(0.7.6) or the latest git version
(bf990d085afe47bbdde420c5e2e271a01377c487)?

Ondrej
> https://groups.google.com/d/msgid/sympy/37b48ecc-ed70-4835-9086-3e4e11202302%40googlegroups.com.

Ondřej Čertík

unread,
Nov 23, 2015, 2:02:12 PM11/23/15
to sympy
On Mon, Nov 23, 2015 at 12:01 PM, Ondřej Čertík <ondrej...@gmail.com> wrote:
> I had to also execute var("b"):
>
> In [1]: var("b")
> Out[1]: b
>
> In [2]: simplify(3*b**(1/Integer(3))-3, fu=True)
> Out[2]:
> 3 ___
> 3⋅╲╱ b - 3
>
>
> It return immediately. Can you run this on your remote machine, let it
> run for a while in an IPython notebook and then hit ctrl-c? It should
> print a stacktrace. We'll have to debug it.

I meant to write in the IPython console/terminal. Or in some kind of a
debugger, so that you can the stack trace.

Ondrej

Aaron Meurer

unread,
Nov 23, 2015, 2:03:10 PM11/23/15
to sy...@googlegroups.com
What are the different results that you get? And how is b defined (are
there any assumptions on it)?

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/37b48ecc-ed70-4835-9086-3e4e11202302%40googlegroups.com.

Paul Royik

unread,
Nov 23, 2015, 2:54:25 PM11/23/15
to sympy
Found code that doesn't work:

simplify(parse_expr('3*b**(333333333333333/1000000000000000) - 3'),fu=True)

This hangs on remote.
When I hit Ctrl+C, it gives

/home/simamura/lib/python2.7/sympy/polys/polytools.pyc in cancel(f, *gens, **args)
   6228
   6229     try:
-> 6230         (F, G), opt = parallel_poly_from_expr((p, q), *gens, **args)
   6231     except PolificationFailed:
   6232         if not isinstance(f, (tuple, Tuple)):

/home/simamura/lib/python2.7/sympy/polys/polytools.pyc in parallel_poly_from_expr(exprs, *gens, **args)
   4123     """Construct polynomials from expressions. """
   4124     opt = options.build_options(gens, args)
-> 4125     return _parallel_poly_from_expr(exprs, opt)
   4126
   4127

/home/simamura/lib/python2.7/sympy/polys/polytools.pyc in _parallel_poly_from_expr(exprs, opt)
   4211     for monoms, coeffs in zip(all_monoms, all_coeffs):
   4212         rep = dict(list(zip(monoms, coeffs)))
-> 4213         poly = Poly._from_dict(rep, opt)
   4214         polys.append(poly)
   4215

/home/simamura/lib/python2.7/sympy/polys/polytools.pyc in _from_dict(cls, rep, opt)
    146                 rep[monom] = domain.convert(coeff)
    147
--> 148         return cls.new(DMP.from_dict(rep, level, domain), *gens)
    149
    150     @classmethod

/home/simamura/lib/python2.7/sympy/polys/polyclasses.pyc in from_dict(cls, rep, lev, dom)
    257     def from_dict(cls, rep, lev, dom):
    258         """Construct and instance of ``cls`` from a ``dict`` representation. """
--> 259         return cls(dmp_from_dict(rep, lev, dom), dom, lev)
    260
    261     @classmethod

/home/simamura/lib/python2.7/sympy/polys/densebasic.pyc in dmp_from_dict(f, u, K)
    993     """
    994     if not u:
--> 995         return dup_from_dict(f, K)
    996     if not f:
    997         return dmp_zero(u)

/home/simamura/lib/python2.7/sympy/polys/densebasic.pyc in dup_from_dict(f, K)
    946
    947         for k in xrange(n, -1, -1):
--> 948             h.append(f.get((k,), K.zero))
    949
    950     return dup_strip(h)

Paul Royik

unread,
Nov 23, 2015, 2:57:17 PM11/23/15
to sympy
On my local machine I got overflowerror that is silently ignored.


On Monday, November 23, 2015 at 9:03:10 PM UTC+2, Aaron Meurer wrote:

Aaron Meurer

unread,
Nov 23, 2015, 3:46:44 PM11/23/15
to sy...@googlegroups.com
It's likely a memory difference. SymPy is trying to use a dense
representation to represent a degree 333333333333333 polynomial, i.e.,
create a list with 333333333333333 elements. This is going to fail no
matter what machine you run it on. This is really an issue with SymPy
(it should be using a sparse representation).

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/99c58a4f-14d9-4afa-95a0-6f298dfc2c04%40googlegroups.com.

Paul Royik

unread,
Nov 23, 2015, 4:09:50 PM11/23/15
to sympy
On my local machine I got OverflowError can convert to python long...

Ondřej Čertík

unread,
Nov 24, 2015, 4:59:52 PM11/24/15
to sympy
Perfect, I think you found what the problem is that explains all the symptoms.

Ondrej
> https://groups.google.com/d/msgid/sympy/46240e63-81a7-49fb-b75f-d0bffa754bf1%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages