# Problem with @avx and LoopVectorization: UndefVarError

Hello,

I am running the following code using LoopVectorization,

``````using Random, BenchmarkTools, LoopVectorization

J = 1000
T = 100

Mat1 = rand(J,J)
vec1 = rand(J)

Mat2= rand(J,J)
vec2 = rand(J)

Mat3 = rand(J,J,T)
vec3 = rand(J,T)

function f1(X,Y,Z,params,Mat1,Mat2,vec2,vec1,vec3,Mat3)
(J,T) = size(X)
(γoᴱ,γgᴱ,ψgᴱ,κgᴱ,γlᴱ,ψlᴱ,κlᴱ,γaᴱ,ψaᴱ,κaᴱ)=params
eⱼX = zeros(Float32,J,T)
eⱼY = zeros(Float32,J,T)
eⱼZ = zeros(Float32,J,T)

E1 = zeros(Float32, J, J)
E2 = zeros(Float32, J, J)
E3 = zeros(Float32, J, J, T)

@avx E1 .=exp.(Mat1.*(-κgᴱ))
@avx E2 .=exp.(Mat2.*(-κlᴱ))
@avx E3 .=exp.(Mat3.*(-κaᴱ))

for t=1:T
for l=1:J
@avx for j=1:J
ejl = γoᴱ+γgᴱ*(1+ψgᴱ*vec1[j])*E1[j,l]+γlᴱ*(1+ψlᴱ*vec2[j])*E2[j,l]+γaᴱ*(1+ψaᴱ*vec3[j,t])*E3[j,l,t]
elj = γoᴱ+γgᴱ*(1+ψgᴱ*vec1[l])*E1[j,l]+γlᴱ*(1+ψlᴱ*vec2[l])*E2[j,l]+γaᴱ*(1+ψaᴱ*vec3[l,t])*E3[j,l,t]
eⱼX[j,t] =eⱼX[j,t] + X[l,t]*(ejl+elj)*(l!=j)
eⱼY[j,t] =eⱼY[j,t] + Y[l,t]*(ejl+elj)*(l!=j)
eⱼZ[j,t] =eⱼZ[j,t] + Z[l,t]*(ejl+elj)*(l!=j)
end
end
end
return eⱼX, eⱼY, eⱼZ
end

params = [0.0,
22.504883,
0.00010256348,
0.0021472168,
28.549805,
1.4460449,
23.164062,
29.42871,
1.4924316,
79.72656]

TEST1res = f1(zeros(Int8,J,60),ones(Int8,J,60),ones(Int8,J,60),params,Mat1,Mat2,vec2,vec1,vec3,Mat3)

``````

and I get the following error code

``````ERROR: UndefVarError: ###tempload###21### not defined
Stacktrace:
[1] f1(::Array{Int8,2}, ::Array{Int8,2}, ::Array{Int8,2}, ::Array{Float64,1}, ::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,2}, ::Array{Float64,3}) at ./REPL[53]:19
[2] top-level scope at REPL[56]:1
``````

I am running this on a server with Julia 1.5.0, The version of LoopVectorization is LoopVectorization v0.12.28. The same code works on another machine.

The version is

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

Can you post `versioninfo()`?

Sure, edited Original post