# WARNING: could not attach metadata for @simd loop

**URL:** <https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334>\
**Category:** New to Julia\
**Created:** [January 6, 2017, 9:04pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334 "2017-01-06T21:04:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [January 6, 2017, 9:04pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/1 "2017-01-06T21:04:09Z")

</div>

I was trying to use @simd and was bounced back by this error. I googled this error and it seemed it was discussed in the following thread. But it’s different from my case, as mine has nothing to do with Travis. Thanks!!

[https://groups.google.com/forum/#!topic/julia-dev/u6G7f9mxaHI](https://groups.google.com/forum/#!topic/julia-dev/u6G7f9mxaHI)

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 6, 2017, 10:00pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/2 "2017-01-06T22:00:17Z")

</div>

What code are you running? What julia version? On what system? Is it a binary build or a build compiled from source?

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [January 6, 2017, 10:04pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/3 "2017-01-06T22:04:19Z")

</div>

I’m running a module that I wrote. This module has a few dependencies. I’m using Julia v0.5 on Ubuntu. It’s a binary build, downloaded from Julia’s downloads page. Thanks!!

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 6, 2017, 10:07pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/4 "2017-01-06T22:07:06Z")

</div>

The warning should have been removed in 0.5. It was printed in a few cases when vectorization fails (and in my experience mostly when the loop increment/condition is not inlined). Even when the warning is gone, it might still mean that the vectorization does not work, and you need to provide much more detail if you want to know why.

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [January 6, 2017, 10:25pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/5 "2017-01-06T22:25:57Z")

</div>

Thanks a lot. Here is a MWE that failed with the above error on my machine. See if it throws an error on yours. Or the loop is not inlined?

```julia
n = 100
N = 2*n+1

coefF = rand(Complex{Float64}, N)
freqF = -n:n

@simd for k = 1:N
  coefF[k] *= freqF[k]
end

```

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 6, 2017, 10:27pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/6 "2017-01-06T22:27:17Z")

</div>

Don’t do it in the global scope.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 6, 2017, 10:28pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/7 "2017-01-06T22:28:14Z")

</div>

Also, I don’t think `Complex` array can be vectorized but `StructOfArrays` should work.

---

<div class="post-metadata">

**Author:** ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Post date:** [January 6, 2017, 10:35pm UTC](https://discourse.julialang.org/t/warning-could-not-attach-metadata-for-simd-loop/1334/8 "2017-01-06T22:35:01Z")

</div>

Sorry. When I embed the above code snippet in a function, the error is gone. So, forget it.

However, the error was thrown even the loop+@simd were **inside** a function. But I can’t reproduce the error (non-global) with an MWE. Thanks anyway.
