|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Trigger the workflow on push or pull request |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + # but only for the master branch |
| 8 | + # branches: [master] |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + |
| 14 | +jobs: |
| 15 | + stack: |
| 16 | + name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} / llvm ${{ matrix.llvm }} / cuda ${{ matrix.cuda }} |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + continue-on-error: ${{ matrix.allow_failure }} |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-latest |
| 23 | + ghc: "8.10" |
| 24 | + llvm: "9" |
| 25 | + cuda: "10.2" |
| 26 | + allow_failure: false |
| 27 | + |
| 28 | + - os: ubuntu-latest |
| 29 | + ghc: "8.8" |
| 30 | + llvm: "9" |
| 31 | + cuda: "10.2" |
| 32 | + allow_failure: false |
| 33 | + |
| 34 | + - os: ubuntu-latest |
| 35 | + ghc: "8.6" |
| 36 | + llvm: "8" |
| 37 | + cuda: "10.1" |
| 38 | + allow_failure: false |
| 39 | + |
| 40 | + - os: macOS-latest |
| 41 | + ghc: "8.8" |
| 42 | + llvm: "9" |
| 43 | + cuda: "" |
| 44 | + allow_failure: false |
| 45 | + |
| 46 | + # Disabled due to missing libffi |
| 47 | + # - os: windows-latest |
| 48 | + # ghc: "8.6" |
| 49 | + # llvm: "9.0.1" |
| 50 | + # cuda: "10.2.89.20191206" |
| 51 | + # allow_failure: false |
| 52 | + |
| 53 | + env: |
| 54 | + STACK_FLAGS: "--system-ghc --no-install-ghc --fast" |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + |
| 59 | + |
| 60 | + with: |
| 61 | + enable-stack: true |
| 62 | + ghc-version: ${{ matrix.ghc }} |
| 63 | + |
| 64 | + - name: Set up stack |
| 65 | + id: stack-setup |
| 66 | + run: | |
| 67 | + ln -s stack-${{ matrix.ghc }}.yaml stack.yaml |
| 68 | + echo "::set-output name=stack-root::$(stack path --system-ghc --no-install-ghc --stack-root)" |
| 69 | +
|
| 70 | + - uses: actions/cache@v1 |
| 71 | + with: |
| 72 | + path: ${{ steps.stack-setup.outputs.stack-root }} |
| 73 | + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.llvm }}-${{ matrix.cuda }}-stack |
| 74 | + |
| 75 | + - name: Setup (Linux) |
| 76 | + if: runner.os == 'Linux' |
| 77 | + run: | |
| 78 | + MATRIX_CUDA=${{ matrix.cuda }} |
| 79 | + sudo apt-get -y install llvm-${{ matrix.llvm }}-dev libfftw3-dev |
| 80 | + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin |
| 81 | + sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 |
| 82 | + sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub |
| 83 | + sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" |
| 84 | + sudo apt-get update |
| 85 | + sudo apt-get -y install cuda-${MATRIX_CUDA/./-} |
| 86 | + echo "::set-env name=CUDA_HOME::/usr/local/cuda-${{ matrix.cuda }}" |
| 87 | + echo "::set-env name=LD_LIBRARY_PATH::/usr/local/cuda-${{ matrix.cuda }}/lib64:$(stack exec ghc -- --print-libdir)/rts:/usr/local/cuda-${{ matrix.cuda }}/nvvm/lib64:${LD_LIBRARY_PATH}" |
| 88 | + echo "::add-path::/usr/local/cuda-${{ matrix.cuda }}/bin" |
| 89 | +
|
| 90 | + - name: Setup (macOS) |
| 91 | + if: runner.os == 'macOS' |
| 92 | + run: | |
| 93 | + brew tap llvm-hs/homebrew-llvm |
| 94 | + brew install pkg-config |
| 95 | + brew install libffi |
| 96 | + brew install fftw |
| 97 | + brew install llvm-${{ matrix.llvm }} |
| 98 | + echo "::set-env name=PKG_CONFIG_PATH::$(brew --prefix)/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 99 | + echo "::set-env name=STACK_FLAGS::$STACK_FLAGS --flag accelerate-fft:-llvm-ptx" |
| 100 | +
|
| 101 | + # - name: Setup (Windows) |
| 102 | + # if: runner.os == 'Windows' |
| 103 | + # run: | |
| 104 | + # choco install llvm --version=${{ matrix.llvm }} |
| 105 | + # choco install cuda --version=${{ matrix.cuda }} |
| 106 | + |
| 107 | + - name: Build dependencies |
| 108 | + run: | |
| 109 | + stack build $STACK_FLAGS --test --no-run-tests --only-dependencies |
| 110 | +
|
| 111 | + - name: Build |
| 112 | + run: | |
| 113 | + stack build $STACK_FLAGS --test --no-run-tests |
| 114 | +
|
| 115 | + - name: Test |
| 116 | + run: | |
| 117 | + stack test accelerate-fft:test-llvm-native $STACK_FLAGS --test-arguments='--hedgehog-tests=50 --hedgehog-shrinks=0 --timeout=60s --num-threads=1' |
| 118 | +
|
0 commit comments