sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 480 forks source link

crun profiler Ipython magic fails #28226

Open videlec opened 5 years ago

videlec commented 5 years ago

Even though I have the google perf tools installed (archlinux) the IPython magic command %crun consistently fails

sage: %crun (2**179 + 1).factor()
Using local file /opt/sage/sage-py3-gcc/local/bin/python3.
Using local file /home/vincent/.sage/temp/mangouste/1954/tmp_yf6kdnqc.perf.
substr outside of string at /usr/bin/pprof line 3695.
Use of uninitialized value in string eq at /usr/bin/pprof line 3695.
substr outside of string at /usr/bin/pprof line 3697.
Use of uninitialized value in string eq at /usr/bin/pprof line 3697.
/home/vincent/.sage/temp/mangouste/1954/tmp_yf6kdnqc.perf: header size >= 2**16
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-46-97fe85432fe5> in <module>()
----> 1 get_ipython().magic('crun (2**179 + 1).factor()')

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
   2158         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2159         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2160         return self.run_line_magic(magic_name, magic_arg_s)
   2161 
   2162     #-------------------------------------------------------------------------

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
   2079                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2080             with self.builtin_trap:
-> 2081                 result = fn(*args,**kwargs)
   2082             return result
   2083 

</opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/decorator.py:decorator-gen-113> in crun(self, s)

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/sage/repl/ipython_extension.py in crun(self, s)
     91         """
     92         import sage.misc.gperftools
---> 93         sage.misc.gperftools.crun(s, evaluator=self.shell.ex)
     94 
     95     @line_magic

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/sage/misc/gperftools.py in crun(s, evaluator)
    374     finally:
    375         prof.stop()
--> 376     prof.top()
    377 
    378 

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/sage/misc/gperftools.py in top(self, cumulative)
    297             args += ['--cum']
    298         args += ['--text', self._executable(), self.filename()]
--> 299         self._call_pprof(*args)
    300 
    301     def save(self, filename, cumulative=True, verbose=True):

/opt/sage/sage-py3-gcc/local/lib/python3.7/site-packages/sage/misc/gperftools.py in _call_pprof(self, *args, **kwds)
    271         """
    272         from subprocess import check_call
--> 273         check_call([self._pprof()] + list(args), **kwds)
    274 
    275     def top(self, cumulative=True):

/opt/sage/sage-py3-gcc/local/lib/python3.7/subprocess.py in check_call(*popenargs, **kwargs)
    345         if cmd is None:
    346             cmd = popenargs[0]
--> 347         raise CalledProcessError(retcode, cmd)
    348     return 0
    349 

CalledProcessError: Command '['pprof', '--cum', '--text', '/opt/sage/sage-py3-gcc/local/bin/python3', '/home/vincent/.sage/temp/mangouste/1954/tmp_yf6kdnqc.perf']' returned non-zero exit status 1.

Component: interfaces

Keywords: days100

Issue created by migration from https://trac.sagemath.org/ticket/28226

embray commented 4 years ago
comment:1

Ticket retargeted after milestone closed

mkoeppe commented 4 years ago
comment:2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

mkoeppe commented 3 years ago
comment:4

Moving to 9.4, as 9.3 has been released.