mpi4py:替换内置的序列化 [英] mpi4py: Replace built-in serialization

查看:181
本文介绍了mpi4py:替换内置的序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用莳萝代替MPI4PY内置的Pickle-串行化.根据 doc 类别_p_Pickle应该具有2个属性称为dumpsloads.但是,python表示当我尝试以下操作时没有此类属性

I'd like to replace MPI4PY's built-in Pickle-serialization with dill. According to the doc the class _p_Pickle should have 2 attributes called dumps and loads. However, python says there are no such attributes when i try the following

from mpi4py Import MPI
MPI._p_Pickle.dumps 

-> AttributeError:类型对象'mpi4py.MPI._p_Pickle'没有属性'dumps'

-> AttributeError: type object 'mpi4py.MPI._p_Pickle' has no attribute 'dumps'

dumpsloads哪里去了?

推荐答案

在v2.0中,您可以通过以下方式进行更改

In v2.0 you can change it via

MPI.pickle.dumps = dill.dumps
MPI.pickle.loads = dill.loads

文档似乎仍然是2012年的版本.

It seems that the documentation is still from 2012.

更新 对于v3.0,请参见此处,即:

Update For v3.0 see here, i.e.:

MPI.pickle.__init__(dill.dumps, dill.loads)

这篇关于mpi4py:替换内置的序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆