# Multithreading broadcasted array ops

**URL:** <https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842>\
**Category:** General Usage\
**Created:** [March 12, 2025, 4:08am UTC](https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842 "2025-03-12T04:08:06Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 13, 2025, 3:05am UTC](https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842/5 "2025-03-13T03:05:38Z")

</div>

> [@pxshen](#):
>
> I know of various multithreaded map functions but wish for a simple macro like `@threads A.+B` doesn’t seem to work?

> <https://github.com/JuliaLang/julia/issues/19777>
>
> It would be nice to be able to put \`@threads\` in front of a dot call, e.g. \`@thr…eads X .= f.(Y)\`, and have it call a multi-threaded version of \`broadcast\` (which would assume \`f\` is thread-safe).

> [@Multithreaded broadcast?](https://discourse.julialang.org/t/multithreaded-broadcast/26786):
>
> So, with the new improvements to threading, I’m wondering how that can be exposed easily to users. One of the most common parallelizable pattern is broadcasting (discussed in [https://github.com/JuliaLang/julia/issues/19777](https://github.com/JuliaLang/julia/issues/19777)). The conservative approach is to make @threads work for these, so we can do @threads a.= b.+ c. This is fine, but adding annotations gets annoying really fast (“so, what combination of @threads @simd @inbounds @. do I need this time?”), especially in matlab/numpy vector code …

> [@What is the “standard” way to use multi-threading with dot-calls (vectorized/broadcast)?](https://discourse.julialang.org/t/what-is-the-standard-way-to-use-multi-threading-with-dot-calls-vectorized-broadcast/113473):
>
> All the discussions I’ve found on this topic are years old: [“Multithreaded broadcast?” thread](https://discourse.julialang.org/t/multithreaded-broadcast/26786)[use multiple threads in vectorized operations · Issue #1802 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/1802)[multi-threaded (@threads) dotcall/broadcast? · Issue #19777 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/19777)[`@threads f(...)` syntax to tell callee to use threaded version? · Issue #40329 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/40329) What is currently the most straight-forward way to get multi-threading with operations like these: a = rand(4000, 4000) b…

> **[GitHub - Jutho/Strided.jl: A Julia package for strided array views and...](https://github.com/Jutho/Strided.jl)**
>
> A Julia package for strided array views and efficient manipulations thereof

---

_[View the full topic](https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842)._
