Hello! I’m trying to re-implement my javascript 3d mpm code in Taichi. At the moment i don’t get the same results, and I’m trying to find the cause for the difference. However, I can’t find a way of printing debugging messages in the code. For example, print("p2g") inside a ti.kernel throws
TypeError: make_const_expr_f32(): incompatible function arguments. The following argument types are supported:
1. (arg0: float) -> taichi_core.Expr
Invoked with: 'p2g'.
For now, taichi doesn’t support printing strings inside a kernel. Only numbers are allowed due to hardware limitations. (sadly)
Btw, you can print debug info by setting environment variables: TI_LOG_LEVEL=debug python your_file_name.py
thank you @archibate!
I found the print command reading the docs one more time and also realised that it only works with numbers. So, for printing a vector I do several separate prints: print(x[0]); print(x[1]); etc., and for matrices print(m[0,0]), etc.
I managed to debug my code and even running on the CPU it’s impressively fast!
Thank you so much!! (I’m a very optimistic person: I took my first online course of Mandarin to try to understand your Taichi-con videos ! If we meet one day, I should be able to introduce myself )
Sounds cool! Feel free to ask help from native speakers when you need. I’m looking forward to meet you too Btw, it’s heard that @yuanming would like to held the TaichiCon 1 in English, would you like to participate? I will be there as an audience of course
I would love to participate! I’ve been using a script based on @yuanming’s 88-lines code for MPM, first transformed to 3D, and now using Taichi, for simulating brain growth and folding. I’d love to have your input!