Skip to content

Commit

Permalink
Install devito with MLIR CI
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Nov 13, 2023
1 parent 2ebcc2d commit edfd19b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/ci-mlir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/
2 changes: 1 addition & 1 deletion fast/diffusion_2D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 4 additions & 2 deletions fast/wave2d_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)})

Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion fast/wave3d_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)})

Expand Down

0 comments on commit edfd19b

Please sign in to comment.