taichi-dev/taichi

Reverse NDRange support

Open

#4,379 创建于 2022年2月24日

在 GitHub 查看
 (9 评论) (4 反应) (1 负责人)C++ (2,384 fork)batch import
feature requestgood first issuewelcome contribution

仓库指标

Star
 (28,195 star)
PR 合并指标
 (30 天内没有已合并 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()

贡献者指南