diff --git a/.github/workflows/sycl_containers.yaml b/.github/workflows/sycl_containers.yaml index fab6aa66269d8..f3b1a05cac747 100644 --- a/.github/workflows/sycl_containers.yaml +++ b/.github/workflows/sycl_containers.yaml @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/sycl_nightly.yml b/.github/workflows/sycl_nightly.yml new file mode 100644 index 0000000000000..9546a7e300582 --- /dev/null +++ b/.github/workflows/sycl_nightly.yml @@ -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 + - 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 diff --git a/devops/containers/ubuntu2004_intel_drivers.Dockerfile b/devops/containers/ubuntu2004_intel_drivers.Dockerfile new file mode 100644 index 0000000000000..dab65c3794c9f --- /dev/null +++ b/devops/containers/ubuntu2004_intel_drivers.Dockerfile @@ -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"] + diff --git a/devops/containers/ubuntu2004_preinstalled.Dockerfile b/devops/containers/ubuntu2004_preinstalled.Dockerfile new file mode 100644 index 0000000000000..54ce61ced8a02 --- /dev/null +++ b/devops/containers/ubuntu2004_preinstalled.Dockerfile @@ -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"] + diff --git a/devops/scripts/drivers_entrypoint.sh b/devops/scripts/drivers_entrypoint.sh new file mode 100644 index 0000000000000..b56400591e1e2 --- /dev/null +++ b/devops/scripts/drivers_entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +source /runtimes/oneapi-tbb/env/vars.sh + +exec "$@" + diff --git a/devops/scripts/get_release.py b/devops/scripts/get_release.py new file mode 100644 index 0000000000000..5ce5eccf72083 --- /dev/null +++ b/devops/scripts/get_release.py @@ -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"]) +