On Tue, Jun 6, 2017 at 3:18 PM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote: > Do you know about sage.misc.citation.get_systems()? > > It's supposed to tell which underlying "system" (library, package, ...) is > used for a particular computation. > > One example from a docstring: > > sage: from sage.misc.citation import get_systems > sage: get_systems('((x+1)^2).expand()') > ['ginac'] > > This is implemented by using cProfile to look at which modules implement the > functions called when executing the code. > > The problem is that this is totally unreliable when Cython is compiled > without profiling support (which is the default). The above example only > works because `Expression.expand()` is called by Python instead of Cython. > If that call would be inside some other Cython code, then Python's profiler > would not detect it: > > sage: cython('def callexpand(x): return x.expand()') > sage: from sage.misc.citation import get_systems > sage: get_systems('callexpand(((x+1)^2))') > [] > > > So what should we do? > > (A) Silently ignore this issue (status quo). > > (B) Give a warning when get_systems() is called when Cython profiling was > not enabled. > > (C) Deprecate get_systems() completely. > > > I am asking because #22747 (compiling Cython code with binding=True) will > "break" profiling even further as even the top-level call of > Expression.expand() would not be detected as something to be entered in the > profiler.
I wonder if there isn't at least some partially technical solution to this, such as providing a way to manually list systems/libraries used by a specific function, and make that easily introspectable. Of course, this is far from foolproof--the developer would have to hand-code it, and it might not remain accurate. Absent something like that, I would give a warning,along with instructions to rebuild with Cython profiling enabled or something. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.