I was previously using Threads on a nested loop as follows
Threads.@threads for (aₓ, bₓ) in collect(Iterators.product(1:N.A, 1:N.B))
...
end
This works, but collect(Iterators.product(1:N.A, 1:N.B))
is allocating. I can instead do
LoopIndices = CartesianIndices((N.A, N.B))
Threads.@threads for abₓ in LoopIndices
(aₓ, bₓ) = Tuple(LoopIndices[abₓ])
...
end
which is not allocating, but a bit cumbersome. Is there a better way to achieve this?