Skip to content

[CI] Introduce driver and nightly containers #4777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .github/workflows/sycl_containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
schedule:
# Every 1st and 15th day of month
- cron: '0 0 1,15 * *'
push:
branches:
- sycl

jobs:
base_image_ubuntu2004:
Expand All @@ -14,14 +17,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
fetch-depth: 2
- name: Check if dependencies have changed
id: deps_changed
shell: bash {0}
run: |
git diff --exit-code HEAD~1 -- devops/containers/ubuntu2004_base.Dockerfile
echo "::set-output name=flag::$?"
- name: Login to GitHub Container Registry
if: ${{ (github.event_name != 'push') || steps.deps_changed.outputs.flag}}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Container
if: ${{ (github.event_name != 'push') || steps.deps_changed.outputs.flag}}
uses: docker/build-push-action@v2
with:
push: true
Expand All @@ -30,3 +41,37 @@ jobs:
ghcr.io/${{ github.repository }}/ubuntu2004_base:latest
context: ${{ github.workspace }}/devops
file: ${{ github.workspace }}/devops/containers/ubuntu2004_base.Dockerfile
# This job produces a Docker container with the latest versions of Intel
# drivers, that can be found on GitHub.
drivers_image_ubuntu2004:
if: github.repository == 'intel/llvm'
name: Intel Drivers Ubuntu 20.04 Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check if dependencies have changed
id: deps_changed
shell: bash {0}
run: |
git diff --exit-code HEAD~1 -- devops/containers/ubuntu2004_intel_drivers.Dockerfile
echo "::set-output name=flag::$?"
- name: Login to GitHub Container Registry
if: ${{ (github.event_name != 'push') || steps.deps_changed.outputs.flag}}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Container
if: ${{ (github.event_name != 'push') || steps.deps_changed.outputs.flag}}
uses: docker/build-push-action@v2
with:
push: true
tags: |
ghcr.io/${{ github.repository }}/ubuntu2004_intel_drivers:latest-${{ github.sha }}
ghcr.io/${{ github.repository }}/ubuntu2004_intel_drivers:latest
context: ${{ github.workspace }}/devops
file: ${{ github.workspace }}/devops/containers/ubuntu2004_intel_drivers.Dockerfile
55 changes: 55 additions & 0 deletions .github/workflows/sycl_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: SYCL Nightly Builds

on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'

jobs:
ubuntu2004_build_test:
if: github.repository == 'intel/llvm'
uses: intel/llvm/.github/workflows/sycl_linux_build_and_test.yml@sycl
with:
build_github_cache: true
build_cache_root: ${{ github.workspace }}
build_artifact_suffix: default
ubuntu2004_docker_build_push:
if: github.repository == 'intel/llvm'
runs-on: ubuntu-latest
needs: ubuntu2004_build_test
steps:
- uses: actions/checkout@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should save the time on checking out sources by using an image where some old SHA is checked out already and we need just update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure saving 1 minute on a 1,5 hour build is a significant improvement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not significant, but still an improvement!
I'm okay to get back to this after we configure everything else.

- uses: actions/download-artifact@v2
with:
name: sycl_nightly_ubuntu2004
path: devops/
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Container (with drivers)
uses: docker/build-push-action@v2
with:
push: true
build-args: |
base_image=ghcr.io/intel/llvm/ubuntu2004_intel_drivers
base_tag=latest
tags: |
ghcr.io/${{ github.repository }}/sycl_ubuntu2004_nightly:${{ github.sha }}
ghcr.io/${{ github.repository }}/sycl_ubuntu2004_nightly:latest
context: ${{ github.workspace }}/devops
file: ${{ github.workspace }}/devops/containers/ubuntu2004_preinstalled.Dockerfile
- name: Build and Push Container (no drivers)
uses: docker/build-push-action@v2
with:
push: true
build-args: |
base_image=ghcr.io/intel/llvm/ubuntu2004_base
base_tag=latest
tags: |
ghcr.io/${{ github.repository }}/sycl_ubuntu2004_nightly:no-drivers-${{ github.sha }}
ghcr.io/${{ github.repository }}/sycl_ubuntu2004_nightly:no-drivers
context: ${{ github.workspace }}/devops
file: ${{ github.workspace }}/devops/containers/ubuntu2004_preinstalled.Dockerfile
64 changes: 64 additions & 0 deletions devops/containers/ubuntu2004_intel_drivers.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
ARG base_tag=latest
ARG base_image=ghcr.io/intel/llvm/ubuntu2004_base

FROM $base_image:$base_tag

ENV DEBIAN_FRONTEND=noninteractive

ARG compute_runtime_tag=latest
ARG igc_tag=latest
ARG tbb_tag=latest
ARG fpgaemu_tag=latest
ARG cpu_tag=latest

RUN apt update && apt install -yqq wget

COPY scripts/get_release.py /

# Install IGC and NEO
RUN python3 /get_release.py intel/intel-graphics-compiler $igc_tag \
| grep ".*deb" \
| wget -qi - && \
python3 /get_release.py intel/compute-runtime $compute_runtime_tag \
| grep -E ".*((deb)|(sum))" \
| wget -qi - && \
sha256sum -c *.sum &&\
dpkg -i *.deb && rm *.deb *.sum

RUN mkdir /runtimes

# Install TBB
RUN cd /runtimes && \
python3 /get_release.py oneapi-src/onetbb $tbb_tag \
| grep -E ".*-lin.tgz" \
| wget -qi - && \
tar -xf *.tgz && rm *.tgz && mv oneapi-tbb-* oneapi-tbb

# Install Intel FPGA Emulator
RUN cd /runtimes && \
python3 /get_release.py intel/llvm $fpgaemu_tag \
| grep -E ".*fpgaemu.*tar.gz" \
| wget -qi - && \
mkdir fpgaemu && tar -xf *.tar.gz -C fpgaemu && rm *.tar.gz && \
if [ -e /runtimes/fpgaemu/install.sh ]; then \
bash -x /runtimes/fpgaemu/install.sh ; \
else \
echo /runtimes/fpgaemu/x64/libintelocl_emu.so > /etc/OpenCL/vendors/intel_fpgaemu.icd ; \
fi

# Install Intel OpenCL CPU Runtime
RUN cd /runtimes && \
python3 /get_release.py intel/llvm $cpu_tag \
| grep -E ".*oclcpuexp.*tar.gz" \
| wget -qi - && \
mkdir oclcpu && tar -xf *.tar.gz -C oclcpu && rm *.tar.gz && \
if [ -e /runtimes/oclcpu/install.sh ]; then \
bash -x /runtimes/oclcpu/install.sh ; \
else \
echo /runtimes/oclcpu/x64/libintelocl.so > /etc/OpenCL/vendors/intel_oclcpu.icd ; \
fi

COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh

ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]

10 changes: 10 additions & 0 deletions devops/containers/ubuntu2004_preinstalled.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG base_tag=latest
ARG base_image=ghcr.io/intel/llvm/ubuntu2004_intel_drivers

FROM $base_image:$base_tag

COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
ADD llvm_sycl.tar.gz /usr

ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]

6 changes: 6 additions & 0 deletions devops/scripts/drivers_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

source /runtimes/oneapi-tbb/env/vars.sh

exec "$@"

23 changes: 23 additions & 0 deletions devops/scripts/get_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from urllib.request import urlopen
import json
import sys

def get_release_by_tag(repo, tag):
release = urlopen("https://api.github.com/repos/" + repo + "/releases/tags/" + tag).read()
return json.loads(release)

def get_latest_release(repo):
release = urlopen("https://api.github.com/repos/" + repo + "/releases/latest").read()
return json.loads(release)

repo = sys.argv[1]
tag = sys.argv[2]

if tag == "latest":
release = get_latest_release(repo)
else:
release = get_release_by_tag(repo, tag)

for item in release["assets"]:
print(item["browser_download_url"])