So, I would do something like this. Note that I think you shouldn’t use Any. You should use a real type.
results_all = SharedArray{Int}(I, J, K)
@sync @distributed for i = 1:I
for j = 1:J, k = 1:K
result = do_one(...)
results_all[i, j, k] = result
end
end
You might want to move the distributed for to one of the inner loops, but that’s how to parallelize it.