From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH RFC 05/10] devtools/images: add python-pgo-image
Date: Wed, 25 Jan 2017 14:40:56 +0200 [thread overview]
Message-ID: <20170125124101.29425-6-markus.lehtonen@linux.intel.com> (raw)
In-Reply-To: <20170125124101.29425-1-markus.lehtonen@linux.intel.com>
This is a special image for profiling Python in order to utilize
profile-guided-optimization. Profile data can be obtained by by running
bitbake python-pgo-image -c profile. It will be located in the directory
pointed by ${PYTHON_PROFILE_DIR}. The profile task that is run can be
altered by specifying ${PYTHON_PROFILE_TASK}.
[YOCTO #9338]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/recipes-devtools/images/python-pgo-image.bb | 55 ++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 meta/recipes-devtools/images/python-pgo-image.bb
diff --git a/meta/recipes-devtools/images/python-pgo-image.bb b/meta/recipes-devtools/images/python-pgo-image.bb
new file mode 100644
index 0000000..1aabd56
--- /dev/null
+++ b/meta/recipes-devtools/images/python-pgo-image.bb
@@ -0,0 +1,55 @@
+SUMMARY = "Minimal image for doing Python profiling (for PGO)"
+
+IMAGE_FEATURES += "ssh-server-dropbear"
+IMAGE_INSTALL = "packagegroup-core-boot python-profile-opt python-profile-opt-tests"
+
+LICENSE = "MIT"
+
+inherit core-image
+
+PYTHON_PROFILE_DIR ?= "${TMPDIR}/work-shared/${MACHINE}/python/pgo-data"
+PYTHON_PROFILE_TASK ?= "-m test.regrtest --pgo -w -x test_asyncore test_gdb test_multiprocessing test_subprocess"
+
+# We need these because we're utilizing the runtime test helpers from oeqa
+TEST_TARGET ?= "qemu"
+TEST_QEMUBOOT_TIMEOUT ?= "1000"
+TEST_LOG_DIR ?= "${WORKDIR}/qemulogs"
+
+python do_profile() {
+ from oeqa.targetcontrol import get_target_controller
+ from oe.utils import getstatusoutput
+
+ target = get_target_controller(d)
+ target.deploy()
+ try:
+ # Boot target
+ bootparams = None
+ if d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd':
+ bootparams = 'systemd.log_level=debug systemd.log_target=console'
+ target.start(extra_bootparams=bootparams)
+
+ # Run profile task
+ profile_cmd = 'LD_LIBRARY_PATH=/opt/lib /opt/bin/python %s' % d.getVar("PYTHON_PROFILE_TASK", True)
+ ret, output = target.run(profile_cmd, timeout=7200)
+ if ret:
+ bb.fatal("Failed to run profile task on target: %s" % output)
+ ret, output = target.run('tar czf pgo-data.tgz -C /home/root/python-pgo-profiles/ .')
+ if ret:
+ bb.fatal("Failed to archive profile data on target: %s" % output)
+
+ # Retrieve and unpack profile data
+ profile_dir = d.getVar("PYTHON_PROFILE_DIR", True)
+ target.copy_from('/home/root/pgo-data.tgz', profile_dir)
+
+ profile_tarball = os.path.join(profile_dir, 'pgo-data.tgz')
+ ret, output = getstatusoutput('tar xf %s -C %s' % (profile_tarball, profile_dir))
+ os.unlink(profile_tarball)
+ if ret:
+ bb.fatal("Failed to unpack python profile data: %s" % output)
+ finally:
+ target.stop()
+}
+
+addtask profile after do_build
+do_profile[depends] += "qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot"
+do_profile[cleandirs] = "${PYTHON_PROFILE_DIR}"
--
2.10.2
next prev parent reply other threads:[~2017-01-25 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 12:40 [PATCH RFC 00/10] python: support profile-optimized build Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 01/10] python-native: support profile optimized build Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 02/10] python: add python-profile-opt recipe Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 03/10] python: remove path hack from setup.py Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 04/10] python-profile-opt: rename libpython Markus Lehtonen
2017-01-25 12:40 ` Markus Lehtonen [this message]
2017-01-25 12:40 ` [PATCH RFC 06/10] python: make profile-optimized build possible Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 07/10] python-pgo-image: exclude tests from the default profile target Markus Lehtonen
2017-01-25 12:40 ` [PATCH RFC 08/10] python: add python-tools subpackage Markus Lehtonen
2017-01-25 12:41 ` [PATCH RFC 09/10] python-pgo-image: switch python default profile task to pybench Markus Lehtonen
2017-01-25 12:41 ` [PATCH RFC 10/10] python-pgo-image: enable sstate for do_profile Markus Lehtonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170125124101.29425-6-markus.lehtonen@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox