# Cmdstan 2.18 MPI

**URL:** <https://discourse.mc-stan.org/t/cmdstan-2-18-mpi/5277>\
**Category:** Modeling\
**Created:** [August 18, 2018, 11:59pm UTC](https://discourse.mc-stan.org/t/cmdstan-2-18-mpi/5277 "2018-08-18T23:59:56Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![linas](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/linas/32/5342_2.png) [@linas](https://discourse.mc-stan.org/u/linas)\
**Post date:** [August 22, 2018, 12:43pm UTC](https://discourse.mc-stan.org/t/cmdstan-2-18-mpi/5277/8 "2018-08-22T12:43:50Z")

</div>

Thanks for the suggestions.

I still have some questions.

1. Is the right way to compile cmd stan with CXXFLAGS += -DSTAN\_THREADS -pthread in make/local?

Probably I didn’t hit the right manual because most of my knowledge is based on [Linear, parallell regression](http://discourse.mc-stan.org/t/linear-parallell-regression/5230) thread.

I compiled cmdstan with CXXFLAGS += -DSTAN\_THREADS -pthread in make/local as was suggested in the thread.

Yes, I used map\_rect and it works. I was able to run 10, 15, and 20 shards and actually checked with htop that corresponding # of threads are running. I didn’t use mpirun though. The command line I was using was:  
export STAN\_NUM\_THREADS=15  
time ./NNsigma.2.18.mpi sample …

However, when I tried 100 shards I found that only first node is active. All others were idle.

Obviously I tried mpirun with 20 shards. Here the output about the progress was repeated 20 times.

---

_[View the full topic](https://discourse.mc-stan.org/t/cmdstan-2-18-mpi/5277)._
