# Within-chain parallelisation on M1 Mac for CmdStanr

**URL:** <https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375>\
**Category:** Developers\
**Tags:** cmdstanr\
**Created:** [February 16, 2022, 10:58am UTC](https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375 "2022-02-16T10:58:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shannonajw](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@shannonajw](https://discourse.mc-stan.org/u/shannonajw)\
**Post date:** [February 16, 2022, 10:58am UTC](https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375/1 "2022-02-16T10:58:49Z")

</div>

Hi, I am wondering if Stan currently (or will in future) supports within-chain parallelisation for arm64 Macs? I am trying to run an example model (from [dschrage / rcovreg · GitLab](https://gitlab.com/dschrage/rcovreg)) and constantly get thrown this error:

dyld[25746]: Library not loaded: @rpath/libtbb.dylib  
Reason: tried: ‘~/.cmdstanr/cmdstan-2.28.2/stan/lib/stan\_math/lib/tbb/libtbb.dylib’ (mach-o file, but is an incompatible architecture (have ‘arm64’, need ‘x86\_64’)),

The error goes away after removing “cpp\_options = list(stan\_threads = TRUE)” from the model.

R version 4.1.2 (2021-11-01)  
Platform: aarch64-apple-darwin20 (64-bit)  
Running under: macOS Monterey 12.2

---

<div class="post-metadata">

**Author:** ![rok\_cesnovar](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rok\_cesnovar](https://discourse.mc-stan.org/u/rok_cesnovar)\
**Post date:** [February 16, 2022, 11:40am UTC](https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375/2 "2022-02-16T11:40:19Z")

</div>

> [@shannonajw](#):
>
> need ‘x86\_64’)

This part seems to suggest that this is installation is a bit weird. As it is looking for x86, which is the non-Mac version.

Within-chain parallelization should work on M1 Mac with CmdStanR, there are quite a few reports of it working pretty well actually.

---

<div class="post-metadata">

**Author:** ![shannonajw](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@shannonajw](https://discourse.mc-stan.org/u/shannonajw)\
**Post date:** [February 16, 2022, 11:57am UTC](https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375/3 "2022-02-16T11:57:43Z")

</div>

Thanks! Any idea how to resolve this? I’ve rebuilt CmdStan and reinstalled but to no avail. Seems like the issue is with the tbb library.

---

<div class="post-metadata">

**Author:** ![shannonajw](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@shannonajw](https://discourse.mc-stan.org/u/shannonajw)\
**Post date:** [February 16, 2022, 12:09pm UTC](https://discourse.mc-stan.org/t/within-chain-parallelisation-on-m1-mac-for-cmdstanr/26375/4 "2022-02-16T12:09:46Z")

</div>

Update: Apologies, managed to run within-chain parallelisation with the brms example ([Running brms models with within-chain parallelization](https://cran.r-project.org/web/packages/brms/vignettes/brms_threading.html)). Issue could have been with the way the example from before was coded.
