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
Hi, guys, can anyone help me and answer, why taichi doesn't work in my code? What i did wrong?
import time
from numba import jit
start_time = time.time()
import taichi as ti
ti.init(arch=ti.cpu, debug=True)
#@jit
@ti.kernel
def prime() -> int:
array = [j for j in range(2, 110000001)]
countprime = 0
prime = []
for i in array:
counter = 0
for n in range(1, i + 1):
if (i % n == 0):
counter += 1
if counter == 2:
prime.append(i)
countprime += 1
# print(i, "***", countprime)
if countprime == 10001:
break
answer = prime[-1]
return answer
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, guys, can anyone help me and answer, why taichi doesn't work in my code? What i did wrong?
import time
from numba import jit
start_time = time.time()
import taichi as ti
ti.init(arch=ti.cpu, debug=True)
#@jit
@ti.kernel
def prime() -> int:
array = [j for j in range(2, 110000001)]
countprime = 0
prime = []
answer = prime()
print("--- %s seconds ---" % (time.time() - start_time), answer)
Beta Was this translation helpful? Give feedback.
All reactions