taichi icon indicating copy to clipboard operation
taichi copied to clipboard

Use pprintpp to offer Python-style printf in Taichi scope

Open lucifer1004 opened this issue 1 year ago • 2 comments

Concisely describe the proposed feature Currently, print() works differently in Python and Taichi scopes. In Taichi scopes, the format part is merely discarded.

Describe the solution you'd like (if any) Projects like pprintpp provide Pythonic printf in C++, and can be used in Taichi.

lucifer1004 avatar Sep 06 '22 05:09 lucifer1004

Related issues: #5949 #5972

lucifer1004 avatar Sep 06 '22 07:09 lucifer1004

Hey @lucifer1004 ! Thanks for the feature request! IIUC pprintpp-like support is feasible on cpu backend, but for backends like cuda/vulkan printing actually happens on device and we'll mostly limit to what they support. For example "%s" is not supported on vulkan :P so it does require some tweaks for each backend to support them. Btw we currently partially support f-string since we does the parsing in python preprocessing ;)

ailzhang avatar Sep 17 '22 04:09 ailzhang