Skip to content
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

Add Continuous Integration and update dependency requirements #60

Merged
merged 8 commits into from
Jun 19, 2024
161 changes: 161 additions & 0 deletions .github/workflows/Ubuntu-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Test on Ubuntu Linux

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
COMET_SRC: ${{github.workspace}}

jobs:
build-and-test-comet:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
# - name: Install CMake
# run: sudo apt-get install cmake && sudo apt-get install ninja-build

- name: Cache Submodules
id: cache-submodule
uses: actions/cache@v4
# if: always()
with:
path: |
${{github.workspace}}/llvm
${{github.workspace}}/blis/
${{github.workspace}}/install/
${{github.workspace}}/build/
key: ${{ runner.os }}-submodules

- name: Update git submodules
if: steps.cache-submodule.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build llvm
if: steps.cache-submodule.outputs.cache-hit != 'true'
run: mkdir ${{github.workspace}}/llvm/build && cd llvm/build/ && cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="mlir;openmp;clang" -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release && ninja

- name: Build blis
if: steps.cache-submodule.outputs.cache-hit != 'true'
run: cd ${{github.workspace}} && patch -s -p0 < comet-blis.patch && cd blis && ./configure --prefix=$COMET_SRC/install --disable-shared auto && make && make install

- name: Build COMET
# Build your program with the given configuration
run: rm -rf ${{github.workspace}}/build && mkdir ${{github.workspace}}/build && cd ${{github.workspace}}/build && cmake -G Ninja .. -DMLIR_DIR=${{github.workspace}}/llvm/build/lib/cmake/mlir -DLLVM_DIR=${{github.workspace}}/llvm/build/lib/cmake/llvm -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release && ninja

# test-comet-backend:

# needs: build-comet
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# # - uses: lukka/get-cmake@latest
# - name: Install CMake
# run: sudo apt-get install cmake && sudo apt-get install ninja-build

# - name: Cache Submodules
# id: cache-submodule
# uses: actions/cache@v4
# # if: always()
# with:
# path: |
# ${{github.workspace}}/llvm
# ${{github.workspace}}/blis/
# ${{github.workspace}}/install/
# ${{github.workspace}}/build/
# key: ${{ runner.os }}-submodules

- name: Initialize Python 3.11
uses: actions/setup-python@v4

with:
python-version: 3.11

- name: Install python dependencies
run: |
sudo apt-get install -y python3-psutil
sudo apt-get install -y python3-pip

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash

run: ninja check-comet-integration
# ${{github.workspace}}/llvm/build/bin/mlir-cpu-runner --help
# ${{github.workspace}}/build/bin/comet-opt --help


# test-rust-frontend:
# needs: build-comet
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - name: Cache Submodules
# id: cache-submodule
# uses: actions/cache@v4
# # if: always()
# with:
# path: |
# ${{github.workspace}}/llvm
# ${{github.workspace}}/blis/
# ${{github.workspace}}/install/
# ${{github.workspace}}/build/
# key: ${{ runner.os }}-submodules

# - name: Setup Rust environment
# run: rustup update stable && rustup default stable

# - name: Test Rust Frontend
# env:
# COMET_DIR: ${{github.workspace}}/
# working-directory: ${{github.workspace}}/frontends/rust/comet-rs
# run: |
# cargo build
# cargo test

test-cometpy:
needs: build-and-test-comet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache Submodules
id: cache-submodule
uses: actions/cache@v4
# if: always()
with:
path: |
${{github.workspace}}/llvm
${{github.workspace}}/blis/
${{github.workspace}}/install/
${{github.workspace}}/build/
key: ${{ runner.os }}-submodules

- name: Initialize Python 3.11
uses: actions/setup-python@v4

with:
python-version: 3.11

- name: Setup cometPy
run: cd ${{github.workspace}}/frontends/numpy-scipy/ && pip3 install -e .

- name: Test CometPy
working-directory: ${{github.workspace}}/frontends/numpy-scipy/integration_tests/

run: python3 numpy_integration.py -v
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Comprehensive documentation of the COMET compiler can be found [here](https://pn
These commands can be used to setup COMET project:

1) **Install Dependencies** To install COMET and LLVM/MLIR, the following dependencies need to be installed:
* [CMake (3.25 or later)](https://cmake.org/download),
* [Ninja (1.5 or later)](https://ninja-build.org/),
* C++ compiler toolchain as [mentioned here](https://llvm.org/docs/GettingStarted.html#requirements) and
* [Python3 (3.9 or later)](https://www.python.org/downloads/).

* [CMake (3.25 or later)](https://cmake.org/download)
* [Ninja (1.5 or later)](https://ninja-build.org/)
* C++ compiler toolchain as [mentioned here](https://llvm.org/docs/GettingStarted.html#requirements)
* [Python3 (3.9 or later)](https://www.python.org/downloads/)
* [Git (1.8.4 or later)](https://www.git-scm.com/)
* [pkg-config (0.29.2 or later)](https://www.freedesktop.org/wiki/Software/pkg-config/)
2) **Get submodules required for COMET.** COMET contains LLVM and blis as a git
submodule. The LLVM repo here includes staged changes to MLIR which
may be necessary to support COMET. It also represents the version of
Expand All @@ -31,7 +32,7 @@ $ git clone https://github.com/pnnl/COMET.git
$ export COMET_SRC=`pwd`/COMET
$ cd $COMET_SRC
$ git submodule init
$ git submodule update
$ git submodule update --depth=1 # --depth=1 requires git>=1.8.4
```


Expand Down
3 changes: 3 additions & 0 deletions frontends/numpy-scipy/integration_tests/numpy_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ def run_test_case(test_file):
print('='*40)
print(failed_test[1])
print('*'*40)

if len(list_failed_tests) > 0:
exit(127)
Loading