Re-enable PGO on the Alpine variants now that python/cpython#90548 is closed?
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- docker
- Domínio
- build-system
Direção de pesquisa
Leia a condição is_alpine em Dockerfile-linux.template, por volta das linhas 206–212, e o contexto relacionado em #980. A mudança solicitada é remover essa condição para que os builds do Alpine usem --enable-optimizations. O issue relata um treinamento PGO bem-sucedido no CPython 3.14.10 para x86_64 Alpine 3.24, mas outras versões e arquiteturas não foram testadas. A tarefa estará concluída quando a variante Alpine habilitar PGO e sua execução de treinamento passar.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Hey there, thanks for maintaining these images, I run the Alpine variants in production.
Could the Alpine variants build with --enable-optimizations again? #980 turned it off in October 2024 because test_math and test_re failed in the PGO training run (python/cpython#90548). That issue was closed as completed in September 2025, and the training run now passes for me on 3.14/alpine3.24.
It would only mean removing the is_alpine condition in Dockerfile-linux.template, with no patch to carry. Happy to send that PR if you'd like it.
python -m test --pgo on CPython 3.14.10, x86_64 |
Test files passed | test_math |
test_re |
|---|---|---|---|
Published python:3.14-alpine3.24, run in the container |
43 of 43 | passed | passed |
3.14/alpine3.24 plus --enable-optimizations, the training run inside make |
43 of 43 | passed | passed |
On pyperformance the build with the flag is 1.19x faster than the published image. It takes the build step from 128 s to 313 s on a 12-thread x86_64 host. I could only test x86_64 and 3.14.
What I changed and ran
The Dockerfile is 3.14/alpine3.24/Dockerfile at 3a144d79062aa1f59d2e4e99fc96aec3b5871e72 with one line added to the ./configure call:
--enable-loadable-sqlite-extensions \
+ --enable-optimizations \
--enable-option-checking=fatal \
$ docker build --progress=plain --no-cache -t py314-alpine-pgo .
...
#6 121.5 LD_LIBRARY_PATH=/usr/src/python ./python -m test --pgo --timeout=
...
#6 189.3 0:01:07 load avg: 4.52 [27/43] test_math passed
...
#6 206.7 0:01:24 load avg: 3.74 [34/43] test_re passed
...
#6 242.3 Total tests: run=9,964 skipped=265
#6 242.3 Result: SUCCESS
...
#6 DONE 312.5s
The same docker build --no-cache of the unchanged Dockerfile ends with #6 DONE 127.9s.
The resulting interpreter reports the flag and the profile flags:
$ docker run --rm py314-alpine-pgo python3 -c 'import sysconfig; print(sysconfig.get_config_var("CONFIG_ARGS"))'
'--build=x86_64-linux-musl' '--enable-loadable-sqlite-extensions' '--enable-optimizations' '--enable-option-checking=fatal' '--enable-shared' '--with-lto' '--with-ensurepip' 'build_alias=x86_64-linux-musl'
PY_CFLAGS_NODIST contains -fprofile-use in this build and not in the published python:3.14-alpine3.24.
The published image deletes the test suite, so for the first row I copied Lib/test from the 3.14.10 source tarball into the container and ran the same test set:
$ docker run --rm python:3.14-alpine3.24 sh -c '... cp -r Python-3.14.10/Lib/test /usr/local/lib/python3.14/test; python3 -m test --pgo --timeout=1200'
0:00:14 load avg: 1.13 [27/43] test_math passed
0:00:17 load avg: 1.12 [34/43] test_re passed
...
Total tests: run=9,964 skipped=265
Total test files: run=43/43
Result: SUCCESS
For speed, I ran pyperformance 1.14.0 in each image, pinned to one CPU core, on an x86_64 laptop under WSL2, one image after the other:
$ python3 -m pyperf compare_to published.json pgo.json --table -G
...
| Geometric mean | (ref) | 1.19x faster |
Of the 124 benchmarks, 114 are faster and 4 are slower: base16_large 1.10x, asyncio_tcp 1.06x, asyncio_tcp_ssl 1.02x and dask 1.02x. pyperf reports the other 6 as not significant.
Related:
- #160, the original request for
--enable-optimizations - #979, which found PGO had been skipped on every variant
- Linguagem predominante
- Dockerfile
- Estrelas
- 2.8k
- Forks
- 1.1k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de docker-library/python
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
docker-library/python#1150 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 54/100
docker-library/python#1147 ·
-
Provide 3.13t & 3.14t imagesAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
docker-library/python#1082 · 10 comentários · 40 reações ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
docker-library/python#1076 · 5 comentários · 1 reação ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
docker-library/python#1071 · 6 comentários ·
Todas as issues de docker-library/python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 2 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
backlog
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
EchoTools/nevr-runtime#2956 ·
Mantenedores costumam responder em até 1 dia
-
Remove the last compiler warnings and build the core with -Werror in CITalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertagood first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
vishwagw/Sky-Sim-drone-simulator-3.0#45 ·
Mantenedores costumam responder em até 1 dia