# CmdStanPy cpp\_options for multi-threading

**URL:** <https://discourse.mc-stan.org/t/cmdstanpy-cpp-options-for-multi-threading/14759>\
**Category:** Other\
**Tags:** cmdstan, pystan, cmdstanpy\
**Created:** [May 1, 2020, 6:49pm UTC](https://discourse.mc-stan.org/t/cmdstanpy-cpp-options-for-multi-threading/14759 "2020-05-01T18:49:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stantheman](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stantheman](https://discourse.mc-stan.org/u/stantheman)\
**Post date:** [May 1, 2020, 6:49pm UTC](https://discourse.mc-stan.org/t/cmdstanpy-cpp-options-for-multi-threading/14759/1 "2020-05-01T18:49:28Z")

</div>

I’m trying to use the latest version of CmdStanPy to run sampling on my stan model which uses map\_rect. However, it looks like CmdStanPy’s CmdStanModel cpp\_options doesn’t allow specifying compiler options like ‘-pthread’ and ‘-DSTAN\_THREADS’, which is necessary to enable multi-threading. How can I deal with this? I am new to stan and particularly cmdstan and cmdstanpy, so any help is much appreciated!

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [May 2, 2020, 10:56am UTC](https://discourse.mc-stan.org/t/cmdstanpy-cpp-options-for-multi-threading/14759/2 "2020-05-02T10:56:06Z")

</div>

You can define compiler flags the same way you would define them for CmdStan.

See instructions (download pdf)

> **[stan-dev/cmdstan](https://github.com/stan-dev/cmdstan/releases)**
>
> CmdStan, the command line interface to Stan. Contribute to stan-dev/cmdstan development by creating an account on GitHub.

  
[https://github.com/stan-dev/cmdstan/releases/download/v2.23.0/cmdstan-guide-2.23.pdf](https://github.com/stan-dev/cmdstan/releases/download/v2.23.0/cmdstan-guide-2.23.pdf)
