Hi,
I’m starting to appreciate the benefits and simplicity of @parallel for in my codes… sometimes these really run fast, but I have seen that the operation you can perform on the result of each iteration in the for is relatively simple -or I have not understood hot to make it do more complex things.
For exemple, we can have something like
@everywhere function fsq(x)
return x*x
end
@parallel (+) for i in 1:1000
fsq(i)
end
and that simply adds the result of the parallel sum on each term. So far, so good… but what happens if I want to perform, say the sum of the logarithms of the different terms? I know I can modify the fsq(x) function to return the log of x^2, but I’m not looking for that kind of solutions… what I want to know is if there is a way to replace the (+) in the
@parallel (+) for i in 1:1000
with something like
@parallel sum(log()) for i in 1:1000
…which obviously does not work as I wrote it
Thanks in advance,
Ferran.