我正在尝试检查mpi4py
如何在进程间传递对象。鉴于以下计划:
from mpi4py import MPI
import numpy as np
import sys
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
class ROOT(object):
def __init__(self):
self.x = 10
def func(self, rank):
print("Rank=%d is able to calculate the result: %d " % (rank, np.power(self.x, 2)))
obj= None
if rank == 0:
obj = ROOT()
comm.send(obj, dest=2)
if rank == 2:
comm.recv(obj, source=0)
obj.func(rank)
不幸的是,我收到了这个错误:
Traceback (most recent call last):
File "test.py", line 47, in <module>
obj.func(rank)
AttributeError: 'NoneType' object has no attribute 'func'
--------------------------------------------------------------------------
mpirun noticed that the job aborted, but has no info as to the process
that caused that situation.
--------------------------------------------------------------------------
排名2应该能够让obj.func
打印出来,但有些错误!有人可以解释如何解决这个问题吗?感谢
答案 0 :(得分:0)
没错,只需更换
$('#ButtonCreationDemoButton').click(function(e) {
$('#ButtonCreationDemoInput').AnyTime_noPicker().AnyTime_picker().focus();
e.preventDefault();
});
使用
<link href="https://www.ama3.com/anytime/anytime.5.2.0.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://www.ama3.com/anytime/anytime.5.2.0.js"></script>
<input type="text" id="ButtonCreationDemoInput"/>
<button id="ButtonCreationDemoButton">
<img src="calendar.png" alt="[calendar icon]"/>
</button>
comm.recv不会就地修改obj。