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

[IPython] [opengl] Make OpenGL kernel print work in IPython & IDLE #1303

Merged
merged 6 commits into from
Jun 27, 2020

Conversation

archibate
Copy link
Collaborator

Related issue = depends #1222

[Click here for the format server]


@archibate archibate marked this pull request as ready for review June 24, 2020 07:04
@archibate archibate requested review from k-ye and yuanming-hu June 24, 2020 07:05
python/taichi/lang/kernel.py Outdated Show resolved Hide resolved
python/taichi/misc/image.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #1303 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1303   +/-   ##
=======================================
  Coverage   85.50%   85.50%           
=======================================
  Files          19       19           
  Lines        3352     3353    +1     
  Branches      622      622           
=======================================
+ Hits         2866     2867    +1     
  Misses        356      356           
  Partials      130      130           
Impacted Files Coverage Δ
python/taichi/lang/impl.py 90.09% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b7078b...9bc605c. Read the comment docs.

Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

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

Cool!

@archibate
Copy link
Collaborator Author

Note that this only fix for the OpenGL backend. Please unify the CPU+CUDA (@yuanming-hu) and Metal (@k-ye) behavior to PythonPrintBuffer later.

@archibate archibate added the LGTM label Jun 25, 2020
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.

Cool!

I think it makes sense to always call ti.sync after kernels with print. When people are printing (e.g. for debugging purposes), they usually don't really care about performance.

docs/syntax.rst Outdated Show resolved Hide resolved
@archibate
Copy link
Collaborator Author

Cool!

I think it makes sense to always call ti.sync after kernels with print. When people are printing (e.g. for debugging purposes), they usually don't really care about performance.

But how do I hook kernel invocations? According to your comments in Kernel.__call__, I'm afraid detecting if self.has_print will harm non-print kernel's performance.

@yuanming-hu
Copy link
Member

Cool!
I think it makes sense to always call ti.sync after kernels with print. When people are printing (e.g. for debugging purposes), they usually don't really care about performance.

But how do I hook kernel invocations? According to your comments in Kernel.__call__, I'm afraid detecting if self.has_print will harm non-print kernel's performance.

We can do that in the C++ part.

@archibate
Copy link
Collaborator Author

Cool!
I think it makes sense to always call ti.sync after kernels with print. When people are printing (e.g. for debugging purposes), they usually don't really care about performance.

But how do I hook kernel invocations? According to your comments in Kernel.__call__, I'm afraid detecting if self.has_print will harm non-print kernel's performance.

We can do that in the C++ part.

No, we have to perform a Python print to make IDLE/IPython get the string to their GUI, instead of console stdout.
That's why I need the print(ti.core.pop_print_buffer()) to pop C++ prints into Python prints.

@archibate archibate changed the title [IPython] Make kernel print work in IPython & IDLE [IPython] [opengl] Make OpenGL kernel print work in IPython & IDLE Jun 27, 2020
@archibate archibate merged commit 22dc529 into taichi-dev:master Jun 27, 2020
@yuanming-hu yuanming-hu mentioned this pull request Jun 28, 2020
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