[英]How to make sure each process uses roughly same amount of time when using multiprocessing module in Python?
Currently I am working on an asynchronous gradient algorithm with Python multiprocessing module, the main idea is that I run multiple processes that update an array of global parameters asynchronously. 目前,我正在使用Python多处理模块开发异步梯度算法,其主要思想是运行多个进程以异步方式更新全局参数数组。 I have finished most of the framework but I got a problem that some processes seems to "get stuck" sometimes while other are still running, that causes this algorithm less effective. 我已经完成了大部分框架,但遇到一个问题,即某些进程似乎在某些进程“卡住”而其他进程仍在运行时,则导致该算法的效果降低。 So I am wondering if there are good ways to make sure that they use roughly the same amount of time? 所以我想知道是否有好的方法来确保它们使用大致相同的时间?
Thanks! 谢谢!
This depends almost entirely on the problem you try to tackle. 这几乎完全取决于您要解决的问题。 If you distribute a large task to several workers and one unpredictably gets a much larger chunk than the others, you will have this situation. 如果您将一项大型任务分配给多个工作人员,而一个任务却比其他任务大得多,那么您将遇到这种情况。
There are several options to avoid it: 有几种选择可以避免这种情况:
A real deadlock will not be fixed of course by whatever approach. 真正的僵局当然不会通过任何方法解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.