Open idreamerhx opened 10 months ago
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.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] system: linux executable: /usr/bin/python3 platform: Linux-6.5.2-arch1-1-x86_64-with-glibc2.35 architecture: 64bit uname: uname_result(system='Linux', node='aaaaaa', release='6.5.2-arch1-1', version='#1 SMP PREEMPT_DYNAMIC Wed, 06 Sep 2023 21:01:01 +0000', machine='x86_64') locale: en_US.UTF-8 PATH: /bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl PYTHONPATH: ['/usr/local/bin', '/opt/test-taichi', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages']
Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy
import: <module 'taichi' from '/usr/local/lib/python3.10/dist-packages/taichi/init.py'>
No LSB modules are available. cc: False cpu: True metal: False opengl: False [W 10/26/23 06:51:29.067 5146] [opengl_api.cpp:initialize_opengl@167] Can not create OpenGL context cuda: True vulkan: False
glewinfo
not available: [Errno 2] No such file or directory: 'glewinfo'
Thu Oct 26 06:51:29 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05 Driver Version: 535.104.05 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3090 On | 00000000:01:00.0 Off | N/A |
| 0% 29C P8 30W / 420W | 2716MiB / 24576MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | 0 N/A N/A 4458 C /usr/bin/python3 1354MiB | | 0 N/A N/A 37918 C /usr/bin/python3 1352MiB | +---------------------------------------------------------------------------------------+
[Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.10.4
[Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.10.4 [Taichi] Starting on arch=x64
[W 10/26/23 06:51:30.000 5230] [opengl_api.cpp:initialize_opengl@167] Can not create OpenGL context [W 10/26/23 06:51:30.000 5230] [misc.py:adaptive_arch_select@753] Arch=[<Arch.opengl: 6>] is not supported, falling back to CPU [Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.10.4 [Taichi] Starting on arch=x64
[Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.10.4 [Taichi] Starting on arch=cuda
[Taichi] version 1.6.0, llvm 15.0.4, commit f1c6fbbd, linux, python 3.10.4
Taichi Programming Language
Docs: https://docs.taichi-lang.org/ GitHub: https://github.com/taichi-dev/taichi/ Forum: https://forum.taichi.graphics/
TAICHI EXAMPLES
──────────────────────────────────────────────────────────────────────────────
0: ad_gravity 25: keyboard 50: pbf2d
1: circle_packing_image 26: laplace 51: physarum
2: comet 27: laplace_equation 52:
poisson_disk_sampling
3: cornell_box 28: mandelbrot_zoom 53: print_offset
4: diff_sph 29: marching_squares 54: rasterizer
5: euler 30: mass_spring_3d_ggui 55: regression
6: eulerfluid2d 31: mass_spring_game 56: sdf_renderer
7: explicit_activation 32: 57: simple_derivative
mass_spring_game_ggui
8: export_mesh 33: mciso_advanced 58: simple_texture
9: export_ply 34: mgpcg 59: simple_uv
10: export_videos 35: mgpcg_advanced 60: snow_phaseField
11: fem128 36: minimal 61: stable_fluid
12: fem128_ggui 37: minimization 62: stable_fluid_ggui
13: fem99 38: mpm128 63: stable_fluid_graph
14: fractal 39: mpm128_ggui 64: taichi_bitmasked
15: fractal3d_ggui 40: mpm3d 65: taichi_dynamic
16: fullscreen 41: mpm3d_ggui 66: taichi_logo
17: game_of_life 42: mpm88 67: taichi_ngp
18: gui_image_io 43: mpm88_graph 68: taichi_sparse
19: gui_widgets 44: mpm99 69: texture_graph
20: implicit_fem 45: 70: tutorial
mpm_lagrangian_forces
21: 46: nbody 71:
implicit_mass_spring two_stream_instability
22: 47: odop_solar 72: vortex_rings
initial_value_problem
23: jacobian 48: oit_renderer 73: waterwave
24: 49: patterns
karman_vortex_street
──────────────────────────────────────────────────────────────────────────────
42
Running example minimal ...
[Taichi] Starting on arch=x64
42.0
Running time: 0.10s
Consider attaching this log when maintainers ask about system information.
Running time: 2.67s
Describe the bug A clear and concise description of what the bug is, ideally within 20 words.
To Reproduce `
python/taichi/examples/simulation/fractal.py
import taichi as ti import taichi.math as tm import numpy as np import matplotlib.pyplot as PLT import time import cv2
ti.init(arch=ti.gpu)
pixels = ti.tools.image.imread("/opt/test-taichi/sample1.png"); print(pixels.shape)
t1 = time.time() for i in range(100): pixels1 = ti.tools.image.imresize(pixels, pixels.shape[0]-i8, pixels.shape[1]-i4) t2 = time.time() print(pixels.shape) print((t2-t1)*1000, "ms")
PLT.imshow(pixels)
https://github.com/taichi-dev/image-processing-with-taichi/blob/main/image_bilinear_inpterpolation.py
src = cv2.imread("/opt/test-taichi/sample1.png"); h, w, c = src.shape scale = 5 dst = np.zeros((h scale, w scale, c), dtype=src.dtype)
img2d = ti.types.ndarray(element_dim=1)
@ti.kernel def bilinear_interp(src: img2d, dst: img2d): for I in ti.grouped(dst): x, y = I / scale x1, y1 = int(x), int(y) # Bottom-left corner x2, y2 = ti.min(x1 + 1, h - 1), ti.min(y1 + 1, w - 1) # Top-right corner Q11 = src[x1, y1] Q21 = src[x2, y1] Q12 = src[x1, y2] Q22 = src[x2, y2] R1 = tm.mix(Q11, Q21, x - x1) R2 = tm.mix(Q12, Q22, x - x1) dst[I] = ti.round(tm.mix(R1, R2, y - y1)).cast(ti.u8)
t1 = time.time() for i in range(100): bilinear_interp(src, dst) t2 = time.time() print(pixels.shape) print((t2-t1)*1000, "ms")
pixels = cv2.imread("/opt/test-taichi/sample1.png"); print(pixels.shape)
t1 = time.time() for i in range(100): pixels1 = cv2.resize(pixels, (pixels.shape[0]-i8, pixels.shape[1]-i4)) t2 = time.time() print(pixels.shape) print((t2-t1)*1000, "ms")
`
Log/Screenshots [Taichi] Starting on arch=cuda (1920, 1080, 3) (1920, 1080, 3) 1188.4496212005615 ms (1920, 1080, 3) 1971.1463451385498 ms (1080, 1920, 3) (1080, 1920, 3) 25.142669677734375 ms
Additional comments If possible, please also consider attaching the output of command
ti diagnose
. This produces the detailed environment information and hopefully helps us diagnose faster.If you have local commits (e.g. compile fixes before you reproduce the bug), please make sure you first make a PR to fix the build errors and then report the bug.