aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/assets
diff options
context:
space:
mode:
authorGravatar Ben Wagner <benjaminwagner@google.com>2018-06-28 17:43:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-29 13:25:17 +0000
commita5e703043ff034afea41ea24e9d8f978f05ba678 (patch)
treeb32e2fe6c9a23832790d991d670de955199bc866 /infra/bots/assets
parent55a7d22beb635ac960b16858b0ffe67424402950 (diff)
Add OpenCL test job that runs hello-opencl.
Add NEO driver to opencl_linux asset. Bug: skia:8081 Change-Id: Ic36c670f3cabd73119845e94fcb2f54525e83443 Reviewed-on: https://skia-review.googlesource.com/138264 Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'infra/bots/assets')
-rw-r--r--infra/bots/assets/opencl_intel_neo_linux/VERSION1
-rwxr-xr-xinfra/bots/assets/opencl_intel_neo_linux/common.py26
-rwxr-xr-xinfra/bots/assets/opencl_intel_neo_linux/create.py72
-rwxr-xr-xinfra/bots/assets/opencl_intel_neo_linux/create_and_upload.py42
-rwxr-xr-xinfra/bots/assets/opencl_intel_neo_linux/download.py16
-rwxr-xr-xinfra/bots/assets/opencl_intel_neo_linux/upload.py16
6 files changed, 173 insertions, 0 deletions
diff --git a/infra/bots/assets/opencl_intel_neo_linux/VERSION b/infra/bots/assets/opencl_intel_neo_linux/VERSION
new file mode 100644
index 0000000000..56a6051ca2
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/VERSION
@@ -0,0 +1 @@
+1 \ No newline at end of file
diff --git a/infra/bots/assets/opencl_intel_neo_linux/common.py b/infra/bots/assets/opencl_intel_neo_linux/common.py
new file mode 100755
index 0000000000..caa0ad899c
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/common.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Common vars used by scripts in this directory."""
+
+
+import os
+import sys
+
+FILE_DIR = os.path.dirname(os.path.abspath(__file__))
+INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
+
+sys.path.insert(0, INFRA_BOTS_DIR)
+from assets import assets
+
+ASSET_NAME = os.path.basename(FILE_DIR)
+
+
+def run(cmd):
+ """Run a command, eg. "upload" or "download". """
+ assets.main([cmd, ASSET_NAME] + sys.argv[1:])
diff --git a/infra/bots/assets/opencl_intel_neo_linux/create.py b/infra/bots/assets/opencl_intel_neo_linux/create.py
new file mode 100755
index 0000000000..1cf22cbed4
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/create.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Copyright 2018 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Create the asset."""
+
+
+import argparse
+import common
+import multiprocessing
+import os
+import shutil
+import subprocess
+import utils
+
+def create_asset(target_dir):
+ """Create the asset."""
+ # Check out and build the Intel NEO driver. Following instructions here:
+ # https://github.com/intel/compute-runtime/blob/master/documentation/BUILD_Ubuntu.md
+ with utils.tmp_dir():
+ # Install build deps.
+ neo_build_deps = ['ccache', 'flex', 'bison', 'clang-4.0', 'cmake', 'g++',
+ 'git', 'patch', 'zlib1g-dev', 'autoconf', 'xutils-dev',
+ 'libtool', 'pkg-config', 'libpciaccess-dev']
+ apt_get_cmd = ['sudo', 'apt-get', 'install'] + neo_build_deps
+ print 'Running "%s"' % ' '.join(apt_get_cmd)
+ subprocess.check_call(apt_get_cmd)
+ # Check out repos.
+ for [repo, branch, local_name] in [
+ ['llvm-mirror/clang', 'release_40', 'clang_source'],
+ ['intel/opencl-clang', 'master', 'common_clang'],
+ ['intel/llvm-patches', 'master', 'llvm_patches'],
+ ['llvm-mirror/llvm', 'release_40', 'llvm_source'],
+ ['intel/gmmlib', 'master', 'gmmlib'],
+ ['intel/intel-graphics-compiler', 'master', 'igc'],
+ ['KhronosGroup/OpenCL-Headers', 'master', 'opencl_headers'],
+ ['intel/compute-runtime', 'master', 'neo']
+ ]:
+ subprocess.check_call(['git', 'clone', '--depth', '1', '--branch', branch,
+ 'https://github.com/' + repo, local_name])
+ # Configure the build.
+ build_dir = os.path.join(os.getcwd(), 'build')
+ os.mkdir(build_dir)
+ os.chdir(build_dir)
+ subprocess.check_call(['cmake', '-DBUILD_TYPE=Release',
+ '-DCMAKE_BUILD_TYPE=Release', '../neo'])
+ # Build and package the library.
+ subprocess.check_call(['make', '-j%d' % multiprocessing.cpu_count(),
+ 'package'])
+ # Extract library and move necessary files to target_dir. We ignore the ICD
+ # file because it's generated on the bot after we know the path to the CIPD
+ # package.
+ subprocess.check_call(['dpkg-deb', '--extract',
+ 'intel-opencl-1.0-0.x86_64-igdrcl.deb', build_dir])
+ lib_dir = os.path.join(build_dir, 'usr', 'local', 'lib')
+ for f in os.listdir(lib_dir):
+ shutil.move(os.path.join(lib_dir, f), target_dir)
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--target_dir', '-t', required=True)
+ args = parser.parse_args()
+ create_asset(args.target_dir)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/infra/bots/assets/opencl_intel_neo_linux/create_and_upload.py b/infra/bots/assets/opencl_intel_neo_linux/create_and_upload.py
new file mode 100755
index 0000000000..de56a80fa8
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/create_and_upload.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Create the asset and upload it."""
+
+
+import argparse
+import common
+import os
+import subprocess
+import sys
+import utils
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--gsutil')
+ args = parser.parse_args()
+
+ with utils.tmp_dir():
+ cwd = os.getcwd()
+ create_script = os.path.join(common.FILE_DIR, 'create.py')
+ upload_script = os.path.join(common.FILE_DIR, 'upload.py')
+
+ try:
+ subprocess.check_call(['python', create_script, '-t', cwd])
+ cmd = ['python', upload_script, '-t', cwd]
+ if args.gsutil:
+ cmd.extend(['--gsutil', args.gsutil])
+ subprocess.check_call(cmd)
+ except subprocess.CalledProcessError:
+ # Trap exceptions to avoid printing two stacktraces.
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/infra/bots/assets/opencl_intel_neo_linux/download.py b/infra/bots/assets/opencl_intel_neo_linux/download.py
new file mode 100755
index 0000000000..ca999e0378
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/download.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Download the current version of the asset."""
+
+
+import common
+
+
+if __name__ == '__main__':
+ common.run('download')
diff --git a/infra/bots/assets/opencl_intel_neo_linux/upload.py b/infra/bots/assets/opencl_intel_neo_linux/upload.py
new file mode 100755
index 0000000000..bdfbda783e
--- /dev/null
+++ b/infra/bots/assets/opencl_intel_neo_linux/upload.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+"""Upload a new version of the asset."""
+
+
+import common
+
+
+if __name__ == '__main__':
+ common.run('upload')