You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, charm.iwait assumes that the body of code that executes for each iteratively-received object does not suspend. If suspension does happen and the next object is received while the code executing within the body of the loop is suspended, the program will crash. This is illustrated in the following block of code:
fromcharm4pyimportChare, Channel, charm, Future, Group, coroclassA(Chare):
def__init__(self):
self.partnerProxy=self.thisProxy[notself.thisIndex]
self.channels= [Channel(self, self.partnerProxy),
Channel(self, self.partnerProxy)]
@corodefrun(self):
ifself.thisIndex==0:
my_ch=self.channels[0]
self.partner_fut=my_ch.recv()
my_ch.send(4)
self.channels[1].send(4)
self.partner_fut(4)
else:
my_fut=Future()
partner_ch=self.channels[0]
partner_ch.send(my_fut)
forchincharm.iwait(self.channels):
recvd=ch.recv()
# this greenlet pauses here and resumes here when# the second partner channel is ready to receiveresult=my_fut.get()
print(recvd, result)
defmain(args):
assertcharm.numPes() ==2chares=Group(A)
chares.run()
charm.start(main)
This code will crash with the following (truncated) error message:
result = my_fut.get()
File "/home/zane/charm4py/charm4py/threads.py", line 51, in get
return self.values[0]
Fatal error on PE 1> TypeError: '_Channel' object is not subscriptable
This error happens because the greenlet that suspends when my_fut.get() is called is awakened when the next channel in self.channels is ready to receive and is yielded by charm.iwait.
The text was updated successfully, but these errors were encountered:
Currently,
charm.iwait
assumes that the body of code that executes for each iteratively-received object does not suspend. If suspension does happen and the next object is received while the code executing within the body of the loop is suspended, the program will crash. This is illustrated in the following block of code:This code will crash with the following (truncated) error message:
This error happens because the greenlet that suspends when
my_fut.get()
is called is awakened when the next channel inself.channels
is ready to receive and is yielded bycharm.iwait
.The text was updated successfully, but these errors were encountered: