On Friday, February 12, 2016 08:30:26 PM Joaquim Dias Garcia wrote:
> Is there any way around it?
>
> I was planning a monte-carlo code, but all the iteration rely on some huge
> amount of data which is always the same. So sending it back and forth to
> the device would be a bottleneck...
Again, you can use loops, you just have to write your code in a way that is
actually valid syntax. Something like this:
result = devices(dev->capability(dev)[1]>=2) do devlist
MyCudaModule.init(devlist) do dev
result = Array(T, n)
d_mat = CudaArray(mat)
# more allocation here...
for i = 1:n
result[i] = my_calculation(d_mat, othervariables, i)
end
result
end
end
The problem with your old version is that `result = for i = 1:n...` is not
supported syntax in julia.
--Tim