Python pool map and choosing number of processes

守給你的承諾、 提交于 2019-12-10 19:38:21

问题


In setting the number of processes, I'd be keen to see how many threads I can actually use on my machine - how do I find this? Is there a way to determine the number of threads available to me?


回答1:


Do you want to know the CPU count?

According to the docs, when you start a pool and don't sepecify the number of processes, the default number is the number of cpu's on the system:

processes is the number of worker processes to use. If processes is None then the number returned by cpu_count() is used. If initializer is not None then each worker process will call initializer(*initargs) when it starts.



来源:https://stackoverflow.com/questions/25058006/python-pool-map-and-choosing-number-of-processes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!