scalene
scalene copied to clipboard
`elf_dynamic_array_reader.h` tag not found: no output without the `--cli` option
Describe the bug
The default settings of scalene
seem not to produce output in the stout, while everything is printed if I give the option --cli
.
A file called profile.json
is created, however.
To Reproduce
Steps to reproduce the behavior:
I am working in Ubuntu 21.10, within a pyenv-virtualenv
with
$ pip freeze
cloudpickle==2.0.0
colorama==0.4.4
commonmark==0.9.1
llvmlite==0.38.0
numpy==1.21.5
nvidia-ml-py==11.515.0
Pygments==2.11.2
rich==11.2.0
scalene==1.5.4
Also, I have google-chrome
installed, and the apt package google-chrome-stable
is at version 98.0.4758.102-1. This might be relevant (see below).
I make a simple test.py
file with the following content:
import numpy as np
x = np.linspace(0, 100, num=100_000)
np.cos(x)
np.sin(x)
Now, when I run scalene with the --cli
option everything is fine:
$ scalene --cli test.py
Memory usage: ▂▂▄▅▆▆███ (max: 8.24MB, growth rate: 105%)
test.py: % of time = 100.00% out of 0.27s.
╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷ ╷
│Time │–––––– │––––… │–––––– │Memory │–––––– │––––––––––– │Copy │
Line │Python │native │syst… │GPU │Python │peak │timeline/% │(MB/s) │test.py
╺━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
1 │ 16% │ 76% │ 8% │ │ 42% │ 4M │▂▃▄▅ 76% │ │import numpy as np
2 │ │ │ │ │ │ │ │ │
3 │ │ │ │ │ │ │ │ │x = np.linspace(0, 100, num=100_000)
4 │ │ │ │ │ │ │ │ │
5 │ │ │ │ │ 7% │ 2M │▂ 24% │ │np.cos(x)
6 │ │ │ │ │ │ │ │ │np.sin(x)
╵ ╵ ╵ ╵ ╵ ╵ ╵ ╵ ╵
Top AVERAGE memory consumption, by line:
(1) 5: 2 MB
(2) 1: 2 MB
Top PEAK memory consumption, by line:
(1) 1: 4 MB
(2) 5: 2 MB
However, when I simply run scalene I get:
$ scalene test.py
[0301/230221.000122:ERROR:elf_dynamic_array_reader.h(64)] tag not found
and a file named profile.json
gets generated (profile.zip), with what looks like correct information inside it.
Also, sometimes I have also been getting the slightly different output (not consistently reproducible even on my end, it happened one of the first times I ran this)
$ scalene --reduced-profile test.py
[0301/224033.189218:ERROR:elf_dynamic_array_reader.h(64)] tag not found
[0301/224033.215518:ERROR:directory_reader_posix.cc(42)] opendir /home/jacopo/.config/google-chrome/Crash Reports/attachments/12804d78-fb17-4df0-bfff-4cca586c46f1: No such file or directory (2)
During this, the google-chrome web browser was open and showed no signs of issues.
Expected behavior I'm not exactly sure what the expected behavior is here: in the README for scalene it currently says that the default output is to the stdout, which does not seem to be the case here, but it also looks like scalene is not trying to output there and instead it wants to somehow call the web browser and gets stuck there.
Still, I'm sure that raising an error and showing no output is abnormal.
Ah, we need to fix the README. It now tries to open a web browser if one is available, and it looks like it might be triggering a bug in Chromium.
https://forums.opensuse.org/showthread.php/560837-Chromium-browser-crashes-with-core-dump
Also, I was able to load your JSON file using the Scalene demo: http://plasma-umass.org/scalene-gui/. You might see if that works in your browser.
I see! Opening the JSON file with the Scalene demo works for me, it's weird that it doesn't when called from the command line...
Also, the bug report you linked is for chromium, while I'm running google-chrome
, which is slightly different I think (and non-FOSS, I admit).
Might be the same thing, but I thought I'd point that out.