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

question
simd
parallel

#1

Any chance of something like the following work?

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

#2

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.


#3

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.


#4

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:.


#5

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


#6

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