# Pm.sample gets stuck after init with cores \> 1

**URL:** <https://discourse.pymc.io/t/pm-sample-gets-stuck-after-init-with-cores-1/5017>\
**Category:** Questions\
**Created:** [May 5, 2020, 3:04pm UTC](https://discourse.pymc.io/t/pm-sample-gets-stuck-after-init-with-cores-1/5017 "2020-05-05T15:04:58Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![lucianopaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/lucianopaz/32/2186_2.png) [@lucianopaz](https://discourse.pymc.io/u/lucianopaz)\
**Post date:** [May 6, 2020, 12:34pm UTC](https://discourse.pymc.io/t/pm-sample-gets-stuck-after-init-with-cores-1/5017/16 "2020-05-06T12:34:07Z")

</div>

Almost what you said. When I did this, I was running on an sge managed cluster, so I submitted a job array where a called my python script and passed the job’s id as a command line argument: `python my_script.py $job_id`  
Then, in my python script I grabbed the job id from `sys.argv`and used that to set the `random_seed` I passed to `pm.sample`. This approach will deploy as many independent processes as chains, and they will run in parallel, managed by the cluster’s manager or by your computers operating system.  
You would also have to write a separate script for post processing, where you merge the multiple chains together and use them for whatever it is you actually want.

---

_[View the full topic](https://discourse.pymc.io/t/pm-sample-gets-stuck-after-init-with-cores-1/5017)._
