taichi-dev/taichi

Reverse NDRange support

Open

#4379 aperta il 24 feb 2022

Vedi su GitHub
 (9 commenti) (4 reazioni) (1 assegnatario)C++ (2384 fork)batch import
feature requestgood first issuewelcome contribution

Metriche repository

Star
 (28.195 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor