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

[microTVM] Enable micro tvmc tutorial testing in CI #10555

Merged
merged 5 commits into from
Mar 16, 2022

Conversation

mehrdadh
Copy link
Member

@mehrdadh mehrdadh commented Mar 9, 2022

This PR changes micro_tvmc.py tutorial to a bash script tutorial. Also it adds a python script which converts a bash script tutorial to python format for doc generation.

I have added the script conversion to lint task to make sure the generated python tutorial passes the format.

cc @areusch @driazati

@github-actions github-actions bot removed the request for review from a team March 9, 2022 21:55
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

left some comments, and cc @Mousius

docs/script_convert.py Outdated Show resolved Hide resolved
docs/script_convert.py Show resolved Hide resolved
python3 gallery/how_to/work_with_microtvm/micro_tflite.py
python3 gallery/how_to/work_with_microtvm/micro_autotune.py
./gallery/how_to/work_with_microtvm/micro_tvmc.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add this to make docs instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

This script requires zephyr.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah hmm. that is a bit challenging then....maybe my other questions are tricky to implement given this limitation of doc-builder.

Copy link
Member Author

@mehrdadh mehrdadh Mar 14, 2022

Choose a reason for hiding this comment

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

I think that would be a bigger change. GPU docker image which is used for doc generation should be able to run Zephyr and other platforms in future. Other possibility is to have each docker step to run and convert the script which is related to their target and store the output in a shared directory which is passed to GPU doc stage. Not sure how much of this idea is feasible in our Jenkins configuration. 

Copy link
Member

Choose a reason for hiding this comment

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

this is almost what we do now (the GPU docker image runs the tutorials and sends a tar.gz to another step to deploy it), we could do the same here and add some way of unifying the two (like unpack, make sure no file names collide, send the whole thing to the docs deploy)

Copy link
Member Author

Choose a reason for hiding this comment

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

@driazati Does this work between executors? Can we run something on ci-qemu and pass it to ci-gpu for doc generation?

Copy link
Contributor

Choose a reason for hiding this comment

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

k, so for this PR the delta is at least that now we test the tvmc commands to make sure they don't crash. next it would be great to do what @driazati mentioned, where we run script_convert.py in ci-qemu and then forward the output to the doc-builder step. let's merge this now though to make incremental progress.

if bash_detected:
if line == BASH:
# write the bash block to destination
python_code = "# .. code-block:: bash\n#\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

should we run the bash script from this file and include the output? we could probably do that by injecting output markers into the script e.g.

echo -e "\nSTART OF COMMAND 1 OUTPUT --->"
tvmc ...
echo -e "\n<--- START OF COMMAND 1 OUTPUT"

then we could take the bash-ignore commented areas, extract them into a common prelude, and also include stuff like set -eux so that people write proper bash scripts. we could maybe do this by putting that into a docs/bash_gallery_prelude.sh and erroring in this script if we don't see a line like:

source docs/bash_gallery_prelude.sh || exit 2

might need to think about the path a little bit

Copy link
Member Author

Choose a reason for hiding this comment

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

Is the idea to add the output of each command to generated python file and finally have it as part of generated HTML file?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah exactly

@github-actions github-actions bot requested a review from areusch March 15, 2022 15:51
@mehrdadh
Copy link
Member Author

@areusch I added test file and address your comments. PTAL, thanks!

docs/script_convert.py Outdated Show resolved Hide resolved
python3 gallery/how_to/work_with_microtvm/micro_tflite.py
python3 gallery/how_to/work_with_microtvm/micro_autotune.py
./gallery/how_to/work_with_microtvm/micro_tvmc.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

k, so for this PR the delta is at least that now we test the tvmc commands to make sure they don't crash. next it would be great to do what @driazati mentioned, where we run script_convert.py in ci-qemu and then forward the output to the doc-builder step. let's merge this now though to make incremental progress.

@github-actions github-actions bot requested a review from areusch March 15, 2022 22:06
@areusch areusch merged commit ed6e7c0 into apache:main Mar 16, 2022
@mehrdadh mehrdadh deleted the add_tvmc_to_ci branch March 16, 2022 21:44
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Mar 23, 2022
This file is generated automatically by
`tests/scripts/task_convert_scripts_to_python.sh`, added in
apache#10555, and can be generated when
running the `ci.py lint` script locally.
leandron pushed a commit that referenced this pull request Mar 23, 2022
This file is generated automatically by
`tests/scripts/task_convert_scripts_to_python.sh`, added in
#10555, and can be generated when
running the `ci.py lint` script locally.
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
* Add script convertor

* Address comments: added test

* address comments
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
This file is generated automatically by
`tests/scripts/task_convert_scripts_to_python.sh`, added in
apache#10555, and can be generated when
running the `ci.py lint` script locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants