# Number of cores settings in sampling

**URL:** <https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941>\
**Category:** Questions\
**Created:** [August 25, 2021, 10:15am UTC](https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941 "2021-08-25T10:15:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GMCobraz\_T](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/gmcobraz_t/32/4165_2.png) [@GMCobraz\_T](https://discourse.pymc.io/u/GMCobraz_T)\
**Post date:** [August 25, 2021, 10:15am UTC](https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941/1 "2021-08-25T10:15:23Z")

</div>

Dear all,

Good day.  
I find some strange behavior during sampling.  
whether we set core=1 or cores = 4, I found out that the the program still use the maximum number of cores available in the computer.

Did someone notice this or can pymc developer please help answer my enquiry?

Thank you very much

---

<div class="post-metadata">

**Author:** ![GMCobraz\_T](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/gmcobraz_t/32/4165_2.png) [@GMCobraz\_T](https://discourse.pymc.io/u/GMCobraz_T)\
**Post date:** [October 29, 2021, 3:26pm UTC](https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941/2 "2021-10-29T15:26:10Z")

</div>

Dear PyMC Developers @junpenglao  
Good day.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pymc3/original/2X/9/92bef192ea3f7f8c97d6b3fd9ac521e2be135b1c.png)  
May I know why the system use all cores even I set the number of cores = 1?  
May I know the proper way to set up or constraint the number of cores?

Thank you very much[quote=“GMCobraz\_T, post:1, topic:7941, full:true”]  
Dear all,

Good day.  
I find some strange behavior during sampling.  
whether we set core=1 or cores = 4, I found out that the the program still use the maximum number of cores available in the computer.

Did someone notice this or can pymc developer please help answer my enquiry?

Thank you very much.

---

<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:** [October 30, 2021, 6:23am UTC](https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941/3 "2021-10-30T06:23:33Z")

</div>

I think most of what @aseyboldt said here should still apply: [NUTS uses all cores - #10 by aseyboldt](https://discourse.pymc.io/t/nuts-uses-all-cores/909/10)  
Could you try the solution listed there?

---

<div class="post-metadata">

**Author:** ![GMCobraz\_T](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/gmcobraz_t/32/4165_2.png) [@GMCobraz\_T](https://discourse.pymc.io/u/GMCobraz_T)\
**Post date:** [October 30, 2021, 4:12pm UTC](https://discourse.pymc.io/t/number-of-cores-settings-in-sampling/7941/4 "2021-10-30T16:12:58Z")

</div>

Hi @junpenglao ,

The solution still applies.  
After I adjust the OMP\_NUM\_THREADS, it solve my problem.  
[https://theano-pymc.readthedocs.io/en/latest/tutorial/multi\_cores.html](https://theano-pymc.readthedocs.io/en/latest/tutorial/multi_cores.html)

Thanks alot.
