We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import taichi as ti import numpy as np import time ti.init(arch=ti.cuda)#,debug=True) n=1<<18 a=np.random.randn(n).astype(np.float32) b=ti.field(ti.f32,n) b.from_numpy(a) @ti.kernel def sum1()->ti.f32: result=0.0 for i in b: result+=b[i] return result #compile sum1() t1=time.time() for _ in range(1000): a.sum() t2=time.time() for _ in range(1000): sum1() ti.sync() t3=time.time() print('time numpy:',t2-t1,'time ti atomic_add:',t3-t2) input('enter to continue')
result in RTX3060 and R7 5800H is:
time numpy: 0.07301616668701172 time ti atomic_add: 0.3090794086456299
The text was updated successfully, but these errors were encountered:
No branches or pull requests
result in RTX3060 and R7 5800H is:
The text was updated successfully, but these errors were encountered: