Skip to content

Instantly share code, notes, and snippets.

@ailzhang
Created July 28, 2022 04:54
Show Gist options
  • Save ailzhang/01f82000050d1ed8fab0b7c6e9790289 to your computer and use it in GitHub Desktop.
Save ailzhang/01f82000050d1ed8fab0b7c6e9790289 to your computer and use it in GitHub Desktop.
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)
func_f = ti.func(f)
ker_f = ti.kernel(f)
ker_f()
@ti.kernel
def test():
func_f()
test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment