From edfd19b0b3b80b3b308336b8731eba4a577b58be Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Mon, 13 Nov 2023 19:27:25 +0000 Subject: [PATCH] Install devito with MLIR CI --- .github/workflows/ci-mlir.yml | 33 ++++++++++----------------------- fast/diffusion_2D_wBCs.py | 2 +- fast/wave2d_b.py | 6 ++++-- fast/wave3d_b.py | 2 +- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci-mlir.yml b/.github/workflows/ci-mlir.yml index 90b0a675cb..4932307ff9 100644 --- a/.github/workflows/ci-mlir.yml +++ b/.github/workflows/ci-mlir.yml @@ -24,10 +24,11 @@ jobs: env: LLVM_SYMBOLIZER_PATH: /usr/lib/llvm-11/bin/llvm-symbolizer MLIR-Version: 04fc02e583b06b846315904a55af9c273c8b20b9 + steps: - - uses: actions/checkout@v3 - with: - path: xdsl + - name: Checkout Devito + uses: actions/checkout@v3 + - name: Install native dependencies uses: awalsh128/cache-apt-pkgs-action@latest @@ -46,8 +47,8 @@ jobs: - name: Install requirements and xDSL run: | - pip install -r requirements.txt - pip install xdsl + pip install -e .[tests] + pip install xdsl==0.14 - name: Cache binaries id: cache-binary @@ -94,26 +95,12 @@ jobs: cd llvm-project/build cmake --build . --target mlir-opt mlir-cpu-runner - - name: Test with pytest and generate code coverage - run: | - cd xdsl - pytest -W error --cov --cov-config=.coveragerc . - - name: Execute lit tests + - name: ADD TO PATH run: | cd xdsl # Add mlir-opt to the path export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/ - lit -v tests/filecheck/ -DCOVERAGE - lit -v docs/Toy/examples/ -DCOVERAGE - - name: Test MLIR dependent examples/tutorials - run: | - cd xdsl - # Add mlir-opt to the path - export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/ - pytest --nbval docs/mlir_interoperation.ipynb --maxfail 1 -vv - - name: Combine coverage data + + - name: Test with pytest and generate code coverage run: | - cd xdsl - coverage combine --append - coverage report - coverage xml + pytest -W error -m "not parallel" -k "not adjoint" tests/ diff --git a/fast/diffusion_2D_wBCs.py b/fast/diffusion_2D_wBCs.py index 577a5cfeaa..baa3b1912f 100644 --- a/fast/diffusion_2D_wBCs.py +++ b/fast/diffusion_2D_wBCs.py @@ -93,4 +93,4 @@ if args.xdsl and args.devito: 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) + print("Max error: ", max_error) diff --git a/fast/wave2d_b.py b/fast/wave2d_b.py index 92f178b133..b2d4615bd6 100644 --- a/fast/wave2d_b.py +++ b/fast/wave2d_b.py @@ -91,7 +91,7 @@ if args.devito: # To measure Devito at its best on GPU, we have to set the tile siwe manually - opt = None + opt = 'advanced' if configuration['platform'].name == 'nvidiaX': opt = ('advanced', {'par-tile': (32, 4, 8)}) @@ -136,4 +136,6 @@ # print("XDSL output norm 2:", np.linalg.norm(u.data[2]), "vs:", np.linalg.norm(ub.data[2])) if args.xdsl and args.devito: - print("Max error: ", np.max(np.abs(u.data - devito_out.data))) + max_error = np.max(np.abs(u.data - devito_out.data)) + print("Max error: ", max_error) + assert np.isclose(norm(u), norm(devito_out), rtol=1e-2) \ No newline at end of file diff --git a/fast/wave3d_b.py b/fast/wave3d_b.py index 6dea6249cf..1aff18a283 100644 --- a/fast/wave3d_b.py +++ b/fast/wave3d_b.py @@ -97,7 +97,7 @@ if args.devito: # To measure Devito at its best on GPU, we have to set the tile siwe manually - opt = None + opt = 'advanced' if configuration['platform'].name == 'nvidiaX': opt = ('advanced', {'par-tile': (32, 4, 8)})