|
| 1 | +name: GitHub Actions Demo |
| 2 | +run-name: ${{ github.actor }} CI for ddpt |
1 | 3 | on: [push, pull_request] |
2 | | - |
3 | 4 | defaults: |
4 | 5 | run: |
5 | 6 | shell: bash |
6 | | - |
7 | 7 | jobs: |
8 | 8 | build_and_test: |
9 | | - name: building and testing ddptensor |
10 | 9 | runs-on: [self-hosted, dds-base] |
11 | | - container: |
12 | | - image: amr-registry-pre.caas.intel.com/tpi/ddpt |
13 | | - options: --device=/dev/dri --shm-size=3000M |
14 | 10 | strategy: |
15 | 11 | fail-fast: false |
| 12 | + env: |
| 13 | + MLIRROOT: /localdisk/llvm/curr |
| 14 | + IMEXROOT: third_party/install/imex |
16 | 15 | steps: |
17 | | - - name: Setup |
18 | | - run: . activate ddpt |
19 | | - - name: Checkout ddptensor and submodules |
20 | | - uses: actions/checkout@v2 |
21 | | - with: |
22 | | - submodules: recursive |
23 | | - - name: Build dpptensor |
24 | | - run: | |
25 | | - . activate ddpt |
26 | | - g++ -v |
27 | | - export MPIROOT=$CONDA_PREFIX |
28 | | - export MKLROOT=$CONDA_PREFIX |
29 | | - CMAKE_BUILD_PARALLEL_LEVEL=8 python setup.py develop |
30 | | - - name: Run tests |
31 | | - run: | |
32 | | - . activate ddpt |
33 | | - pytest test |
34 | | - DDPT_CW=0 pytest test |
35 | | - DDPT_CW=1 pytest test |
36 | | - DDPT_MPI_SPAWN=1 PYTHON_EXE=`which python` pytest test |
37 | | - DDPT_MPI_SPAWN=2 PYTHON_EXE=`which python` pytest test |
38 | | - DDPT_MPI_SPAWN=3 PYTHON_EXE=`which python` pytest test |
39 | | - DDPT_CW=1 mpirun -n 1 python -m pytest test |
40 | | - DDPT_CW=1 mpirun -n 2 python -m pytest test |
41 | | - DDPT_CW=1 mpirun -n 3 python -m pytest test |
42 | | - DDPT_CW=1 mpirun -n 4 python -m pytest test |
43 | | - DDPT_CW=0 mpirun -n 1 python -m pytest test |
44 | | - DDPT_CW=0 mpirun -n 2 python -m pytest test |
45 | | - DDPT_CW=0 mpirun -n 3 python -m pytest test |
46 | | - DDPT_CW=0 mpirun -n 4 python -m pytest test |
| 16 | + - name: Check repo |
| 17 | + uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + submodules: recursive |
| 20 | + - name: Setup IMEX Cache Var |
| 21 | + run: | |
| 22 | + echo 'IMEX_SHA<<EOF' >> $GITHUB_ENV |
| 23 | + cat imex_version.txt >> $GITHUB_ENV |
| 24 | + echo 'EOF' >> $GITHUB_ENV |
| 25 | + - name: Echo IMEX SHA |
| 26 | + run: echo ${{ env.IMEX_SHA }} |
| 27 | + - name: Checkout IMEX |
| 28 | + uses: actions/checkout@v3 |
| 29 | + with: |
| 30 | + repository: intel-innersource/frameworks.ai.mlir.mlir-extensions |
| 31 | + token: ${{ secrets.PATIMEX }} |
| 32 | + path: third_party/imex |
| 33 | + ref: ${{ env.IMEX_SHA }} |
| 34 | + - name: Setup LLVM Cache Vars |
| 35 | + run: | |
| 36 | + echo 'LLVM_SHA<<EOF' >> $GITHUB_ENV |
| 37 | + cat third_party/imex/build_tools/llvm_version.txt >> $GITHUB_ENV |
| 38 | + echo 'EOF' >> $GITHUB_ENV |
| 39 | + - name: Echo LLVM SHA |
| 40 | + run: echo ${{ env.LLVM_SHA }} |
| 41 | + - name: Miniconda |
| 42 | + run: | |
| 43 | + mkdir -p "$GITHUB_WORKSPACE"/third_party/install |
| 44 | + cd "$GITHUB_WORKSPACE"/third_party |
| 45 | + wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh |
| 46 | + bash Miniconda3-latest-Linux-x86_64.sh -u -b -f -p $GITHUB_WORKSPACE/third_party/install/miniconda |
| 47 | + echo "$GITHUB_WORKSPACE/third_party/install/miniconda/bin" >> $GITHUB_PATH |
| 48 | + echo "$GITHUB_WORKSPACE/third_party/install/miniconda/condabin" >> $GITHUB_PATH |
| 49 | + export PATH=$GITHUB_WORKSPACE/third_party/install/miniconda/bin:${PATH} |
| 50 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/etc/profile.d/conda.sh |
| 51 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/bin/activate |
| 52 | + which conda |
| 53 | + which python |
| 54 | + conda create -q -n ddpt -c intel -c defaults pybind11 numpy cmake ninja impi-devel libstdcxx-ng mpi4py pytest scipy tbb-devel |
| 55 | + cd - |
| 56 | + - name: Cache LLVM-MLIR |
| 57 | + id: cache-llvm-mlir |
| 58 | + uses: actions/cache@v3 |
| 59 | + env: |
| 60 | + LLVM_CACHE_NUMBER: 1 # Increase to reset cache |
| 61 | + with: |
| 62 | + path: third_party/install/llvm-mlir/** |
| 63 | + key: ${{ runner.os }}-build-llvm-${{ env.LLVM_CACHE_NUMBER }}-${{ env.LLVM_SHA }} |
| 64 | + - name: Build LLVM MLIR |
| 65 | + if: steps.cache-llvm-mlir.outputs.cache-hit != 'true' |
| 66 | + run: | |
| 67 | + echo "INFO: Need to rebuild LLVM-MLIR. Previous installation for MLIR not found" |
| 68 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/etc/profile.d/conda.sh |
| 69 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/bin/activate ddpt |
| 70 | + np=`nproc` |
| 71 | + pushd third_party |
| 72 | + if [ -d "llvm-project" ]; then rm -rf llvm-project; fi |
| 73 | + mkdir llvm-project || exit 1 |
| 74 | + cd llvm-project || exit 1 |
| 75 | + git init |
| 76 | + git remote add origin https://github.com/llvm/llvm-project || exit 1 |
| 77 | + git fetch origin ${{ env.LLVM_SHA }} || exit 1 |
| 78 | + git reset --hard FETCH_HEAD || exit 1 |
| 79 | + if [ -d "$GITHUB_WORKSPACE/third_party/imex/build_tools/patches" ]; then git apply $GITHUB_WORKSPACE/third_party/imex/build_tools/patches/*.patch; fi |
| 80 | + cd - |
| 81 | + mkdir -p build/llvm-mlir || exit 1 |
| 82 | + cd build/llvm-mlir || exit 1 |
| 83 | + cmake ../../llvm-project/llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_DISTRIBUTION_COMPONENTS="llvm-headers;llvm-libraries;cmake-exports;FileCheck;count;not;mlir-headers;mlir-libraries;mlir-cmake-exports;mlir-tblgen;mlir-cpu-runner" -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE"/third_party/install/llvm-mlir |
| 84 | + cmake --build . -j ${np} || exit 1 |
| 85 | + cmake --install . || exit 1 |
| 86 | + cp bin/FileCheck $GITHUB_WORKSPACE/third_party/install/llvm-mlir/bin/ |
| 87 | + cp bin/count $GITHUB_WORKSPACE/third_party/install/llvm-mlir/bin/ |
| 88 | + cp bin/not $GITHUB_WORKSPACE/third_party/install/llvm-mlir/bin/ |
| 89 | + popd |
| 90 | + ls $GITHUB_WORKSPACE/third_party/install/llvm-mlir/ |
| 91 | + ls third_party/install/llvm-mlir/ |
| 92 | +
|
| 93 | + - name: Cache IMEX |
| 94 | + id: cache-imex-mlir |
| 95 | + uses: actions/cache@v3 |
| 96 | + env: |
| 97 | + IMEX_CACHE_NUMBER: 1 # Increase to reset cache |
| 98 | + with: |
| 99 | + path: third_party/install/imex/** |
| 100 | + key: ${{ runner.os }}-build-imex-${{ env.IMEX_CACHE_NUMBER }}-${{ env.IMEX_SHA }} |
| 101 | + - name: Build IMEX |
| 102 | + if: steps.cache-imex-mlir.outputs.cache-hit != 'true' |
| 103 | + run: | |
| 104 | + which python |
| 105 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/etc/profile.d/conda.sh |
| 106 | + . $GITHUB_WORKSPACE/third_party/install/miniconda/bin/activate ddpt |
| 107 | + mkdir -p third_party/build/imex |
| 108 | + pushd third_party/build/imex |
| 109 | + MLIR_DIR=$GITHUB_WORKSPACE/third_party/install/llvm-mlir cmake $GITHUB_WORKSPACE/third_party/imex -DCMAKE_BUILD_TYPE=debug -G Ninja |
| 110 | + cmake --build . -j ${np} || exit 1 |
| 111 | + cmake --install . --prefix=$GITHUB_WORKSPACE/third_party/install/imex || exit 1 |
| 112 | + popd |
| 113 | + ls $GITHUB_WORKSPACE/third_party/install/imex |
| 114 | + ls third_party/install/imex |
| 115 | + - run: | |
| 116 | + echo "This job's status is ${{ job.status }}." |
0 commit comments