Created
July 28, 2022 04:54
-
-
Save ailzhang/01f82000050d1ed8fab0b7c6e9790289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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