taichi icon indicating copy to clipboard operation
taichi copied to clipboard

Weird performance for fabric python example on M1 mac with screen size 1024*1024

Open Jianghanxiao opened this issue 10 months ago • 3 comments

Describe the bug Find a weird thing when learning taichi. https://docs.taichi-lang.cn/docs/cloth_simulation For this example, the code works well on linux, but on my mac M1, I find that there will be problem like this. I check the ti example 31, this one works well on my mac. I further check the python example source code, I find in that version, the screen size is 768768. But for the screen size in the document 10241024, there will be problem like this. I wonder what's the problem of this? image

To Reproduce https://github.com/taichi-dev/taichi/blob/master/python/taichi/examples/ggui_examples/mass_spring_3d_ggui.py#L125

Log/Screenshots

python spring_mass_frabric.py                                                                                                                                                                                  
[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19
[Taichi] Starting on arch=vulkan
RHI Error: Potential non-conformant Vulkan implementation, enabling VK_KHR_portability_subset
...

I find that with 768*768, the error is also there and doesn't influence

Additional comments

[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19

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

Docs:   https://docs.taichi-lang.org/
GitHub: https://github.com/taichi-dev/taichi/
Forum:  https://forum.taichi.graphics/

Taichi system diagnose:

python: 3.8.19 (default, Mar 20 2024, 15:00:34) 
[Clang 14.0.6 ]
system: darwin
executable: /Users/shawn/opt/anaconda3/envs/taichi/bin/python
platform: macOS-10.16-x86_64-i386-64bit
architecture: 64bit 
uname: uname_result(system='Darwin', node='HanxiaodeMacBook-Pro.local', release='23.4.0', version='Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103', machine='x86_64', processor='i386')
locale: en_CA.UTF-8
PATH: /opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/opt/homebrew/opt/llvm/bin:/Users/shawn/opt/anaconda3/envs/taichi/bin:/Users/shawn/opt/anaconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin
PYTHONPATH: ['/Users/shawn/opt/anaconda3/envs/taichi/bin', '/Users/shawn/opt/anaconda3/envs/taichi/lib/python38.zip', '/Users/shawn/opt/anaconda3/envs/taichi/lib/python3.8', '/Users/shawn/opt/anaconda3/envs/taichi/lib/python3.8/lib-dynload', '/Users/shawn/.local/lib/python3.8/site-packages', '/Users/shawn/opt/anaconda3/envs/taichi/lib/python3.8/site-packages']

`lsb_release` not available: [Errno 2] No such file or directory: 'lsb_release'


import: <module 'taichi' from '/Users/shawn/opt/anaconda3/envs/taichi/lib/python3.8/site-packages/taichi/__init__.py'>

cpu: True
metal: True
opengl: False
cuda: False
vulkan: True

`glewinfo` not available: [Errno 2] No such file or directory: 'glewinfo'

`nvidia-smi` not available: [Errno 2] No such file or directory: 'nvidia-smi'
[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19

[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19
[Taichi] Starting on arch=x64

[W 04/23/24 21:15:06.909 196178] [misc.py:adaptive_arch_select@758] Arch=[<Arch.opengl: 5>] is not supported, falling back to CPU
[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19
[Taichi] Starting on arch=x64

[W 04/23/24 21:15:07.340 196228] [misc.py:adaptive_arch_select@758] Arch=[<Arch.cuda: 3>] is not supported, falling back to CPU
[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19
[Taichi] Starting on arch=x64

[Taichi] version 1.7.0, llvm 15.0.5, commit 2fd24490, osx, python 3.8.19

Jianghanxiao avatar Apr 24 '24 02:04 Jianghanxiao

It seems that even with 768*768, if I resizing the GUI smaller, then such cases can also be observed. Maybe the sphere drawing somehow is not correct, becasue the physics seem correct. Just the ball visuals may become too big in some screen size, when resizing the window, sometimes it's okay, sometimes there will be such problem. image

Jianghanxiao avatar Apr 24 '24 02:04 Jianghanxiao

This will works well if I remove the scene.particle, instead draw two traingles there to represent the sphere. This time no matter how to resize, the stuff looks well. I wonder why the scene.particles is related to the window size? Is this a design or a bug? image

Jianghanxiao avatar Apr 24 '24 02:04 Jianghanxiao

I think the sphere radius is miscalculated to become 2x its intended size. Could be related to HiDPI behaviors.

bobcao3 avatar Jun 22 '24 23:06 bobcao3