Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark Cinder vs. Cpython performance; improve pipeline and performance of the Cinder build #72

Open
rtindru opened this issue May 2, 2022 · 15 comments

Comments

@rtindru
Copy link

rtindru commented May 2, 2022

The current open source build of Cinder could be improved in a couple of ways
[ ] Benchmark the performance of Cinder open source build vs. Cpython
[ ] Incorporate best practices in the open source build pipeline
[ ] Improve the performance of the final build

CC: @itamaro

@rtindru rtindru changed the title Benchmark Cinder vs. Cpython performance; improve performance of the Cinder build time process Benchmark Cinder vs. Cpython performance; improve pipeline and performance of the Cinder build May 2, 2022
@itamaro
Copy link
Contributor

itamaro commented May 2, 2022

thanks for working on this @rtindru !

another potentially useful resource for building python might be the the "official docker build" - check out https://github.com/docker-library/python/blob/master/3.8/bullseye/Dockerfile#L44-L52 for example
(afaik this is a debian build, and we're building on a fedora-based image, but I'm guessing the builds flags are still applicable)

@itamaro
Copy link
Contributor

itamaro commented May 2, 2022

@kmod could you share the details of the benchmarks you ran?

@rtindru
Copy link
Author

rtindru commented May 2, 2022

Steps to run pyperformance benchmark

Setup

I ran ./configure && make

Install pip and pyperformance inside the docker container

[root@c02db7e771b4 vol]# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
[root@c02db7e771b4 vol]# python3.8 get-pip.py
[root@c02db7e771b4 vol]# pip -V
pip 22.0.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
[root@c02db7e771b4 vol]# python3 -V
Python 3.8.7

[root@c02db7e771b4 vol]# pip install pyperformance
Successfully installed packaging-21.3 pyparsing-3.0.8 pyperf-2.3.1 pyperformance-1.0.5 toml-0.10.2

Run the benchmark on python3.8

pyperformance run --python=/usr/bin/python3.8 -o py38.json
[root@c02db7e771b4 vol]# pyperformance show py38.json
Performance version: 1.0.5
Report on Linux-5.10.47-linuxkit-x86_64-with-glibc2.2.5
Number of logical CPUs: 4
Start date: 2022-05-02 21:49:38.051577
End date: 2022-05-02 22:34:01.938257

### 2to3 ###
Mean +- std dev: 686 ms +- 78 ms

### chameleon ###
Mean +- std dev: 19.9 ms +- 0.3 ms

### chaos ###
Mean +- std dev: 248 ms +- 36 ms

### crypto_pyaes ###
Mean +- std dev: 216 ms +- 14 ms

### deltablue ###
Mean +- std dev: 11.7 ms +- 0.3 ms

### django_template ###
Mean +- std dev: 108 ms +- 12 ms

### dulwich_log ###
Mean +- std dev: 126 ms +- 3 ms

### fannkuch ###
Mean +- std dev: 1.02 sec +- 0.07 sec

### float ###
Mean +- std dev: 240 ms +- 41 ms

### genshi_text ###
Mean +- std dev: 71.3 ms +- 12.3 ms

### genshi_xml ###
Mean +- std dev: 141 ms +- 20 ms

### go ###
Mean +- std dev: 491 ms +- 55 ms

### hexiom ###
Mean +- std dev: 18.1 ms +- 1.7 ms

### html5lib ###
Mean +- std dev: 151 ms +- 12 ms

### json_dumps ###
Mean +- std dev: 18.9 ms +- 0.3 ms

### json_loads ###
Mean +- std dev: 37.2 us +- 1.4 us

### logging_format ###
Mean +- std dev: 32.6 us +- 1.5 us

### logging_silent ###
Mean +- std dev: 378 ns +- 55 ns

### logging_simple ###
Mean +- std dev: 30.3 us +- 1.3 us

### mako ###
Mean +- std dev: 29.6 ms +- 5.7 ms

### meteor_contest ###
Mean +- std dev: 173 ms +- 6 ms

### nbody ###
Mean +- std dev: 285 ms +- 10 ms

### nqueens ###
Mean +- std dev: 189 ms +- 9 ms

### pathlib ###
Mean +- std dev: 46.6 ms +- 4.5 ms

### pickle ###
Mean +- std dev: 12.8 us +- 0.3 us

### pickle_dict ###
Mean +- std dev: 35.9 us +- 4.6 us

### pickle_list ###
Mean +- std dev: 5.59 us +- 0.76 us

### pickle_pure_python ###
Mean +- std dev: 1.03 ms +- 0.10 ms

### pidigits ###
Mean +- std dev: 225 ms +- 23 ms

### pyflate ###
Mean +- std dev: 1.60 sec +- 0.19 sec

### python_startup ###
Mean +- std dev: 91.0 ms +- 25.4 ms

### python_startup_no_site ###
Mean +- std dev: 13.1 ms +- 1.8 ms

### raytrace ###
Mean +- std dev: 890 ms +- 63 ms

### regex_compile ###
Mean +- std dev: 294 ms +- 3 ms

### regex_dna ###
Mean +- std dev: 437 ms +- 12 ms

### regex_effbot ###
Mean +- std dev: 9.25 ms +- 0.57 ms

### regex_v8 ###
Mean +- std dev: 64.9 ms +- 3.0 ms

### richards ###
Mean +- std dev: 125 ms +- 3 ms

### scimark_fft ###
Mean +- std dev: 784 ms +- 23 ms

### scimark_lu ###
Mean +- std dev: 315 ms +- 15 ms

### scimark_monte_carlo ###
Mean +- std dev: 206 ms +- 7 ms

### scimark_sor ###
Mean +- std dev: 469 ms +- 48 ms

### scimark_sparse_mat_mult ###
Mean +- std dev: 12.4 ms +- 1.7 ms

### spectral_norm ###
Mean +- std dev: 393 ms +- 54 ms

### sqlalchemy_declarative ###
Mean +- std dev: 337 ms +- 51 ms

### sqlalchemy_imperative ###
Mean +- std dev: 34.4 ms +- 4.6 ms

### sqlite_synth ###
Mean +- std dev: 4.40 us +- 0.49 us

### sympy_expand ###
Mean +- std dev: 939 ms +- 200 ms

### sympy_integrate ###
Mean +- std dev: 45.5 ms +- 9.8 ms

### sympy_sum ###
Mean +- std dev: 326 ms +- 50 ms

### sympy_str ###
Mean +- std dev: 698 ms +- 223 ms

### telco ###
Mean +- std dev: 10.8 ms +- 0.7 ms

### tornado_http ###
Mean +- std dev: 470 ms +- 153 ms

### unpack_sequence ###
Mean +- std dev: 157 ns +- 74 ns

### unpickle ###
Mean +- std dev: 26.0 us +- 3.2 us

### unpickle_list ###
Mean +- std dev: 7.20 us +- 1.49 us

### unpickle_pure_python ###
Mean +- std dev: 746 us +- 165 us

### xml_etree_parse ###
Mean +- std dev: 293 ms +- 38 ms

### xml_etree_iterparse ###
Mean +- std dev: 258 ms +- 43 ms

### xml_etree_generate ###
Mean +- std dev: 213 ms +- 37 ms

### xml_etree_process ###
Mean +- std dev: 166 ms +- 25 ms

Run the benchmark on Cinder-python3.8 without optimization flags (compiled using code in master)

[root@c02db7e771b4 vol]# pyperformance show py38_cinder_notoptim.json
Performance version: 1.0.5
Report on Linux-5.10.47-linuxkit-x86_64-with-glibc2.29
Number of logical CPUs: 4
Start date: 2022-05-02 23:18:46.206093
End date: 2022-05-03 01:12:28.517719

### 2to3 ###
Mean +- std dev: 2.14 sec +- 0.66 sec

### chameleon ###
Mean +- std dev: 31.6 ms +- 8.9 ms

### chaos ###
Mean +- std dev: 277 ms +- 70 ms

### crypto_pyaes ###
Mean +- std dev: 324 ms +- 124 ms

### deltablue ###
Mean +- std dev: 15.9 ms +- 6.5 ms

### django_template ###
Mean +- std dev: 202 ms +- 193 ms

### dulwich_log ###
Mean +- std dev: 230 ms +- 122 ms

### fannkuch ###
Mean +- std dev: 1.41 sec +- 0.36 sec

### float ###
Mean +- std dev: 262 ms +- 60 ms

### genshi_text ###
Mean +- std dev: 78.6 ms +- 22.8 ms

### genshi_xml ###
Mean +- std dev: 179 ms +- 44 ms

### go ###
Mean +- std dev: 490 ms +- 122 ms

### hexiom ###
Mean +- std dev: 23.2 ms +- 6.0 ms

### html5lib ###
Mean +- std dev: 177 ms +- 30 ms

### json_dumps ###
Mean +- std dev: 33.3 ms +- 7.6 ms

### json_loads ###
Mean +- std dev: 53.1 us +- 5.9 us

### logging_format ###
Mean +- std dev: 39.2 us +- 10.9 us

### logging_silent ###
Mean +- std dev: 441 ns +- 107 ns

### logging_simple ###
Mean +- std dev: 34.1 us +- 4.7 us

### mako ###
Mean +- std dev: 31.6 ms +- 6.5 ms

### meteor_contest ###
Mean +- std dev: 221 ms +- 53 ms

### nbody ###
Mean +- std dev: 292 ms +- 43 ms

### nqueens ###
Mean +- std dev: 240 ms +- 39 ms

### pathlib ###
Mean +- std dev: 45.0 ms +- 6.9 ms

### pickle ###
Mean +- std dev: 18.6 us +- 3.3 us

### pickle_dict ###
Mean +- std dev: 61.4 us +- 8.9 us

### pickle_list ###
Mean +- std dev: 8.44 us +- 0.97 us

### pickle_pure_python ###
Mean +- std dev: 982 us +- 56 us

### pidigits ###
Mean +- std dev: 229 ms +- 26 ms

### pyflate ###
Mean +- std dev: 1.43 sec +- 0.16 sec

### python_startup ###
Mean +- std dev: 230 ms +- 76 ms

### python_startup_no_site ###
Mean +- std dev: 140 ms +- 60 ms

### raytrace ###
Mean +- std dev: 1.03 sec +- 0.34 sec

### regex_compile ###
Mean +- std dev: 297 ms +- 14 ms

### regex_dna ###
Mean +- std dev: 467 ms +- 74 ms

### regex_effbot ###
Mean +- std dev: 12.2 ms +- 16.2 ms

### regex_v8 ###
Mean +- std dev: 70.8 ms +- 13.2 ms

### richards ###
Mean +- std dev: 142 ms +- 22 ms

### scimark_fft ###
Mean +- std dev: 1.02 sec +- 0.24 sec

### scimark_lu ###
Mean +- std dev: 348 ms +- 50 ms

### scimark_monte_carlo ###
Mean +- std dev: 221 ms +- 27 ms

### scimark_sor ###
Mean +- std dev: 526 ms +- 75 ms

### scimark_sparse_mat_mult ###
Mean +- std dev: 14.7 ms +- 2.8 ms

### spectral_norm ###
Mean +- std dev: 372 ms +- 46 ms

### sqlalchemy_declarative ###
Mean +- std dev: 301 ms +- 181 ms

### sqlalchemy_imperative ###
Mean +- std dev: 36.7 ms +- 10.0 ms

### sqlite_synth ###
Mean +- std dev: 7.14 us +- 1.63 us

### sympy_expand ###
Mean +- std dev: 1.02 sec +- 0.22 sec

### sympy_integrate ###
Mean +- std dev: 63.0 ms +- 23.7 ms

### sympy_sum ###
Mean +- std dev: 387 ms +- 130 ms

### sympy_str ###
Mean +- std dev: 724 ms +- 280 ms

### telco ###
Mean +- std dev: 20.5 ms +- 8.0 ms

### tornado_http ###
Mean +- std dev: 441 ms +- 136 ms

### unpack_sequence ###
Mean +- std dev: 128 ns +- 16 ns

### unpickle ###
Mean +- std dev: 36.3 us +- 15.3 us

### unpickle_list ###
Mean +- std dev: 11.9 us +- 4.3 us

### unpickle_pure_python ###
Mean +- std dev: 658 us +- 18 us

### xml_etree_parse ###
Mean +- std dev: 405 ms +- 100 ms

### xml_etree_iterparse ###
Mean +- std dev: 219 ms +- 43 ms

### xml_etree_generate ###
Mean +- std dev: 252 ms +- 70 ms

### xml_etree_process ###
Mean +- std dev: 205 ms +- 45 ms

Comparison between python3.8 vs python-3.8 Cinder without optimization

[root@c02db7e771b4 vol]# pyperformance compare py38.json py38_cinder_notoptim.json
py38.json
=========

Performance version: 1.0.5
Report on Linux-5.10.47-linuxkit-x86_64-with-glibc2.2.5
Number of logical CPUs: 4
Start date: 2022-05-02 21:49:38.051577
End date: 2022-05-02 22:34:01.938257

py38_cinder_notoptim.json
=========================

Performance version: 1.0.5
Report on Linux-5.10.47-linuxkit-x86_64-with-glibc2.29
Number of logical CPUs: 4
Start date: 2022-05-02 23:18:46.206093
End date: 2022-05-03 01:12:28.517719

### 2to3 ###
Mean +- std dev: 686 ms +- 78 ms -> 2139 ms +- 663 ms: 3.12x slower
Significant (t=-16.87)

### chameleon ###
Mean +- std dev: 19.9 ms +- 0.3 ms -> 31.6 ms +- 8.9 ms: 1.58x slower
Significant (t=-10.15)

### chaos ###
Mean +- std dev: 248 ms +- 36 ms -> 277 ms +- 70 ms: 1.12x slower
Significant (t=-2.87)

### crypto_pyaes ###
Mean +- std dev: 216 ms +- 14 ms -> 324 ms +- 124 ms: 1.50x slower
Significant (t=-6.71)

### deltablue ###
Mean +- std dev: 11.7 ms +- 0.3 ms -> 15.9 ms +- 6.5 ms: 1.35x slower
Significant (t=-4.96)

### django_template ###
Mean +- std dev: 108 ms +- 12 ms -> 202 ms +- 193 ms: 1.86x slower
Significant (t=-3.74)

### dulwich_log ###
Mean +- std dev: 126 ms +- 3 ms -> 230 ms +- 122 ms: 1.83x slower
Significant (t=-6.64)

### fannkuch ###
Mean +- std dev: 1.02 sec +- 0.07 sec -> 1.41 sec +- 0.36 sec: 1.38x slower
Significant (t=-8.13)

### float ###
Mean +- std dev: 240 ms +- 41 ms -> 262 ms +- 60 ms: 1.09x slower
Significant (t=-2.42)

### genshi_text ###
Mean +- std dev: 71.3 ms +- 12.3 ms -> 78.6 ms +- 22.8 ms: 1.10x slower
Significant (t=-2.18)

### genshi_xml ###
Mean +- std dev: 141 ms +- 20 ms -> 179 ms +- 44 ms: 1.26x slower
Significant (t=-5.94)

### go ###
Mean +- std dev: 491 ms +- 55 ms -> 490 ms +- 122 ms: 1.00x faster
Not significant

### hexiom ###
Mean +- std dev: 18.1 ms +- 1.7 ms -> 23.2 ms +- 6.0 ms: 1.28x slower
Significant (t=-6.32)

### html5lib ###
Mean +- std dev: 151 ms +- 12 ms -> 177 ms +- 30 ms: 1.17x slower
Significant (t=-6.16)

### json_dumps ###
Mean +- std dev: 18.9 ms +- 0.3 ms -> 33.3 ms +- 7.6 ms: 1.76x slower
Significant (t=-14.61)

### json_loads ###
Mean +- std dev: 37.2 us +- 1.4 us -> 53.1 us +- 5.9 us: 1.43x slower
Significant (t=-20.45)

### logging_format ###
Mean +- std dev: 32.6 us +- 1.5 us -> 39.2 us +- 10.9 us: 1.20x slower
Significant (t=-4.71)

### logging_silent ###
Mean +- std dev: 378 ns +- 55 ns -> 441 ns +- 107 ns: 1.16x slower
Significant (t=-4.01)

### logging_simple ###
Mean +- std dev: 30.3 us +- 1.3 us -> 34.1 us +- 4.7 us: 1.13x slower
Significant (t=-6.00)

### mako ###
Mean +- std dev: 29.6 ms +- 5.7 ms -> 31.6 ms +- 6.5 ms: 1.07x slower
Not significant

### meteor_contest ###
Mean +- std dev: 173 ms +- 6 ms -> 221 ms +- 53 ms: 1.28x slower
Significant (t=-7.01)

### nbody ###
Mean +- std dev: 285 ms +- 10 ms -> 292 ms +- 43 ms: 1.02x slower
Not significant

### nqueens ###
Mean +- std dev: 189 ms +- 9 ms -> 240 ms +- 39 ms: 1.27x slower
Significant (t=-10.03)

### pathlib ###
Mean +- std dev: 46.6 ms +- 4.5 ms -> 45.0 ms +- 6.9 ms: 1.04x faster
Not significant

### pickle ###
Mean +- std dev: 12.8 us +- 0.3 us -> 18.6 us +- 3.3 us: 1.45x slower
Significant (t=-13.46)

### pickle_dict ###
Mean +- std dev: 35.9 us +- 4.6 us -> 61.4 us +- 8.9 us: 1.71x slower
Significant (t=-19.71)

### pickle_list ###
Mean +- std dev: 5.59 us +- 0.76 us -> 8.44 us +- 0.97 us: 1.51x slower
Significant (t=-17.92)

### pickle_pure_python ###
Mean +- std dev: 1.03 ms +- 0.10 ms -> 0.98 ms +- 0.06 ms: 1.04x faster
Significant (t=3.09)

### pidigits ###
Mean +- std dev: 225 ms +- 23 ms -> 229 ms +- 26 ms: 1.02x slower
Not significant

### pyflate ###
Mean +- std dev: 1.60 sec +- 0.19 sec -> 1.43 sec +- 0.16 sec: 1.12x faster
Significant (t=5.32)

### python_startup ###
Mean +- std dev: 91.0 ms +- 25.4 ms -> 230.5 ms +- 75.7 ms: 2.53x slower
Significant (t=-24.72)

### python_startup_no_site ###
Mean +- std dev: 13.1 ms +- 1.8 ms -> 140.4 ms +- 60.0 ms: 10.72x slower
Significant (t=-29.98)

### raytrace ###
Mean +- std dev: 890 ms +- 63 ms -> 1031 ms +- 335 ms: 1.16x slower
Significant (t=-3.22)

### regex_compile ###
Mean +- std dev: 294 ms +- 3 ms -> 297 ms +- 14 ms: 1.01x slower
Not significant

### regex_dna ###
Mean +- std dev: 437 ms +- 12 ms -> 467 ms +- 74 ms: 1.07x slower
Significant (t=-3.15)

### regex_effbot ###
Mean +- std dev: 9.25 ms +- 0.57 ms -> 12.23 ms +- 16.22 ms: 1.32x slower
Not significant

### regex_v8 ###
Mean +- std dev: 64.9 ms +- 3.0 ms -> 70.8 ms +- 13.2 ms: 1.09x slower
Significant (t=-3.39)

### richards ###
Mean +- std dev: 125 ms +- 3 ms -> 142 ms +- 22 ms: 1.14x slower
Significant (t=-6.05)

### scimark_fft ###
Mean +- std dev: 784 ms +- 23 ms -> 1016 ms +- 238 ms: 1.30x slower
Significant (t=-7.50)

### scimark_lu ###
Mean +- std dev: 315 ms +- 15 ms -> 348 ms +- 50 ms: 1.10x slower
Significant (t=-4.80)

### scimark_monte_carlo ###
Mean +- std dev: 206 ms +- 7 ms -> 221 ms +- 27 ms: 1.07x slower
Significant (t=-4.31)

### scimark_sor ###
Mean +- std dev: 469 ms +- 48 ms -> 526 ms +- 75 ms: 1.12x slower
Significant (t=-4.97)

### scimark_sparse_mat_mult ###
Mean +- std dev: 12.4 ms +- 1.7 ms -> 14.7 ms +- 2.8 ms: 1.19x slower
Significant (t=-5.54)

### spectral_norm ###
Mean +- std dev: 393 ms +- 54 ms -> 372 ms +- 46 ms: 1.06x faster
Significant (t=2.36)

### sqlalchemy_declarative ###
Mean +- std dev: 337 ms +- 51 ms -> 301 ms +- 181 ms: 1.12x faster
Not significant

### sqlalchemy_imperative ###
Mean +- std dev: 34.4 ms +- 4.6 ms -> 36.7 ms +- 10.0 ms: 1.07x slower
Not significant

### sqlite_synth ###
Mean +- std dev: 4.40 us +- 0.49 us -> 7.14 us +- 1.63 us: 1.62x slower
Significant (t=-12.46)

### sympy_expand ###
Mean +- std dev: 939 ms +- 200 ms -> 1021 ms +- 223 ms: 1.09x slower
Significant (t=-2.14)

### sympy_integrate ###
Mean +- std dev: 45.5 ms +- 9.8 ms -> 63.0 ms +- 23.7 ms: 1.38x slower
Significant (t=-5.26)

### sympy_str ###
Mean +- std dev: 698 ms +- 223 ms -> 724 ms +- 280 ms: 1.04x slower
Not significant

### sympy_sum ###
Mean +- std dev: 326 ms +- 50 ms -> 387 ms +- 130 ms: 1.19x slower
Significant (t=-3.40)

### telco ###
Mean +- std dev: 10.8 ms +- 0.7 ms -> 20.5 ms +- 8.0 ms: 1.91x slower
Significant (t=-9.44)

### tornado_http ###
Mean +- std dev: 470 ms +- 153 ms -> 441 ms +- 136 ms: 1.07x faster
Not significant

### unpack_sequence ###
Mean +- std dev: 157 ns +- 74 ns -> 128 ns +- 16 ns: 1.22x faster
Significant (t=2.92)

### unpickle ###
Mean +- std dev: 26.0 us +- 3.2 us -> 36.3 us +- 15.3 us: 1.40x slower
Significant (t=-5.11)

### unpickle_list ###
Mean +- std dev: 7.20 us +- 1.49 us -> 11.87 us +- 4.27 us: 1.65x slower
Significant (t=-8.01)

### unpickle_pure_python ###
Mean +- std dev: 746 us +- 165 us -> 658 us +- 18 us: 1.13x faster
Significant (t=4.10)

### xml_etree_generate ###
Mean +- std dev: 213 ms +- 37 ms -> 252 ms +- 70 ms: 1.18x slower
Significant (t=-3.84)

### xml_etree_iterparse ###
Mean +- std dev: 258 ms +- 43 ms -> 219 ms +- 43 ms: 1.18x faster
Significant (t=4.96)

### xml_etree_parse ###
Mean +- std dev: 293 ms +- 38 ms -> 405 ms +- 100 ms: 1.38x slower
Significant (t=-8.12)

### xml_etree_process ###
Mean +- std dev: 166 ms +- 25 ms -> 205 ms +- 45 ms: 1.23x slower
Significant (t=-5.81)

@rtindru
Copy link
Author

rtindru commented May 3, 2022

Comparison using pyperf table

[root@c02db7e771b4 vol]# python3 -m pyperf compare_to py38.json py38_cinder_notoptim.json --table
+-------------------------+----------+------------------------+
| Benchmark               | py38     | py38_cinder_notoptim   |
+=========================+==========+========================+
| 2to3                    | 686 ms   | 2.14 sec: 3.12x slower |
+-------------------------+----------+------------------------+
| chameleon               | 19.9 ms  | 31.6 ms: 1.58x slower  |
+-------------------------+----------+------------------------+
| chaos                   | 248 ms   | 277 ms: 1.12x slower   |
+-------------------------+----------+------------------------+
| crypto_pyaes            | 216 ms   | 324 ms: 1.50x slower   |
+-------------------------+----------+------------------------+
| deltablue               | 11.7 ms  | 15.9 ms: 1.35x slower  |
+-------------------------+----------+------------------------+
| django_template         | 108 ms   | 202 ms: 1.86x slower   |
+-------------------------+----------+------------------------+
| dulwich_log             | 126 ms   | 230 ms: 1.83x slower   |
+-------------------------+----------+------------------------+
| fannkuch                | 1.02 sec | 1.41 sec: 1.38x slower |
+-------------------------+----------+------------------------+
| float                   | 240 ms   | 262 ms: 1.09x slower   |
+-------------------------+----------+------------------------+
| genshi_text             | 71.3 ms  | 78.6 ms: 1.10x slower  |
+-------------------------+----------+------------------------+
| genshi_xml              | 141 ms   | 179 ms: 1.26x slower   |
+-------------------------+----------+------------------------+
| hexiom                  | 18.1 ms  | 23.2 ms: 1.28x slower  |
+-------------------------+----------+------------------------+
| html5lib                | 151 ms   | 177 ms: 1.17x slower   |
+-------------------------+----------+------------------------+
| json_dumps              | 18.9 ms  | 33.3 ms: 1.76x slower  |
+-------------------------+----------+------------------------+
| json_loads              | 37.2 us  | 53.1 us: 1.43x slower  |
+-------------------------+----------+------------------------+
| logging_format          | 32.6 us  | 39.2 us: 1.20x slower  |
+-------------------------+----------+------------------------+
| logging_silent          | 378 ns   | 441 ns: 1.16x slower   |
+-------------------------+----------+------------------------+
| logging_simple          | 30.3 us  | 34.1 us: 1.13x slower  |
+-------------------------+----------+------------------------+
| meteor_contest          | 173 ms   | 221 ms: 1.28x slower   |
+-------------------------+----------+------------------------+
| nqueens                 | 189 ms   | 240 ms: 1.27x slower   |
+-------------------------+----------+------------------------+
| pickle                  | 12.8 us  | 18.6 us: 1.45x slower  |
+-------------------------+----------+------------------------+
| pickle_dict             | 35.9 us  | 61.4 us: 1.71x slower  |
+-------------------------+----------+------------------------+
| pickle_list             | 5.59 us  | 8.44 us: 1.51x slower  |
+-------------------------+----------+------------------------+
| pickle_pure_python      | 1.03 ms  | 982 us: 1.04x faster   |
+-------------------------+----------+------------------------+
| pyflate                 | 1.60 sec | 1.43 sec: 1.12x faster |
+-------------------------+----------+------------------------+
| python_startup          | 91.0 ms  | 230 ms: 2.53x slower   |
+-------------------------+----------+------------------------+
| python_startup_no_site  | 13.1 ms  | 140 ms: 10.72x slower  |
+-------------------------+----------+------------------------+
| raytrace                | 890 ms   | 1.03 sec: 1.16x slower |
+-------------------------+----------+------------------------+
| regex_dna               | 437 ms   | 467 ms: 1.07x slower   |
+-------------------------+----------+------------------------+
| regex_v8                | 64.9 ms  | 70.8 ms: 1.09x slower  |
+-------------------------+----------+------------------------+
| richards                | 125 ms   | 142 ms: 1.14x slower   |
+-------------------------+----------+------------------------+
| scimark_fft             | 784 ms   | 1.02 sec: 1.30x slower |
+-------------------------+----------+------------------------+
| scimark_lu              | 315 ms   | 348 ms: 1.10x slower   |
+-------------------------+----------+------------------------+
| scimark_monte_carlo     | 206 ms   | 221 ms: 1.07x slower   |
+-------------------------+----------+------------------------+
| scimark_sor             | 469 ms   | 526 ms: 1.12x slower   |
+-------------------------+----------+------------------------+
| scimark_sparse_mat_mult | 12.4 ms  | 14.7 ms: 1.19x slower  |
+-------------------------+----------+------------------------+
| spectral_norm           | 393 ms   | 372 ms: 1.06x faster   |
+-------------------------+----------+------------------------+
| sqlite_synth            | 4.40 us  | 7.14 us: 1.62x slower  |
+-------------------------+----------+------------------------+
| sympy_expand            | 939 ms   | 1.02 sec: 1.09x slower |
+-------------------------+----------+------------------------+
| sympy_integrate         | 45.5 ms  | 63.0 ms: 1.38x slower  |
+-------------------------+----------+------------------------+
| sympy_sum               | 326 ms   | 387 ms: 1.19x slower   |
+-------------------------+----------+------------------------+
| telco                   | 10.8 ms  | 20.5 ms: 1.91x slower  |
+-------------------------+----------+------------------------+
| unpack_sequence         | 157 ns   | 128 ns: 1.22x faster   |
+-------------------------+----------+------------------------+
| unpickle                | 26.0 us  | 36.3 us: 1.40x slower  |
+-------------------------+----------+------------------------+
| unpickle_list           | 7.20 us  | 11.9 us: 1.65x slower  |
+-------------------------+----------+------------------------+
| unpickle_pure_python    | 746 us   | 658 us: 1.13x faster   |
+-------------------------+----------+------------------------+
| xml_etree_parse         | 293 ms   | 405 ms: 1.38x slower   |
+-------------------------+----------+------------------------+
| xml_etree_iterparse     | 258 ms   | 219 ms: 1.18x faster   |
+-------------------------+----------+------------------------+
| xml_etree_generate      | 213 ms   | 252 ms: 1.18x slower   |
+-------------------------+----------+------------------------+
| xml_etree_process       | 166 ms   | 205 ms: 1.23x slower   |
+-------------------------+----------+------------------------+
| Geometric mean          | (ref)    | 1.28x slower           |
+-------------------------+----------+------------------------+

Benchmark hidden because not significant (11): go, mako, nbody, pathlib, pidigits, regex_compile, regex_effbot, sqlalchemy_declarative, sqlalchemy_imperative, sympy_str, tornado_http

@rtindru
Copy link
Author

rtindru commented May 3, 2022

@itamaro I seem to be running into issues when I run ./configure --enable-optimizations --with-lto followed by make

[root@4b3304b8eaa9 vol]# make
Running code to generate profile data (this can take a while):
# First, we need to create a clean build with profile generation
# enabled.
make profile-gen-stamp
make[1]: Entering directory '/vol'
make clean
make[2]: Entering directory '/vol'
find . -depth -name '__pycache__' -exec rm -rf {} ';'
/bin/sh: find: command not found
make[2]: [Makefile:2256: pycremoval] Error 127 (ignored)
find . -name '*.py[co]' -exec rm -f {} ';'
/bin/sh: find: command not found
make[2]: [Makefile:2257: pycremoval] Error 127 (ignored)
find . -name '*.[oa]' -exec rm -f {} ';'
/bin/sh: find: command not found
make[2]: *** [Makefile:2271: clean] Error 127
make[2]: Leaving directory '/vol'
make[1]: *** [Makefile:692: profile-clean-stamp] Error 2
make[1]: Leaving directory '/vol'
make: *** [Makefile:712: profile-run-stamp] Error 2

@itamaro
Copy link
Contributor

itamaro commented May 3, 2022

@rtindru the make command is trying to use find to cleanup the checkout, but it appears find is not included in the Docker image.
fix this by installing find in your container:

dnf install -y findutils

@rtindru
Copy link
Author

rtindru commented May 3, 2022

That worked great, thank you!

@kmod
Copy link

kmod commented May 3, 2022

I got a bunch of these errors when I enabled lto:

/usr/bin/ld: python.lto.o: in function `symtable_record_directive':
/vol/Python/symtable.c:1448: undefined reference to `_Py_Mangle'
/usr/bin/ld: python.lto.o: in function `run_mod':
/vol/Python/pythonrun.c:1138: undefined reference to `PyAST_CompileObject'
/usr/bin/ld: python.lto.o: in function `symtable_add_def_helper':
/vol/Python/symtable.c:1308: undefined reference to `_Py_Mangle'
/usr/bin/ld: python.lto.o: in function `symtable_visit_arguments':
/vol/Python/symtable.c:1308: undefined reference to `_Py_Mangle'
etc

So I ran the benchmarks with no lto or optimizations, just ./configure. I also ran the benchmarks with PYTHONJIT=1

The flask benchmark is here: https://github.com/pyston/python-macrobenchmarks/blob/main/benchmarks/bm_flaskblogging/run_benchmark.py
We're working on pyperformance integration to automate these steps, but for now you have to clone that repo, create a venv and install the requirements.txt from the same directory. I ran the benchmark like this:

PYTHONJIT=1 ./cinder_env/bin/python3 ./python-macrobenchmarks/benchmarks/bm_flaskblogging/run_benchmark.py --legacy 4000 flaskblogging.json

This writes the timestamp per iteration to flaskblogging.json, and I used a not-yet-open-sourced script that computes the median response time and uses that as the benchmark result.

@rtindru
Copy link
Author

rtindru commented May 3, 2022

I ran into an issue while building with optimizations

Steps to reproduce

./configure --enable-optimizations --with-lto
make clean
make

Error

This error is occurs when you do ./configure --enable-optimizations this version of python complies it either way.

   >> Objects/accu.o
   Parser/listnode.c: In function ‘list1node’:
   Parser/listnode.c:66:1: error: ‘/cinder/Parser/listnode.gcda’ profile count data file not 
   found [-Werror=missing-profile]
   66 | }
      | ^

What I tried

I ran profile-clean-stamp thank you https://github.com/MojoVampire

make profile-clean-stamp
make

However, the make exited with the same error

make build_all_merge_profile
make[1]: Entering directory '/vol'

~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"Parser/listnode.o" [New]                                                                                                                                       0,0-1         All
true
make[1]: Leaving directory '/vol'
# Remove profile generation binary since we are done with it.
make clean
make[1]: Entering directory '/vol'
find . -depth -name '__pycache__' -exec rm -rf {} ';'
find . -name '*.py[co]' -exec rm -f {} ';'
find . -name '*.[oa]' -exec rm -f {} ';'
find . -name '*.s[ol]' -exec rm -f {} ';'
find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
find build -name 'fficonfig.h' -exec rm -f {} ';' || true

/* List a node on a file */

#include "Python.h"
#include "token.h"
#include "node.h"

/* Forward */
static void list1node(FILE *, node *);
static void listnode(FILE *, node *);

void
PyNode_ListTree(node *n)
{
    listnode(stdout, n);
}

static int level, atbol;

static void
listnode(FILE *fp, node *n)
{
    level = 0;
    atbol = 1;
    list1node(fp, n);
}

static void
list1node(FILE *fp, node *n)
{
    if (n == NULL)
        return;
    if (ISNONTERMINAL(TYPE(n))) {
        int i;
        for (i = 0; i < NCH(n); i++)
            list1node(fp, CHILD(n, i));
    }
    else if (ISTERMINAL(TYPE(n))) {
        switch (TYPE(n)) {
        case INDENT:
            ++level;
            break;
        case DEDENT:
            --level;
            break;
        default:
"Parser/listnode.c" 66L, 1278B                                                                                                                                  1,0-1         Top
find build -name '*.py' -exec rm -f {} ';' || true
find build -name '*.py[co]' -exec rm -f {} ';' || true
rm -f pybuilddir.txt
rm -f Lib/lib2to3/*Grammar*.pickle
rm -f Programs/_testembed Programs/_freeze_importlib

/* Grammar subroutines needed by parser */

#include "Python.h"
#include "grammar.h"
#include "token.h"

/* Return the DFA for the given type */

const dfa *
PyGrammar_FindDFA(grammar *g, int type)
{
    /* Massive speed-up */
    const dfa *d = &g->g_dfa[type - NT_OFFSET];
    assert(d->d_type == type);
    return d;
}

const char *
PyGrammar_LabelRepr(label *lb)
{
    static char buf[100];

    if (lb->lb_type == ENDMARKER)
        return "EMPTY";
    else if (ISNONTERMINAL(lb->lb_type)) {
        if (lb->lb_str == NULL) {
            PyOS_snprintf(buf, sizeof(buf), "NT%d", lb->lb_type);
            return buf;
        }
        else
            return lb->lb_str;
    }
    else if (lb->lb_type < N_TOKENS) {
        if (lb->lb_str == NULL)
            return _PyParser_TokenNames[lb->lb_type];
        else {
            PyOS_snprintf(buf, sizeof(buf), "%.32s(%.32s)",
                _PyParser_TokenNames[lb->lb_type], lb->lb_str);
            return buf;
        }
    }
    else {
        Py_FatalError("invalid label");
        return NULL;
    }
"Parser/grammar1.c" 47L, 1066B                                                                                                                                  1,0-1         Top
find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
rm -f Include/pydtrace_probes_ceval.h
rm -f Include/pydtrace_probes_gcmodule.h
rm -f Include/pydtrace_probes_import.h
rm -f profile-gen-stamp
make[1]: Leaving directory '/vol'
# This is an expensive target to build and it does not have proper
# makefile dependency information.  So, we create a "stamp" file
# to record its completion and avoid re-running it.
touch profile-run-stamp
Rebuilding with profile guided optimizations:
rm -f profile-clean-stamp
make build_all CFLAGS_NODIST=" -fprofile-use -fprofile-correction" LDFLAGS_NODIST=""
make[1]: Entering directory '/vol'
>> Programs/python.o
>> Parser/acceler.o
>> Parser/grammar1.o
>> Parser/listnode.o
Parser/listnode.c: In function ‘list1node’:
Parser/listnode.c:66:1: error: ‘/vol/Parser/listnode.gcda’ profile count data file not found [-Werror=missing-profile]
   66 | }
      | ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2207: Parser/listnode.o] Error 1
make[1]: Leaving directory '/vol'
make: *** [Makefile:738: profile-opt] Error 2

@rtindru
Copy link
Author

rtindru commented May 3, 2022

Going to try the build on a cloud linux machine as I am wondering if this is a Mac issue

@itamaro
Copy link
Contributor

itamaro commented May 4, 2022

Going to try the build on a cloud linux machine as I am wondering if this is a Mac issue

any luck on Linux?

@belm0
Copy link
Contributor

belm0 commented May 12, 2022

 Parser/listnode.c:66:1: error: ‘/cinder/Parser/listnode.gcda’ profile count data file not found [-Werror=missing-profile]

I'm seeing this error too on a stock ubuntu:20.04 docker image.

Though I notice it only came up after removing --enable-shared from the python build.

Opened #74

@rtindru
Copy link
Author

rtindru commented Jun 7, 2022

I tried building the most recent cinder-3.8 branch with optimizations on a Mac with Docker desktop and I get the same error

>> libpython3.8_static.a
In functionassemble_lnotab’,
    inlined fromassemble_emitat Python/compile.c:5961:25,
    inlined fromassembleat Python/compile.c:6308:18:
Python/compile.c:5914:19: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5914 |         *lnotab++ = k;
      |                   ^



>> python.exe
./Modules/_static.c:20: warning: type of_PyCheckedDict_Typedoes not match original declaration [-Wlto-type-mismatch]
   20 | extern PyTypeObject _PyCheckedDict_Type;
      |
Objects/dictobject.c:6493:19: note: typestruct _PyGenericTypeDefshould match typestruct PyTypeObject6493 | _PyGenericTypeDef _PyCheckedDict_Type = {
      |                   ^
Objects/dictobject.c:6493:19: note: ‘_PyCheckedDict_Typewas previously declared here
Objects/dictobject.c:6493:19: note: code may be misoptimized unless-fno-strict-aliasingis used
./Modules/_static.c:21: warning: type of_PyCheckedList_Typedoes not match original declaration [-Wlto-type-mismatch]
   21 | extern PyTypeObject _PyCheckedList_Type;
      |
Objects/listobject.c:3883:19: note: typestruct _PyGenericTypeDefshould match typestruct PyTypeObject3883 | _PyGenericTypeDef _PyCheckedList_Type = {
      |                   ^
Objects/listobject.c:3883:19: note: ‘_PyCheckedList_Typewas previously declared here
Objects/listobject.c:3883:19: note: code may be misoptimized unless-fno-strict-aliasingis used
In functionassemble_lnotab’,
    inlined fromassemble_emitat Python/compile.c:5961:0,
    inlined fromassembleat Python/compile.c:6308:0:
Python/compile.c:5914: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 5914 |         *lnotab++ = k;
      |


/usr/bin/ld: python.exe.lto.o: in function `std::__shared_ptr<strictmod::objects::StrictExceptionObject, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<strictmod::objects::StrictExceptionObject>, std::shared_ptr<strictmod::objects::StrictType>, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >(std::_Sp_alloc_shared_tag<std::allocator<strictmod::objects::StrictExceptionObject> >, std::shared_ptr<strictmod::objects::StrictType>&&, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&&) [clone .isra.0]':
/vol/./StrictModules/Objects/exception_object.h:10: undefined reference to `vtable for strictmod::objects::StrictExceptionObject'
/usr/bin/ld: python.exe.lto.o: in function `void strictmod::objects::StrictType::addGetSetDescriptor<std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), decltype(nullptr)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), decltype(nullptr)) [clone .constprop.0]':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.exe.lto.o: in function `void strictmod::objects::StrictType::addGetSetDescriptor<std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), decltype(nullptr), decltype(nullptr)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), decltype(nullptr), decltype(nullptr)) [clone .constprop.0]':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::StrictFuncType::addMethods()':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: /usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: /usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.exe.lto.o:/usr/include/c++/10/ext/new_allocator.h:150: more undefined references to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))' follow
/usr/bin/ld: python.exe.lto.o: in function `std::shared_ptr<strictmod::objects::StrictType> strictmod::objects::makeType<strictmod::objects::StrictExceptionType, char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >, std::shared_ptr<strictmod::objects::StrictType> >(char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >&&, std::shared_ptr<strictmod::objects::StrictType>&&) [clone .constprop.0]':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::PropertyType()':
/vol/./StrictModules/Objects/property.h:69: undefined reference to `vtable for strictmod::objects::StrictPropertyType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::AttributeErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::AssertionErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::ValueErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::StopIterationType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::KeyErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.exe.lto.o:/vol/./StrictModules/Objects/exception_object.h:26: more undefined references to `vtable for strictmod::objects::StrictExceptionType' follow
/usr/bin/ld: python.exe.lto.o: in function `strictmod::objects::StrictObjectType::addMethods()':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.exe.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/type_type.h:9: undefined reference to `vtable for strictmod::objects::StrictTypeType'
/usr/bin/ld: python.exe.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/module_type.h:9: undefined reference to `vtable for strictmod::objects::StrictModuleType'
/usr/bin/ld: python.exe.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/property.h:172: undefined reference to `vtable for strictmod::objects::StrictGetSetDescriptorType'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:796: python.exe] Error 1
make[3]: Leaving directory '/vol'
make[2]: *** [Makefile:724: build_all_generate_profile] Error 2
make[2]: Leaving directory '/vol'
make[1]: *** [Makefile:700: profile-gen-stamp] Error 2
make[1]: Leaving directory '/vol'
make: *** [Makefile:712: profile-run-stamp] Error 2

Steps to reproduce:

git clone https://github.com/facebookincubator/cinder

docker run -v "$PWD/cinder:/vol" -w /vol -it --rm ghcr.io/facebookincubator/cinder/python-build-env:latest bash

./configure --enable-optimizations --with-lto

make

@rtindru
Copy link
Author

rtindru commented Jun 9, 2022

Got the same error on a RHEL box

[ec2-user@ip-172-31-24-8 cinder]$ hostnamectl
   Static hostname: ip-172-31-24-8.ec2.internal
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ec251984e149e28ff6868b2d3b4d71f0
           Boot ID: 8a285e9d1b43472484fc9be3557cb1bb
    Virtualization: kvm
  Operating System: Red Hat Enterprise Linux 8.5 (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8::baseos
            Kernel: Linux 4.18.0-348.12.2.el8_5.x86_64
      Architecture: x86-64

Steps to reproduce

git clone https://github.com/facebookincubator/cinder

docker run -v "$PWD/cinder:/vol" -w /vol -it --rm ghcr.io/facebookincubator/cinder/python-build-env:latest bash

./configure --enable-optimizations --with-lto

make

Error log

/usr/bin/ld: python.lto.o: in function `std::__shared_ptr<strictmod::objects::StrictExceptionObject, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<strictmod::objects::StrictExceptionObject>, std::shared_ptr<strictmod::objects::StrictType>, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >(std::_Sp_alloc_shared_tag<std::allocator<strictmod::objects::StrictExceptionObject> >, std::shared_ptr<strictmod::objects::StrictType>&&, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&&) [clone .isra.0]':
/vol/./StrictModules/Objects/exception_object.h:10: undefined reference to `vtable for strictmod::objects::StrictExceptionObject'
/usr/bin/ld: python.lto.o: in function `void strictmod::objects::StrictType::addGetSetDescriptor<std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), decltype(nullptr)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), decltype(nullptr)) [clone .constprop.0]':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.lto.o: in function `void strictmod::objects::StrictType::addGetSetDescriptor<std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), decltype(nullptr), decltype(nullptr)>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), decltype(nullptr), decltype(nullptr)) [clone .constprop.0]':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::StrictFuncType::addMethods()':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: /usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: /usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.lto.o:/usr/include/c++/10/ext/new_allocator.h:150: more undefined references to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))' follow
/usr/bin/ld: python.lto.o: in function `std::shared_ptr<strictmod::objects::StrictType> strictmod::objects::makeType<strictmod::objects::StrictExceptionType, char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >, std::shared_ptr<strictmod::objects::StrictType> >(char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >&&, std::shared_ptr<strictmod::objects::StrictType>&&) [clone .constprop.0]':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::PropertyType()':
/vol/./StrictModules/Objects/property.h:69: undefined reference to `vtable for strictmod::objects::StrictPropertyType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::AttributeErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::AssertionErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::ValueErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::StopIterationType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::KeyErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o:/vol/./StrictModules/Objects/exception_object.h:26: more undefined references to `vtable for strictmod::objects::StrictExceptionType' follow
/usr/bin/ld: python.lto.o: in function `strictmod::objects::StrictObjectType::addMethods()':
/usr/include/c++/10/ext/new_allocator.h:150: undefined reference to `strictmod::objects::StrictGetSetDescriptor::StrictGetSetDescriptor(std::weak_ptr<strictmod::objects::StrictModuleObject>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject> (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::StrictType>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&), void (*)(std::shared_ptr<strictmod::objects::BaseStrictObject>, strictmod::CallerContext const&))'
/usr/bin/ld: python.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/type_type.h:9: undefined reference to `vtable for strictmod::objects::StrictTypeType'
/usr/bin/ld: python.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/module_type.h:9: undefined reference to `vtable for strictmod::objects::StrictModuleType'
/usr/bin/ld: python.lto.o: in function `__static_initialization_and_destruction_0(int, int) [clone .lto_priv.77] [clone .constprop.0]':
/vol/./StrictModules/Objects/property.h:172: undefined reference to `vtable for strictmod::objects::StrictGetSetDescriptorType'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:796: python] Error 1
make[3]: Leaving directory '/vol'
make[2]: *** [Makefile:724: build_all_generate_profile] Error 2
make[2]: Leaving directory '/vol'
make[1]: *** [Makefile:700: profile-gen-stamp] Error 2
make[1]: Leaving directory '/vol'
make: *** [Makefile:712: profile-run-stamp] Error 2

@belm0
Copy link
Contributor

belm0 commented Jun 9, 2022

The build failure is a known issue and tracked in #74. More cases don't need to be cited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants