taichi-dev/taichi

Reverse NDRange support

Open

#4 379 ouverte le 24 févr. 2022

Voir sur GitHub
 (9 commentaires) (4 réactions) (1 assigné)C++ (2 384 forks)batch import
feature requestgood first issuewelcome contribution

Métriques du dépôt

Stars
 (28 195 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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()

Guide contributeur