# Threading with @views and @tensor

**URL:** <https://discourse.julialang.org/t/threading-with-views-and-tensor/60466>\
**Category:** Performance\
**Created:** [May 3, 2021, 3:09pm UTC](https://discourse.julialang.org/t/threading-with-views-and-tensor/60466 "2021-05-03T15:09:56Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [May 4, 2021, 5:28am UTC](https://discourse.julialang.org/t/threading-with-views-and-tensor/60466/6 "2021-05-04T05:28:57Z")

</div>

> [@Aroeira](#):
>
> How big can be the error due to this associativity issue?

Very big: [Array ordering and naive summation](https://discourse.julialang.org/t/array-ordering-and-naive-summation/1929) (Stefan Karpinski demonstrated that you can get any values in [0,2^970) by summing identical 2046 values in different order)

> [@Aroeira](#):
>
> Just storing the values say as:
> 
> ```julia
> Evals = zeros(Threads.nthreads(), o)
> ...
> Evals[id, i] = sum(W)
> 
> ```
> 
> Does it still have the problem just because of `sum(W)` ?

Hmm… This is tricky, but I think it’s fine. (It’s tricky because it had the same problem if it were using the transpose `Evals[i, id]`.)

---

_[View the full topic](https://discourse.julialang.org/t/threading-with-views-and-tensor/60466)._
