Skip to content

Commit bb3b3ba

Browse files
committed
docs: add more documentation around distribution types
Let's give more context about target triples. And lets give some opinions on which builds to recommend.
1 parent 71882f2 commit bb3b3ba

File tree

1 file changed

+100
-3
lines changed

1 file changed

+100
-3
lines changed

docs/running.rst

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,112 @@ Published distributions vary by their:
2222
The Python version is hopefully pretty obvious.
2323

2424
The target machine architecture defines the CPU type and operating
25-
system the distribution runs on. We use LLVM target triples.
25+
system the distribution runs on. We use LLVM target triples. If you aren't
26+
familiar with LLVM target triples, here is an overview:
27+
28+
``aarch64-apple-darwin``
29+
macOS ARM CPUs. i.e. M1 native binaries.
30+
31+
``x86_64-apple-darwin``
32+
macOS Intel CPUs.
33+
34+
``i686-pc-windows-msvc``
35+
Windows 32-bit Intel/AMD CPUs.
36+
37+
``x86_64-pc-windows-msvc``
38+
Windows 64-bit Intel/AMD CPUs.
39+
40+
``*-windows-msvc-shared``
41+
This is a standard build of Python for Windows. There are DLLs for
42+
Python and extensions. These builds behave like the official Python
43+
for Windows distributions.
44+
45+
``*-windows-msvc-static``
46+
These builds of Python are statically linked.
47+
48+
These builds are extremely brittle and have several known incompatibilities.
49+
We recommend not using them unless you have comprehensive test coverage and
50+
have confidence they work for your use case.
51+
52+
See :ref:`quirk_windows_static_distributions` for more.
53+
54+
``x86_64-unknown-linux-gnu``
55+
Linux 64-bit Intel/AMD CPUs linking against GNU libc.
56+
57+
``x86_64-unknown-linux-musl``
58+
Linux 64-bit Intel/AMD CPUs linking against musl libc.
59+
60+
These binaries are static and have no shared library dependencies.
61+
A side-effect of static binaries is they cannot load Python ``.so``
62+
extensions, as static binaries cannot load shared libraries.
63+
64+
``aarch64-unknown-linux-*``
65+
Similar to above except targeting Linux on ARM64 CPUs.
66+
67+
This is what you want for e.g. AWS Graviton EC2 instances. Many Linux
68+
ARM devices are also ``aarch64``.
69+
70+
``i686-unknown-linux-*``
71+
Linux 32-bit Intel/AMD CPUs.
72+
73+
``x86_64_v2-*``
74+
Targets 64-bit Intel/AMD CPUs approximately newer than
75+
`Nehalem <https://en.wikipedia.org/wiki/Nehalem_(microarchitecture)>`
76+
(released in 2008).
77+
78+
Binaries will have SSE3, SSE4, and other CPU instructions added after the
79+
~initial x86-64 CPUs were launched in 2003.
80+
81+
Binaries will crash if you attempt to run them on an older CPU not
82+
supporting the newer instructions.
83+
84+
``x86_64_v3-*``
85+
Targets 64-bit Intel/AMD CPUs approximately newer than
86+
`Haswell <https://en.wikipedia.org/wiki/Haswell_(microarchitecture)>`
87+
(released in 2013) and
88+
`Excavator <https://en.wikipedia.org/wiki/Excavator_(microarchitecture)>`
89+
(released in 2015).
90+
91+
Binaries will have AVX, AVX2, MOVBE and other newer CPU instructions.
92+
93+
Binaries will crash if you attempt to run them on an older CPU not
94+
supporting the newer instructions.
95+
96+
Most x86-64 CPUs manufactured after 2013 (Intel) or 2015 (AMD) support
97+
this microarchitecture level. An exception is Intel Atom P processors,
98+
which Intel released in 2020 but did not include AVX.
99+
100+
``x86_64_v4-*``
101+
Targets 64-bit Intel/AMD CPUs with some AVX-512 instructions.
102+
103+
Requires Intel CPUs manufactured after ~2017. But many Intel CPUs don't
104+
have AVX-512.
105+
106+
The ``x86_64_v2``, ``x86_64_v3``, and ``x86_64_v4`` binaries usually crash
107+
on startup when run on an incompatible CPU. We don't recommend running the
108+
``x86_64_v4`` builds in production because they likely don't yield a reliable
109+
performance benefit. Unless you are executing these binaries on a CPU older
110+
than ~2008 or ~2013, we recommend running the ``x86_64_v2`` or ``x86_64_v3``
111+
binaries, as these should be slightly faster since they take advantage
112+
of more modern CPU instructions which are more efficient. But if you want
113+
maximum portability, stick with the baseline ``x86_64`` builds.
114+
115+
We recommend using the ``*-windows-msvc-shared`` builds on Windows, as these
116+
are highly compatible with the official Python distributions.
117+
118+
We recommend using the ``*-unknown-linux-gnu`` builds on Linux, since they
119+
are able to load compiled Python extensions. If you don't need to load
120+
compiled extensions not provided by the standard library or you are willing
121+
to compile and link 3rd party extensions into a custom binary, the
122+
``*-unknown-linux-musl`` builds should work just fine.
26123

27124
The build configuration denotes how Python and its dependencies were built.
28125
Common configurations include:
29126

30127
``pgo+lto``
31-
Profile guided optimization and link-time optimization. These should be
128+
Profile guided optimization and link-time optimization. **These should be
32129
the fastest distributions since they have the most build-time
33-
optimizations.
130+
optimizations.**
34131

35132
``pgo``
36133
Profile guided optimization.

0 commit comments

Comments
 (0)