python中更好的多处理和多线程
multiprocess的Python项目详细描述
关于多进程
multiprocess是multiprocessing的叉,作为pathos的一部分开发: https://github.com/uqfoundation/pathos
multiprocessing是python语言的一个包,它支持 使用标准库的api生成进程 threading模块。multiprocessing已在标准中分发 从Python2.6开始的库。
功能:
- Objects can be transferred between processes using pipes or multi-producer/multi-consumer queues.
- Objects can be shared between processes using a server process or (for simple data) shared memory.
- Equivalents of all the synchronization primitives in ^{tt5}$ are available.
- A ^{tt8}$ class makes it easy to submit tasks to a pool of worker processes.
multiprocess是用于异构计算的python框架pathos的一部分。 multiprocess正在进行活动开发,因此任何用户反馈、错误报告、评论, 或建议是高度赞赏的已知问题的列表维护在http://trac.mystic.cacr.caltech.edu/project/pathos/query.html,公共票证列表维护在https://github.com/uqfoundation/multiprocess/issues。
注意:构建包含的扩展模块需要一个C编译器。对于Python3.3及更高版本,建议使用C编译器,但不是必需的。
重大变化
- enhanced serialization, using ^{tt12}$
当前版本
本文档适用于multiprocess-0.70.8(一个multiprocessing-0.70a1叉)。
最新发布的multiprocess版本可从以下网址获得:
https://pypi.org/project/multiprocess
Multiprocessing在bsd许可下分发。
开发版本
您可以在以下位置获得最新的开发版本和所有闪亮的新功能:
https://github.com/uqfoundation
如果您有新的贡献,请提交一个拉请求
安装
multiprocess已打包以从源安装,因此必须 下载tarball,解压缩并运行安装程序:
[download] $ tar -xvzf multiprocess-0.70.8.tgz $ cd multiprocess-0.70.8 $ python setup.py build $ python setup.py install
将警告您任何丢失的依赖项和/或设置 在运行上面的“构建”步骤之后。
或者,multiprocess可以与pip或easy_install一起安装:
$ pip install multiprocess
注意:从源代码构建包含的扩展模块需要C编译器。对于Python3.3及更高版本,建议使用C编译器,但不是必需的。二进制安装不需要C编译器。
要求
multiprocess需要:
- ``python``, **version >= 2.5** or **version >= 3.1** - ``dill``, **version >= 0.3.0**
可选要求:
- ``setuptools``, **version >= 0.6**
更多信息
也许开始的最好方法是查看 http://multiprocess.rtfd.io。有关一组示例,请参见multiprocess.examples。 剧本。您还可以使用python -m multiprocess.tests运行测试套件。 请随时在github上提交一张机票,或在 stackoverflow(@mike mckerns)。如果你想分享你如何使用 multiprocess在您的工作中,请发送电子邮件 (到{STR 1 } $MMCKNS在UqForm DOTURG/<强>)。
引文
如果您使用multiprocess进行导致出版物出版的研究,我们要求您 通过在出版物中引用以下内容,确认使用了multiprocess:
M.M. McKerns, L. Strand, T. Sullivan, A. Fang, M.A.G. Aivazis, "Building a framework for predictive science", Proceedings of the 10th Python in Science Conference, 2011; http://arxiv.org/pdf/1202.1056 Michael McKerns and Michael Aivazis, "pathos: a framework for heterogeneous computing", 2010- ; http://trac.mystic.cacr.caltech.edu/project/pathos
请参阅http://trac.mystic.cacr.caltech.edu/project/pathos或 http://arxiv.org/pdf/1202.1056了解更多信息。