diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index 1e812544ba..90b0a675cb 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -5,11 +5,13 @@ name: CI - MLIR-based Testing on: # Trigger the workflow on push or pull request, - # but only for the main branch + # but only for the master branch push: branches: - - main + - master pull_request: + branches: + - master workflow_dispatch: jobs: @@ -41,11 +43,12 @@ jobs: - name: Upgrade pip run: | pip install --upgrade pip - - name: Install the package locally and nbval + + - name: Install requirements and xDSL run: | - # Change directory so that xdsl-opt can be found during installation. - cd xdsl pip install -r requirements.txt + pip install xdsl + - name: Cache binaries id: cache-binary uses: actions/cache@v3 @@ -84,11 +87,13 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_BINUTILS_INCDIR=/usr/include + - name: MLIR Build if: steps.cache-binary.outputs.cache-hit != 'true' run: | cd llvm-project/build cmake --build . --target mlir-opt mlir-cpu-runner + - name: Test with pytest and generate code coverage run: | cd xdsl diff --git a/fast/diffusion_2D_wBCs.py b/fast/diffusion_2D_wBCs.py index 7f974eac48..577a5cfeaa 100644 --- a/fast/diffusion_2D_wBCs.py +++ b/fast/diffusion_2D_wBCs.py @@ -91,4 +91,6 @@ print("XDSL Field norm is:", norm(u)) if args.xdsl and args.devito: - print("Max error: ", np.max(np.abs(u.data - devito_out.data))) + assert np.isclose(norm(u), norm(devito_out), rtol=1e-5) + max_error = np.max(np.abs(u.data - devito_out.data)) + assert np.isclose(norm(u), norm(devito_out), rtol=1e-5) diff --git a/fast/diffusion_3D_wBCs.py b/fast/diffusion_3D_wBCs.py index dc1281cfe1..9dd83d017b 100644 --- a/fast/diffusion_3D_wBCs.py +++ b/fast/diffusion_3D_wBCs.py @@ -7,6 +7,8 @@ from devito import (Grid, TimeFunction, Eq, solve, Operator, Constant, norm, XDSLOperator, configuration) +from devito.logger import info, warning + from fast.bench_utils import plot_3dfunc parser = argparse.ArgumentParser(description='Process arguments.') @@ -42,7 +44,7 @@ so = args.space_order to = args.time_order -print("dx %s, dy %s, dz %s" % (dx, dy, dz)) +# print("dx %s, dy %s, dz %s" % (dx, dy, dz)) grid = Grid(shape=(nx, ny, nz), extent=(2., 2., 2.)) u = TimeFunction(name='u', grid=grid, space_order=so) @@ -89,4 +91,7 @@ plot_3dfunc(u) if args.xdsl and args.devito: - print("Max error: ", np.max(np.abs(u.data - devito_out.data))) + assert np.isclose(norm(u), norm(devito_out), rtol=1e-5) + max_error = np.max(np.abs(u.data - devito_out.data)) + assert np.isclose(norm(u), norm(devito_out), rtol=1e-5) +