You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from time import time as now
import taichi as ti
#ti.init(arch=ti.gpu) # ok for normal gpu but failed for directx
ti.init(arch=ti.dx11) # not ok
#ti.init(arch=ti.cpu) #ok
#ti.init()
ext_arr = ti.types.ndarray
@ti.kernel
def ti_test1(a:ext_arr(),b:ext_arr()):
for I in ti.grouped(a): ti.atomic_add(b[I.sum()],a[I])
a = np.random.rand(3,4,5).astype(np.float32)
print('a',a)
b = np.zeros((sum(a.shape),),dtype=np.float32)
print('b',b)
print(a[1,1,1])
t1=now()
ti_test1(a,b)
ti.sync()
t2=now()
#print(a[1,1,1])
print('t2-t1',t2-t1)
print(b)
print(a.sum(),b.sum())
# should pass:
assert abs(a.sum()-b.sum())<0.001
The text was updated successfully, but these errors were encountered:
here is the testing code
The text was updated successfully, but these errors were encountered: