Comment by npalli
8 months ago
Is the recursive sum the best function to show multi-threading or GPU speedups? Seems unlikely. FWIW, i ported the python example to Julia and it ran in about 2.5 seconds the same as the C++ version. Pure python 3.12 took 183 seconds.
function sum(depth, x)
if depth == 0
return x
else
fst = sum(depth-1, x*2+0)
snd = sum(depth-1, x*2+1)
end
return fst + snd
end
println(sum(30,0))
No comments yet
Contribute on Hacker News ↗