import taichi as ti ti.init(ti.cuda) # A normal Python function def foo_py(): print("This is a Python function.") @ti.func def foo_1(): print("This is a Taichi function to be called by another Taichi function, foo_2().") @ti.func def foo_2(): print("This is a Taichi function to be called by a kernel.") foo_1() @ti.kernel def foo_kernel(): print("This is a kernel calling a Taichi function, foo_2().") foo_2() foo_py() # foo_1() # You cannot call a Taichi function from the Python scope foo_kernel()
taichi利用gpu并行运算
于 2022-10-30 15:13:11 首次发布