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

[Example] Fix the ti example problems of sparse matrix demos #3215

Merged
merged 5 commits into from
Oct 18, 2021

Conversation

Hanke98
Copy link
Collaborator

@Hanke98 Hanke98 commented Oct 18, 2021

Related issue = #3216 #3116 #3081

When you type ti example stable_fluid, it will not run the example successfully:

[Taichi] version 0.8.3, llvm 10.0.0, commit 306cdbf3, linux, python 3.9.5

*******************************************
**      Taichi Programming Language      **
*******************************************

Docs:   https://taichi.rtfd.io/en/stable
GitHub: https://github.com/taichi-dev/taichi
Forum:  https://forum.taichi.graphics

Running example stable_fluid ...
usage: stable_fluid.py [-h] [-s]
stable_fluid.py: error: unrecognized arguments: example stable_fluid

So does the implicit mass-spring demo.

The reason is that the runpy.run_path method will pass the sys.argv which contains the arguments of the command: ti example ... to the example scripts and some of these arguments will not be recognized by the demos.

Here, I use a quick solution: use ArgumentParser.parse_known_args() instead of ArgumentParser.parse_args().

In the long run, I think we should support passing the arguments correctly from the ti CLI to examples since some arguments are important to the examples.

@netlify
Copy link

netlify bot commented Oct 18, 2021

✔️ Deploy Preview for jovial-fermat-aa59dc canceled.

🔨 Explore the source changes: 0075a51

🔍 Inspect the deploy log: https://app.netlify.com/sites/jovial-fermat-aa59dc/deploys/616d3f3a35ee360007ac4e84

Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

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

LGTM!
Can you open an issue to track this and add a TODO in the comment?
Thanks!

@ailzhang
Copy link
Contributor

Alternatively if we could only pass sys.argv[2:] to downstream( ofc add a comment saying that we skipped ti, example) that seems better?

@Hanke98
Copy link
Collaborator Author

Hanke98 commented Oct 18, 2021

Thanks!

Can you open an issue to track this and add a TODO in the comment?

Sure, I am working on that.

Alternatively if we could only pass sys.argv[2:] to downstream( ofc add a comment saying that we skipped ti, example) that seems better?

Good Idea! Let me write it to the issue. Thanks!

@Hanke98 Hanke98 requested a review from ailzhang October 18, 2021 09:33
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

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

LGTM!
@Hanke98 would you mind helping sending a followup fix later as well ;) ? Thanks a lot!

@ailzhang ailzhang merged commit 88923ba into taichi-dev:master Oct 18, 2021
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.

2 participants