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

Fix tutorial codegen #1925

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from . import data, hooks, subsets
from .codegen.compiled_sdfg import CompiledSDFG
from .config import Config
from .sdfg import SDFG, SDFGState, InterstateEdge, nodes
from .sdfg import SDFG, SDFGState, InterstateEdge, nodes, ControlFlowRegion
from .sdfg.propagation import propagate_memlets_sdfg, propagate_memlet
from .memlet import Memlet
from .symbolic import symbol
Expand Down
2 changes: 1 addition & 1 deletion dace/sdfg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from dace.sdfg.sdfg import SDFG, InterstateEdge, LogicalGroup, NestedDict

from dace.sdfg.state import SDFGState
from dace.sdfg.state import SDFGState, ControlFlowRegion

from dace.sdfg.scope import (scope_contains_scope, is_devicelevel_gpu, devicelevel_block_size, ScopeSubgraphView)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
'pyreadline;platform_system=="Windows"', 'typing-compat; python_version < "3.8"', 'packaging'
] + cmake_requires,
extras_require={
'testing': ['coverage', 'pytest-cov', 'scipy', 'absl-py', 'opt_einsum', 'pymlir', 'click'],
'testing': ['coverage', 'pytest-cov', 'scipy', 'absl-py', 'opt_einsum', 'pymlir', 'click', 'ipykernel', 'nbconvert'],
'docs': ['jinja2<3.2.0', 'sphinx-autodoc-typehints', 'sphinx-rtd-theme>=0.5.1']
},
entry_points={
Expand Down
24 changes: 24 additions & 0 deletions tests/tutorials/tutorials_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import nbformat
import pytest
from nbconvert.preprocessors import ExecutePreprocessor

BASE_PATH = "tutorials/"
NOTEBOOK_PATHS = [
f"{BASE_PATH}getting_started.ipynb",
f"{BASE_PATH}codegen.ipynb",
]


@pytest.mark.parametrize("notebook", NOTEBOOK_PATHS)
def test_notebook_exec(notebook):
with open(notebook) as f:
nb = nbformat.read(f, as_version=4)
ep = ExecutePreprocessor(timeout=600)
try:
assert ep.preprocess(nb) is not None, f"Got empty notebook for {notebook}"
except Exception:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please raise that exception. Otherwise we cannot know what went wrong. It will just raise an assertion error.

assert False, f"Failed executing {notebook}"


if __name__ == '__main__':
pytest.main(["-v", __file__])
20 changes: 1 addition & 19 deletions tutorials/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -404,25 +404,7 @@
]
}
],
"metadata": {
"kernelspec": {
"display_name": "dace_dev",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}