forked from manmeet3591/python_class
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathration_test.py
More file actions
executable file
·44 lines (32 loc) · 832 Bytes
/
ration_test.py
File metadata and controls
executable file
·44 lines (32 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python2
import sys
try:
from asaptools import simplecomm
except:
print 'asaptools not loaded. exiting...'
sys.exit(1)
try:
scomm = simplecomm.create_comm(serial=False)
except:
print 'unable to create scomm. exiting...'
sys.exit(1)
rank = scomm.get_rank()
size = scomm.get_size()
if scomm.is_manager():
l = range(10)
for i in l:
scomm.ration(i)
print '{0}/{1}: Sent {2!r}'.format(rank, size, i)
for i in range(scomm.get_size()-1):
scomm.ration(None)
print '{0}/{1}: Sent None'.format(rank, size)
else:
i = -1
while i is not None:
i = scomm.ration()
print '{0}/{1}: Recvd {2!r}'.format(rank, size, i)
print '{0}/{1}: Out of loop'.format(rank, size)
scomm.sync()
if scomm.is_manager():
print 'Done.'
sys.exit(0)