|
| 1 | +name: Build with Open Source LLVM SYCL compiler |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + |
| 7 | +jobs: |
| 8 | + install-compiler: |
| 9 | + name: Build with nightly build of DPC++ toolchain |
| 10 | + runs-on: ubuntu-20.04 |
| 11 | + |
| 12 | + env: |
| 13 | + OCLCPUEXP_FN: oclcpuexp-2021.12.6.0.19_rel.tar.gz |
| 14 | + FPGAEMU_FN: fpgaemu-2021.12.6.0.19_rel.tar.gz |
| 15 | + TBB_FN: oneapi-tbb-2021.4.0-lin.tgz |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Cancel Previous Runs |
| 19 | + uses: styfle/cancel-workflow-action@0.6.0 |
| 20 | + with: |
| 21 | + access_token: ${{ github.token }} |
| 22 | + |
| 23 | + - name: Cache sycl bundle |
| 24 | + id: cache-sycl-bundle |
| 25 | + uses: actions/cache@v2 |
| 26 | + with: |
| 27 | + path: | |
| 28 | + /home/runner/work/sycl_bundle |
| 29 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/sycl_bundle/bundle_id.txt') }} |
| 30 | + restore-keys: | |
| 31 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 32 | + ${{ runner.os }}-build- |
| 33 | + ${{ runner.os }}- |
| 34 | +
|
| 35 | + - name: Download and install nightly and components |
| 36 | + shell: bash -l {0} |
| 37 | + run: | |
| 38 | + cd /home/runner/work |
| 39 | + mkdir -p sycl_bundle |
| 40 | + cd sycl_bundle |
| 41 | + export LATEST_LLVM_TAG=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/intel/llvm.git | tail --lines=1) |
| 42 | + export LATEST_LLVM_TAG_SHA=$(echo ${LATEST_LLVM_TAG} | awk '{print $1}') |
| 43 | + export NIGHTLY_TAG=$(python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))" \ |
| 44 | + $(echo ${LATEST_LLVM_TAG} | awk '{gsub(/^refs\/tags\//, "", $2)} {print $2}')) |
| 45 | + if [[ -f bundle_id.txt && ( "$(cat bundle_id.txt)" == "${LATEST_LLVM_TAG_SHA}" ) ]]; then |
| 46 | + echo "Using cached download of ${LATEST_LLVM_TAG}" |
| 47 | + else |
| 48 | + export DOWNLOAD_URL_PREFIX=https://github.com/intel/llvm/releases/download |
| 49 | + rm -rf dpcpp-compiler.tar.gz |
| 50 | + wget ${DOWNLOAD_URL_PREFIX}/${NIGHTLY_TAG}/dpcpp-compiler.tar.gz && echo ${LATEST_LLVM_TAG_SHA} > bundle_id.txt || rm -rf bundle_id.txt |
| 51 | + [ -f ${OCLCPUEXP_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/2021-07/${OCLCPUEXP_FN} || rm -rf bundle_id.txt |
| 52 | + [ -f ${FPGAEMU_FN} ] || wget ${DOWNLOAD_URL_PREFIX}/2021-07/${FPGAEMU_FN} || rm -rf bundle_id.txt |
| 53 | + [ -f ${TBB_FN} ] || wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.4.0/${TBB_FN} || rm -rf bundle_id.txt |
| 54 | + rm -rf dpcpp_compiler |
| 55 | + tar xf dpcpp-compiler.tar.gz |
| 56 | + mkdir -p oclcpuexp |
| 57 | + mkdir -p fpgaemu |
| 58 | + [ -d oclcpuexp/x64 ] || tar xf ${OCLCPUEXP_FN} -C oclcpuexp |
| 59 | + [ -d fpgaemu/x64 ] || tar xf ${FPGAEMU_FN} -C fpgaemu |
| 60 | + [ -d oneapi-tbb-2021.4.0/lib ] || tar xf ${TBB_FN} |
| 61 | + mkdir -p dpcpp_compiler/lib |
| 62 | + mkdir -p dpcpp_compiler/lib/oclfpga |
| 63 | + touch dpcpp_compiler/lib/oclfpga/fpgavars.sh |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Install system components |
| 67 | + shell: bash -l {0} |
| 68 | + run: | |
| 69 | + sudo apt-get install cmake libtinfo5 |
| 70 | +
|
| 71 | + - name: Setup Python |
| 72 | + uses: actions/setup-python@v2 |
| 73 | + with: |
| 74 | + python-version: '3.9' |
| 75 | + architecture: x64 |
| 76 | + |
| 77 | + - name: Install dpctl dependencies |
| 78 | + shell: bash -l {0} |
| 79 | + run: | |
| 80 | + pip install numpy cython setuptools pytest |
| 81 | +
|
| 82 | + - name: Checkout repo |
| 83 | + uses: actions/checkout@v2 |
| 84 | + with: |
| 85 | + fetch-depth: 0 |
| 86 | + |
| 87 | + - name: build dpctl |
| 88 | + shell: bash -l {0} |
| 89 | + run: | |
| 90 | + export SYCL_BUNDLE_FOLDER=/home/runner/work/sycl_bundle |
| 91 | + source ${SYCL_BUNDLE_FOLDER}/dpcpp_compiler/startup.sh |
| 92 | + export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/oclcpuexp/x64:${LD_LIBRARY_PATH} |
| 93 | + export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/fpgaemu/x64:${LD_LIBRARY_PATH} |
| 94 | + export LD_LIBRARY_PATH=${SYCL_BUNDLE_FOLDER}/oneapi-tbb-2021.4.0/lib/intel64/gcc4.8:${LD_LIBRARY_PATH} |
| 95 | + export OCL_ICD_FILENAMES=libintelocl.so:libintelocl_emu.so |
| 96 | + clang++ --version |
| 97 | + sycl-ls |
| 98 | + python setup.py develop --sycl-compiler-prefix=$(dirname $(dirname `which clang++`)) |
| 99 | + python -m pytest -v dpctl/tests |
0 commit comments