# Is there a way to indicate local parallelism?

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-indicate-local-parallelism/2128>\
**Category:** General Usage\
**Created:** [February 15, 2017, 8:09pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-indicate-local-parallelism/2128 "2017-02-15T20:09:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [February 15, 2017, 8:09pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-indicate-local-parallelism/2128/1 "2017-02-15T20:09:00Z")

</div>

With a sorting network, I can sort 4 values using 5 comparisons in three sequential groups.  
The first two comparisons are internally independent, so ok to do in parallel. And so for the next two.

Is there a way to let Julia know a local sequence that is not a loop need not be sequential?

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [February 16, 2017, 6:06am UTC](https://discourse.julialang.org/t/is-there-a-way-to-indicate-local-parallelism/2128/2 "2017-02-16T06:06:17Z")

</div>

You could write explicit SIMD code with [SIMD.jl](https://github.com/eschnett/SIMD.jl)

---

<div class="post-metadata">

**Author:** ![adamslc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adamslc/32/3452_2.png) [@adamslc](https://discourse.julialang.org/u/adamslc)\
**Post date:** [February 16, 2017, 6:35am UTC](https://discourse.julialang.org/t/is-there-a-way-to-indicate-local-parallelism/2128/3 "2017-02-16T06:35:22Z")

</div>

You could also look into using the `@async` and `@sync` macros. For example, you could write

```julia
@sync begin
    @async ...
    @async ...
end

```
