# Using PARTR in Julia 1.2?

**URL:** https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485
**Category:** General Usage
**Created:** [June 20, 2019, 2:50pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485 "2019-06-20T14:50:49Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 20, 2019, 2:50pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/1 "2019-06-20T14:50:49Z")

</div>

Hi,

from what I understand, PARTR (resp. parts of what it will become) will be part of Julia 1.2. I’m keen to try it out, if possible, by my attempts at starting tasks within an `@threads` loop have failed, the tasks always seem to run on thread 1.

Does someone have a short PARTR example (assuming it’s indeed part of v1.2-rc1)?

Cheers,

Oliver

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [June 20, 2019, 2:56pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/2 "2019-06-20T14:56:34Z")

</div>

I believe one has to set an environment variable, `export JULIA_NUM_THREADS=2`, or of course any number that fits your machine.

```julia
$ export JULIA_NUM_THREADS=4

PetrKrysl@Spectre MINGW64 ~/Downloads/FinEtools.jl (master)
$ julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.3.0-DEV.250 (2019-05-19)
 _/ |\ __'_|_|_|\__'_| | Commit ab3ecdfbcb (31 days old master)
|__/ |

julia> versioninfo()
Julia Version 1.3.0-DEV.250
Commit ab3ecdfbcb (2019-05-19 17:49 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 4

```

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 20, 2019, 3:28pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/3 "2019-06-20T15:28:39Z")

</div>

Sure, I do set `JULIA_NUM_THREADS`, of course, and the `@threads` loop uses them - just the tasks I spawn in there all seem to run on thread one. By maybe I misunderstand how PARTR is supposed to work?

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [June 20, 2019, 3:29pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/4 "2019-06-20T15:29:52Z")

</div>

Is there a MWE?

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [June 20, 2019, 3:59pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/5 "2019-06-20T15:59:48Z")

</div>

See here:

> [@Julia 1.2 feature freeze April 4th](https://discourse.julialang.org/t/julia-1-2-feature-freeze-april-4th/22478/14):
>
> I see, thanks. Will nested @threads loops work properly (depth first)? Or would that require a new API?

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 20, 2019, 5:53pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/6 "2019-06-20T17:53:14Z")

</div>

Ah, thanks, that clears thing up regarding `@threads`. So there’s some machinery for PARTR in v1.2, but not enough to use it yet? Or does one use it independently from `@threads`?

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [June 20, 2019, 6:03pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/7 "2019-06-20T18:03:49Z")

</div>

The machinery is mostly all in place, but for now `@threads` will still use the regular static scheduling.

We don’t know yet if there will be a different syntax to use depth-first scheduling.

For now then, there are pretty much no user-facing changes, which the exception as @jeff.bezanson said that a few more operations (IO and task switches) work inside `@threads`.

Maybe Jeff can give an update in case something changed since April.

---

<div class="post-metadata">

### Author: ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)
#### Post date: [June 20, 2019, 7:08pm UTC](https://discourse.julialang.org/t/using-partr-in-julia-1-2/25485/8 "2019-06-20T19:08:44Z")

</div>

Thanks for the infos! I guess we’ll hear more exiting things in this direction in Baltimore. 🙂
