taichi-dev/taichi

Reverse NDRange support

Open

#4,379 opened on 2022年2月24日

GitHub で見る
 (9 comments) (4 reactions) (1 assignee)C++ (2,384 forks)batch import
feature requestgood first issuewelcome contribution

Repository metrics

Stars
 (28,195 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

There comes one special case which requires a reverse loop, so I used “ti.ndrange(8,0)” instead. However, the reverse loop just didn’t work with zero warnings or errors (I have no idea whether ti.ndrange can be used to loop in reverse order at that time) Perhaps a warning message can be given when n1 > n2 in ti.ndrange((n1,n2))

import taichi as ti
ti.init(arch=ti.gpu, debug=True, default_fp=ti.f64)

x = ti.field(ti.f64, shape=(10))

@ti.kernel
def main():
    x[9] = 1.0
    for i in ti.ndrange((8,0)):
        x[i] = 2.0 * x[i+1]
        print(x[i])    #print nothing

main()

コントリビューターガイド