# Possible deadlock? Training example gets stuck

**URL:** <https://discuss.pytorch.org/t/possible-deadlock-training-example-gets-stuck/94221>\
**Category:** vision\
**Created:** [August 26, 2020, 9:25pm UTC](https://discuss.pytorch.org/t/possible-deadlock-training-example-gets-stuck/94221 "2020-08-26T21:25:16Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [August 31, 2020, 1:52am UTC](https://discuss.pytorch.org/t/possible-deadlock-training-example-gets-stuck/94221/5 "2020-08-31T01:52:38Z")

</div>

1. You should see the best performance using an optimal number of workers. Increasing the number of workers beyond the number of cores might yield bad performance as explained [here](https://discuss.pytorch.org/t/how-to-prefetch-data-when-processing-with-gpu/548/19).

2. `torch.set_num_threads` should set the number of threads for intraop parallelism on the CPU, so for MKL and OpenMP etc., if I’m not mistaken.

3. Yes, I think loading from disc with too many processes might reduce the performance significantly e.g. due to threshing. I don’t know, if this could explain your hang, but I would try to reduce the number of workers etc. to “common” values.

---

_[View the full topic](https://discuss.pytorch.org/t/possible-deadlock-training-example-gets-stuck/94221)._
