# Parallel analysis

**URL:** <https://discourse.pymc.io/t/parallel-analysis/1981>\
**Category:** Questions\
**Created:** [September 26, 2018, 6:41pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981 "2018-09-26T18:41:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 26, 2018, 6:41pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/1 "2018-09-26T18:41:21Z")

</div>

I am using PyMC3 for a long time. But I have never been successful to run a model with **njobs** more than 1. I was thinking there is a problem maybe with my computing system. But then I installed pymc in several other computers and I was not successful. I convinced I probably miss something. It is not only as easy to changing **njobs** in “sample” command.  
Please advice me in this regard. What is wrong? maybe because I use **windows**?~Thanks!

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [September 26, 2018, 6:50pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/2 "2018-09-26T18:50:33Z")

</div>

What kind of error you usually see? Sometimes it is memory problem, is it work with a small toy model?

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 26, 2018, 7:04pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/3 "2018-09-26T19:04:10Z")

</div>

It never worked for any of my models in several different systems (all with windows 10). I am going to make a simple model now, and I will run it and I will update here.

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 26, 2018, 7:39pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/4 "2018-09-26T19:39:19Z")

</div>

So this is the simple code:

```
#%%
import numpy as np;
import matplotlib.pyplot as plt;
import pymc3 as pm;
#%%
observed_data=np.random.normal(3,1,20)
basic_model = pm.Model()
with basic_model:
    # Priors for unknown model parameters
    a = pm.Normal('a', 5, 5)
    s=pm.HalfNormal('sigma_lik',sd=5)
    Y_obs = pm.Normal('Y_obs', mu=a, sd=s, observed=observed_data)
    trace=pm.sample( 10000, tune= 2000, njobs=1)
pm.traceplot(trace)

```

For njobs=1 it is what I get:  
C:\ProgramData\Anaconda3\lib\site-packages\h5py\__init_\_.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.  
from ._conv import register\_converters as register\_converters  
Auto-assigning NUTS sampler…  
Initializing NUTS using jitter+adapt\_diag…  
Sequential sampling (2 chains in 1 job)  
NUTS: [sigma\_lik\_log_, a]  
100%|██████████| 12000/12000 [00:18\<00:00, 660.53it/s]  
100%|██████████| 12000/12000 [00:10\<00:00, 1112.94it/s]  
The model with njobs=1 was fast and done in few seconds. With njobs=2 it is still running and chain apparently does not even start. I provide you the screenshot.

 ![njob1](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/d/db8ad638388f3946d34b8cf5b4773244539ef095.png) ![spyderimage](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/7/7cd0a05976632d547a4a8784584a5cefb4ee834c.png)

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [September 26, 2018, 7:50pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/5 "2018-09-26T19:50:34Z")

</div>

Hmm, I recalled that someone also reported a similar error under Spyder, did you try to run it in a notebook or from a Terminal?

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 26, 2018, 8:47pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/6 "2018-09-26T20:47:04Z")

</div>

I did not. I will and keep you updated. I am not in front of the computer now.

Thanks!

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 27, 2018, 5:44pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/7 "2018-09-27T17:44:15Z")

</div>

I ran the code in a terminal and I got error, I should say that I did not do any ctrl+c  
Here are the results:

 ![p1](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/d/d742816e38aea5790b8f20037576e6878159f599.png) ![p2](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/6/6d03e09ce8b0557fc18f0b408050a900889619b8.png)

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [September 27, 2018, 7:15pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/8 "2018-09-27T19:15:12Z")

</div>

hmm quite likely it is a Windows problem… What kind of C++ library you are using? How do you install pymc3? Is it with anaconda?

---

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [September 27, 2018, 8:38pm UTC](https://discourse.pymc.io/t/parallel-analysis/1981/9 "2018-09-27T20:38:10Z")

</div>

Yes, I used anaconda to install everything possible including pymc3. About C++ I am not a user for C++, but I guess I should use following command on command prompt to see the version and it is what I got:

 ![cpp](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/5/5330daf7b332c2359641d146f4b522d49d9dede0.png)
