Changes between Version 16 and Version 19 of Ticket #27492


Ignore:
Timestamp:
Dec 16, 2020, 10:14:52 AM (2 years ago)
Author:
egourgoulhon
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27492 – Description

    v16 v19  
    1 As reported in this [https://groups.google.com/forum/#!topic/sage-devel/k4W5eo4nQ50 sage-devel post] (see also [https://groups.google.com/d/msg/sage-devel/I00PGgyIZYo/RkCYmlmZEAAJ this one]), Sage fails silently on some parallelized computations involving symbolic functions. A minimal example with
    2 Sage 8.7.beta7 (**python2** version) is
     1Sage fails in parallelized computations on tensor fields involving symbolic functions:
    32{{{
    43sage: Parallelism().set(nproc=2)
     
    1110sage: v[0], v[1] = 1 + x*y, -x^2
    1211sage: s = t.contract(v)  # parallelized computation occurs here
    13 sage: s0 = s[0].expr(); s0  # symbolic expression OK
    14 -x^3 - (x^2 - x*f(x))*y + f(x)
    15 sage: s0.coefficient(a, 1)  # incorrect output
    16 0
    17 }}}
    18 The correct result should be `x*y + 1`. The latter is obtained if one sets `nproc=1` in the first line (i.e. no parallelization). Furthermore, if one replaces the line
    19 {{{
    20 sage: a = function('f')(x)
    21 }}}
    22 by
    23 {{{
    24 sage: a = sin(x)
    25 }}}
    26 one gets a correct result as well.
    27 
    28 With the **python3** version of Sage 8.7.beta7, one does not get a silent failure but an error message when the parallel computation is performed, i.e. at the line `s = t.contract(v)`:
    29 {{{
    30 TypeError                                 Traceback (most recent call last)
    31 /home/eric/sage/py3/local/lib/python3.6/site-packages/sage/symbolic/function_factory.py in function_factory(name, nargs, latex_name, conversions, evalf_params_first, eval_func, evalf_func, conjugate_func, real_part_func, imag_part_func, derivative_func, tderivative_func, power_func, series_func, print_func, print_latex_func)
    32     109             setattr(NewSymbolicFunction, '_%s_'%func_name, func)
    33     110
    34 --> 111     return NewSymbolicFunction()
    35     112
    36     113
    37 ...
    38 TypeError: expected str, bytes found
    39 }}}
    40 The full error message is attached.
    41 
    42 **UPDATE** (1 Aug. 2020): the parallel computation still fails in Sage 9.2.beta6, but this time the error message is different:
    43 {{{
    44 sage: s = t.contract(v)
    4512---------------------------------------------------------------------------
    4613RemoteTraceback                           Traceback (most recent call last)
     
    8451}}}
    8552The full error message is attached.
     53
     54This issue has been reported in various places previously. With old Python-2 Sage it resulted in a silent error, see
     55this [https://groups.google.com/forum/#!topic/sage-devel/k4W5eo4nQ50 sage-devel post] (see also [https://groups.google.com/d/msg/sage-devel/I00PGgyIZYo/RkCYmlmZEAAJ this one]).