Skip to content

Commit eae8497

Browse files
committed
expedited tests
1 parent d813e1d commit eae8497

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/entry_methods/decorated.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from charm4py import charm, Chare, Array, expedited, Channel, EntryMethodOptions, coro
2+
3+
4+
class Test(Chare):
5+
"""
6+
A chare array to test the element proxy.
7+
"""
8+
9+
@coro
10+
def __init__(self):
11+
self.count = 0
12+
opts = EntryMethodOptions()
13+
opts.set_option(0x4)
14+
self.partner = Channel(self, self.thisProxy[(self.thisIndex[0] + 1) % 6], options=opts)
15+
self.partner.send(1)
16+
self.partner.recv()
17+
18+
@expedited
19+
def say(self, msg):
20+
"""
21+
Helper method which is called by invoking the element proxy.
22+
This method is expected to be called on only the chare for
23+
which the proxy is created.
24+
"""
25+
26+
self.count += 1
27+
print("Say", msg, "called on", self.thisIndex, "on PE", charm.myPe())
28+
if self.count == 2:
29+
assert self.thisIndex == (3,)
30+
exit()
31+
32+
def start(self):
33+
proxy = self.thisProxy[3]
34+
proxy.say("bye")
35+
proxy.say("bye")
36+
37+
38+
def main(args):
39+
arr_proxy = Array(Test, 6)
40+
arr_proxy[0].start()
41+
42+
43+
charm.start(main)

0 commit comments

Comments
 (0)