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] A stable fluid demo with sparse matrix #3081

Merged
merged 10 commits into from
Oct 5, 2021

Conversation

Hanke98
Copy link
Contributor

@Hanke98 Hanke98 commented Oct 2, 2021

Related issue = #2906 #2792

In this pr, we show a stable fluid demo that solves Poisson's equations by using the sparse matrix. Thanks to the fast LLT factorization, this demo runs about 5x faster than the Jacobian iteration version on the CPU backend (on my 2019 MBP i7-9750H ).

My questions are here:

  1. Is it possible to directly write the solution of the linear system to the taichi fields? For now, I have to first get the solution in numpy and then transfer it to the fields of pressure.
  2. Should we integrate this demo and the original stable fluid example into a single one? (by adding some options like use_sp_mat)

@FantasyVR could you please help me to figure them out? Thanks in advance!

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2021

CLA assistant check
All committers have signed the CLA.

@netlify
Copy link

netlify bot commented Oct 2, 2021

✔️ Deploy Preview for jovial-fermat-aa59dc ready!

🔨 Explore the source changes: 9634819

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

😎 Browse the preview: https://deploy-preview-3081--jovial-fermat-aa59dc.netlify.app

@yuanming-hu
Copy link
Member

Thank you!

Is it possible to directly write the solution of the linear system to the taichi fields? For now, I have to first get the solution in numpy and then transfer it to the fields of pressure.

We had some discussions about this before, and I believe ultimately we need a feature like this to avoid copying. We probably need to design a set of reasonable APIs to reshape the solution from 1D to 2D. For now, I think we can stick to the numpy solution :-)

Should we integrate this demo and the original stable fluid example into a single one? (by adding some options like use_sp_mat)

Sounds like a good idea!

@Hanke98
Copy link
Contributor Author

Hanke98 commented Oct 4, 2021

/format

@Hanke98 Hanke98 marked this pull request as ready for review October 4, 2021 11:43
Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

LGTM! Very cool!

examples/simulation/stable_fluid.py Outdated Show resolved Hide resolved
examples/simulation/stable_fluid.py Outdated Show resolved Hide resolved
examples/simulation/stable_fluid.py Outdated Show resolved Hide resolved
examples/simulation/stable_fluid.py Outdated Show resolved Hide resolved
@k-ye
Copy link
Member

k-ye commented Oct 5, 2021

Is it possible to directly write the solution of the linear system to the taichi fields?

- @strongoier, FYI our type system work should take into account the ability to do zero-copy with other frameworks. NDArray is a glimpse of this direction :-)

@Hanke98
Copy link
Contributor Author

Hanke98 commented Oct 5, 2021

/format

@k-ye k-ye merged commit cebb053 into taichi-dev:master Oct 5, 2021
@Hanke98 Hanke98 deleted the impl-SpM-demo branch October 5, 2021 13:45
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.

5 participants