Problem with LoopVectorization : @turbo, LoopVectorization.check_args

Can you try ] registry up?

Nothing happened with ] registry up.

Maybe?

pkg> registry rm General
pkg> registry add https://github.com/JuliaRegistries/General
pkg> up
pkg> add VectorizationBase@0.21.54
1 Like

Hi, do you solve your problem? I tried to use StructArray.jl but it still didn’t work:

val=StructArray(0.0+0.0*im);st=rand(1000000);
@turbo for n in 1:2
    val +=StructArray(inv(1.0+0.0001*im - st[n]))
end
┌ Warning: #= In[121]:1 =#:
│ `LoopVectorization.check_args` on your inputs failed; running fallback `@inbounds @fastmath` loop instead.
│ Use `warn_check_args=false`, e.g. `@turbo warn_check_args=false ...`, to disable this warning.
└ @ Main C:\Users\mymoo\.julia\packages\LoopVectorization\FMfT8\src\condense_loopset.jl:1049
ArgumentError: only eltypes with fields are supported

What’s wrong with this and how to make this correct?

Update:
I just add a transit variable in loop, and now it works.

val=StructArray(0.0+0.0*im);st=rand(1000000);
@turbo for n in 1:2
        v=val;
        val =v+StructArray(inv(1.0+im*0.001 - st[n]))
        end
0.001791 seconds (6.94 k allocations: 387.273 KiB, 95.28% compilation time)

I can’t understand why is it correct now.

LoopVectorization.jl will only warn once, so you’re probably just not seeing the warning.

1 Like

I compare the time consuming of cases with or without @turbo, and they are different. @turbo case is 10x faster. I guess it works well. Just I cannot understand it’s mechanism on this example, and all variables matches types each other. Could I know how to make this correct?

It work updating as you suggested. Though it basically made a new General registry in my local directory (I’m working on a cluster so I don’t have permissions for the rm line). Thanks for your help!