- Install Vulkan SDK from https://vulkan.lunarg.com/sdk/home#mac
- Set the following env
VULKAN_SDK=~/VulkanSDK/1.2.189.0/macOS
export VULKAN_SDK
#PATH="$PATH:$VULKAN_SDK/bin"
PATH="$VULKAN_SDK/bin:$PATH"
export PATH| import taichi as ti | |
| ti.init(ti.vulkan) | |
| tp_ivec3 = ti.types.vector(3, ti.i32) | |
| tp_ivec2 = ti.types.vector(2, ti.i32) | |
| tp_vec3 = ti.types.vector(3, ti.f32) | |
| x = ti.ndarray(ti.f32, shape=(12, 13)) | |
| y = ti.ndarray(tp_ivec3, shape=(12,4)) |
| import taichi as ti | |
| ti.init() | |
| # you must make sure the func body here works both in python and taichi scope. | |
| def f(): | |
| a = 0 | |
| for i in range(10): | |
| a += i | |
| print(a) |
| import paddle | |
| Python 3.8.11 (default, Aug 3 2021, 15:09:35) | |
| Type 'copyright', 'credits' or 'license' for more information | |
| IPython 7.26.0 -- An enhanced Interactive Python. Type '?' for help. | |
| In [1]: import paddle | |
| In [2]: import numpy as np | |
| In [4]: x = paddle.to_tensor(2 * np.ones((4, ), dtype=np.flo | |
| ...: at32)) |
| import os, json | |
| import taichi as ti | |
| ti.init(arch=ti.opengl, allow_nv_shader_extension=False, use_gles=True, ndarray_use_torch=False) | |
| dim = 2 | |
| N = 64 | |
| n_particles = N * N * 2 | |
| n_grid = 128 | |
| p_rho = 1 | |
| bound = 3 | |
| E = 400 |
| import taichi as ti | |
| from types import ModuleType, FunctionType | |
| import inspect | |
| import pdb | |
| import csv | |
| # FIXME: Without this init some calls will fail | |
| ti.init() | |
| def has_doc_string(x): |
| // Test Code | |
| import taichi as ti | |
| ti.init(arch=ti.vulkan,log_level=ti.TRACE) | |
| def test_snode_read_write(): | |
| dtype = ti.f16 | |
| x = ti.field(dtype, shape=()) | |
| x[None] = 0.3 | |
| print(x[None]) |
| { | |
| "aot_data": { | |
| "kernels": { | |
| "0": { | |
| "program": { | |
| "kernels": { | |
| "0": { | |
| "kernel_name" : "init_c40_00", | |
| "kernel_src" : ".//taichi_example.tcb_init_c40_00.glsl", |
VULKAN_SDK=~/VulkanSDK/1.2.189.0/macOS
export VULKAN_SDK
#PATH="$PATH:$VULKAN_SDK/bin"
PATH="$VULKAN_SDK/bin:$PATH"
export PATH| # Authored by Yuanming Hu, Taichi Graphics. | |
| import taichi as ti | |
| ti.init(arch=ti.gpu) | |
| max_num_particles = 1024 | |
| substeps = 10 | |
| spring_Y = 1000 # Young's modulus | |
| drag_damping = 1 | |
| dashpot_damping = 100 |
| # Authored by Tiantian Liu, Taichi Graphics. | |
| import taichi as ti | |
| import math | |
| ti.init(arch=ti.cpu) | |
| # global control | |
| paused = ti.field(ti.i32, ()) | |
| # gravitational constant 6.67408e-11, using 1 for simplicity |