Is it possible to use @simd with multiple variable loop?

Any chance of something like the following work?

@simd for i=1:10000, j=1:10000
  # do something
end

I don’t see any reason why @simd couldn’t work in this case by interpreting it exactly like this:

for i=1:10000
  @simd for j=1:10000
      # do something
  end
end

which does work. I think that capability just needs to be added.

1 Like

I discarded that option for now, in my case @simd is taking more time than the raw for loop.

Thanks for sharing your thoughts, I have the same feeling, that this could be implemented at some point.

Yeah, that’s pretty common. If you’re using the -O3 setting for the compiler, it’ll add SIMD when it’s a good idea anyways, and its choice tends to be better than yours, or at least mine :slight_smile:.

2 Likes

So we have to pass in an option to Clang somewhere?

Oh, Julia has an option there, I will try later. Thanks!