public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] distutils-r1: a bit of clean up + parallel builds
@ 2012-11-29 11:31 Michał Górny
  2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 1/6] Make distutils-r1_rename_scripts private Michał Górny
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Michał Górny @ 2012-11-29 11:31 UTC (permalink / raw
  To: gentoo-python; +Cc: python

1) setup.py installs files to intermediate root (alike python.eclass).

This way anything we do on the installed files doesn't collide with
other merges potentially running in parallel. This also means that we
don't have to delay installing the wrapper till all setup.py invocations
have completed.

This is done directly in distutils-r1_python_install. The setup.py is
given a different --root, the renaming is done on intermediate image
and the image is quickly merged to the destination.

In order to perform the merge efficiently, I used:

	cp --archive --link --no-clobber

so that copy should preserve everything and use hard-links whenever
possible. --no-clobber is necessary to avoid error on colliding files
(cp doesn't want to overwrite when hardlinking).


2) the wrapper is installed in distutils-r1_python_install.

Previously, distutils-r1_python_install only renamed the installed
executables (because of distutils no-clobber behavior),
and distutils-r1_python_install_all installed the wrapper.

Now we can install both in the same function, since distutils installs
into intermediate images. Therefore, the wrapper being installed
in another intermediate image or even the real image won't collide.


3) the sub-phases are run in parallel.

Since distutils itself is unable to do parallel builds, building Python
packages with C extensions for multiple Python implementations can get
very slow. In order to circumvent that, we're using the multiprocessing
eclass to run sub-phases in parallel.

This means that with 4 implementations enabled and -j4, all four
implementations will be built at the same time. And if they have C
extensions, 4 source files will be built at the same time. This also
makes it possible to use distcc.

As stated in the last patch:

dev-python/lxml-3.0.1 for py2.6+2.7+3.2+3.3:

- non-parallel: 11 min 23 sec
- parallel: 7 min 49 sec (with a bit of swapping)
- parallel w/ distcc: 3 min 40 sec

main machine: Core2 2x1.6 GHz and almost 2 GiBs of RAM
distcc host: Athlon64 2x2 GHz and 3 GiBs of RAM



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-29 16:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29 11:31 [gentoo-python] distutils-r1: a bit of clean up + parallel builds Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 1/6] Make distutils-r1_rename_scripts private Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 2/6] Rename all Python executables in distutils-r1_rename_scripts Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 3/6] _distutils-r1_rename_scripts: require explicit path Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 4/6] Install files to intermediate root and merge afterwards Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 5/6] Install the wrapper symlink in _distutils-r1_rename_scripts Michał Górny
2012-11-29 11:31 ` [gentoo-python] [PATCH distutils-r1 6/6] Run sub-phases in parallel Michał Górny
2012-11-29 16:29 ` [gentoo-python] Re: distutils-r1: a bit of clean up + parallel builds Mike Gilbert
2012-11-29 16:40   ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox