# Map\_rect multithreading in RStan Catalina

**URL:** <https://discourse.mc-stan.org/t/map-rect-multithreading-in-rstan-catalina/15582>\
**Category:** Developers\
**Created:** [June 3, 2020, 5:31am UTC](https://discourse.mc-stan.org/t/map-rect-multithreading-in-rstan-catalina/15582 "2020-06-03T05:31:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamramey](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/adamramey/32/4419_2.png) [@adamramey](https://discourse.mc-stan.org/u/adamramey)\
**Post date:** [June 3, 2020, 5:31am UTC](https://discourse.mc-stan.org/t/map-rect-multithreading-in-rstan-catalina/15582/1 "2020-06-03T05:31:54Z")

</div>

Hi all,

So I wrote some code that uses map\_rect in RStan prior to OS X Catalina. I had it working fine by setting the DSTAN\_THREADS environmental variable in my Makevars file. However, I know that all of this got changed with Catalina. Right now, if I add the += DSTAN\_THREADS to my Makevars code won’t compile any more.

Anyone solve this? (PS I can run it just fine in cmdStan but prefer to use RStan where possible.)

---

<div class="post-metadata">

**Author:** ![wds15](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wds15/32/908_2.png) [@wds15](https://discourse.mc-stan.org/u/wds15)\
**Post date:** [June 3, 2020, 12:59pm UTC](https://discourse.mc-stan.org/t/map-rect-multithreading-in-rstan-catalina/15582/2 "2020-06-03T12:59:30Z")

</div>

It’s `+= -DSTAN_THREADS` … note the **-** here.

What is your error message.

(you can also use cmdstanr)

---

<div class="post-metadata">

**Author:** ![adamramey](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/adamramey/32/4419_2.png) [@adamramey](https://discourse.mc-stan.org/u/adamramey)\
**Post date:** [June 4, 2020, 5:26am UTC](https://discourse.mc-stan.org/t/map-rect-multithreading-in-rstan-catalina/15582/3 "2020-06-04T05:26:54Z")

</div>

Ah yes, I know. So if I add CXX14FLAGS += -DSTAN\_THREADS my compilations just crash with missing Eigen files and so on. If I instead add CXXFLAGS += -DSTAN\_THREADS (i.e. no 14), then the code will compile but will not run in parallel.

I wonder if this is a combination of R 4.0 and OS X Catalina here. Again, I can run the code fine in CMD Stan. But I prefer to use Rstan and this worked fine before the upgrades.
