Skip to content

Instantly share code, notes, and snippets.

@jarmitage
Created March 16, 2023 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarmitage/4725f55a49063f05677aaae9078289ad to your computer and use it in GitHub Desktop.
Save jarmitage/4725f55a49063f05677aaae9078289ad to your computer and use it in GitHub Desktop.
import taichi as ti
ti.init()
n = 16
x = ti.field(ti.i32)
dyn = ti.root.dynamic(ti.i, n).place(x)
@ti.kernel
def add_data():
for i in range(10):
x.append(i)
print(x.length(), x[i]) # will print i
for i in range(10):
x.deactivate()
print(x.length()) # will print 0
add_data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment