Manifolds: Using Multiprocessing with Functions causes Error

37 views
Skip to first unread message

Michael Jung

unread,
Oct 27, 2019, 5:58:16 AM10/27/19
to sage-devel
sage: Parallelism().set(nproc=4)
sage: M = Manifold(2, name='S2', latex_name=r'S^2', start_index=1)
sage: U = M.open_subset('U') ; V = M.open_subset('V')
sage: M.declare_union(U,V)   # M is the union of U and V
sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart()
sage: xy_to_uv = c_xy.transition_map(c_uv,
....:                               (x/(x^2+y^2), y/(x^2+y^2)),
....:                               intersection_name='W',
....:                               restrictions1= x^2+y^2!=0,
....:                               restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
sage: eU = c_xy.frame() ; eV = c_uv.frame()
sage: a = function('a')
sage: g = M.metric('g')
sage: g[eU,1,1], g[eU,2,2] = a(x,y), a(x,y)
sage: g[eV,1,1], g[eV,2,2] = a(u,v), a(u,v)
sage: nab = g.connection('nab')
---------------------------------------------------------------------------
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py", line 708, in __init__
    self._name = parent._create(value, name=name)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py", line 606, in _create
    self.set(name, value)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py", line 515, in set
    self.eval(cmd)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py", line 461, in _eval_line
    maxima_eval("#$%s$" % statement)
  File "sage/libs/ecl.pyx", line 804, in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:7779)
    lispargs = EclObject(list(args))
  File "sage/libs/ecl.pyx", line 669, in sage.libs.ecl.EclObject.__init__ (build/cythonized/sage/libs/ecl.c:7313)
    self.set_obj(python_to_ecl(args[0]))
  File "sage/libs/ecl.pyx", line 484, in sage.libs.ecl.python_to_ecl (build/cythonized/sage/libs/ecl.c:6357)
    L=cl_cons(python_to_ecl(pyobj[0]),Cnil)
  File "sage/libs/ecl.pyx", line 465, in sage.libs.ecl.python_to_ecl (build/cythonized/sage/libs/ecl.c:6051)
    return ecl_safe_read_string(s)
  File "sage/libs/ecl.pyx", line 385, in sage.libs.ecl.ecl_safe_read_string (build/cythonized/sage/libs/ecl.c:5530)
    o = ecl_safe_funcall(read_from_string_clobj,o)
  File "sage/libs/ecl.pyx", line 364, in sage.libs.ecl.ecl_safe_funcall (build/cythonized/sage/libs/ecl.c:5297)
    raise RuntimeError("ECL says: {}".format(
RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/michi/GitProjects/sage/local/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "sage/misc/fpickle.pyx", line 105, in sage.misc.fpickle.call_pickled_function (build/cythonized/sage/misc/fpickle.c:2340)
    res = eval("f(*args, **kwds)",sage.all.__dict__, {'args':args, 'kwds':kwds, 'f':f})
  File "<string>", line 1, in <module>
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/differentiable/levi_civita_connection.py", line 518, in make_Connect
    if ginv[i,s, chart]!=0:
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/chart_func.py", line 1098, in __ne__
    return not (self == other)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/chart_func.py", line 1070, in __eq__
    return bool(self.expr(self._calc_method._current) == other)
  File "sage/symbolic/expression.pyx", line 2919, in sage.symbolic.expression.Expression.__nonzero__ (build/cythonized/sage/symbolic/expression.cpp:19640)
    return test_relation_maxima(self)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/symbolic/relation.py", line 492, in test_relation_maxima
    m = relation._maxima_()
  File "sage/symbolic/expression.pyx", line 814, in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:7814)
    return super(Expression, self)._interface_(maxima)
  File "sage/structure/sage_object.pyx", line 675, in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:5540)
    X = I(s)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py", line 288, in __call__
    return cls(self, x, name=name)
  File "/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py", line 710, in __init__
    raise TypeError(x)
TypeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.
"""

The above exception was the direct cause of the following exception:

TypeError                                 Traceback (most recent call last)
<ipython-input-8-1fdb0ee7a7f9> in <module>()
----> 1 nab = g.connection('nab')

/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/differentiable/metric.py in connection(self, name, latex_name, init_coef)
    789             self._connection = LeviCivitaConnection(self, name,
    790                                                     latex_name=latex_name,
--> 791                                                     init_coef=init_coef)
    792         return self._connection
    793 

/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/differentiable/levi_civita_connection.py in __init__(self, metric, name, latex_name, init_coef)
    229             # the domain (i.e. disregarding the subcharts)
    230             for chart in self._domain.top_charts():
--> 231                 self.coef(chart._frame)
    232 
    233     def _repr_(self):

/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/manifolds/differentiable/levi_civita_connection.py in coef(self, frame)
    525 
    526                         # Computation and Assignation of values
--> 527                         for ii, val in make_Connect(listParalInput):
    528                             for jj in val:
    529                                 gam[jj[0],jj[1],jj[2],ii[0][1]] = jj[3]

/home/michi/GitProjects/sage/local/lib/python3.7/site-packages/sage/parallel/multiprocessing_sage.py in parallel_iter(processes, f, inputs)
     75     result = p.imap_unordered(call_pickled_function,
     76                               [(fp, t) for t in inputs])
---> 77     for res in result:
     78         yield res
     79     p.close()

/home/michi/GitProjects/sage/local/lib/python3.7/multiprocessing/pool.py in next(self, timeout)
    746         if success:
    747             return value
--> 748         raise value
    749 
    750     __next__ = next                    # XXX

TypeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.

This should not happen right? Or did I use functions wrong in this context? The non-multiprocessing computation works fine.

Thanks in advance and best regards
Michael

Eric Gourgoulhon

unread,
Oct 27, 2019, 6:50:37 AM10/27/19
to sage-devel
This is unfortunately a known bug: parallelism does not work with symbolic functions. The ticket devoted to this issue is

Best wishes,

Eric.

Reply all
Reply to author
Forward
0 new messages