Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add Mutex Python bindings
[simgrid.git] / examples / python / synchro-mutex / synchro-mutex.tesh
1 #!/usr/bin/env tesh
2
3 p Testing Mutex
4
5 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 0 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
6 >[  0.000000] (1:master@Tremblay) The final result is: 0
7
8 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 1 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
9 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
10 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
11 >[  1.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
12 >[  1.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
13 >[  1.000000] (2:worker-0(mgr)@Jupiter) Bye now!
14 >[  1.000000] (1:master@Tremblay) The final result is: 1
15
16 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 1 --trials-before-success 5 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
17 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
18 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
19 >[  1.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
20 >[  1.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
21 >[  1.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
22 >[  2.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
23 >[  2.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
24 >[  2.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
25 >[  3.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
26 >[  3.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
27 >[  3.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
28 >[  4.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
29 >[  4.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
30 >[  4.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
31 >[  5.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
32 >[  5.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
33 >[  5.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
34 >[  6.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
35 >[  6.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
36 >[  6.000000] (2:worker-0(mgr)@Jupiter) Bye now!
37 >[  6.000000] (1:master@Tremblay) The final result is: 1
38
39 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 5 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
40 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
41 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
42 >[  0.000000] (3:worker-1@Tremblay) I just started
43 >[  0.000000] (4:worker-2(mgr)@Jupiter) I just started
44 >[  0.000000] (5:worker-3@Tremblay) I just started
45 >[  0.000000] (6:worker-4(mgr)@Jupiter) I just started
46 >[  1.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
47 >[  1.000000] (3:worker-1@Tremblay) acquired the mutex manually
48 >[  1.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
49 >[  1.000000] (2:worker-0(mgr)@Jupiter) Bye now!
50 >[  2.000000] (3:worker-1@Tremblay) updated shared result, which is now 2
51 >[  2.000000] (3:worker-1@Tremblay) released the mutex manually
52 >[  2.000000] (4:worker-2(mgr)@Jupiter) acquired the mutex with context manager
53 >[  2.000000] (3:worker-1@Tremblay) Bye now!
54 >[  3.000000] (4:worker-2(mgr)@Jupiter) updated shared result, which is now 3
55 >[  3.000000] (5:worker-3@Tremblay) acquired the mutex manually
56 >[  3.000000] (4:worker-2(mgr)@Jupiter) released the mutex after leaving the context manager
57 >[  3.000000] (4:worker-2(mgr)@Jupiter) Bye now!
58 >[  4.000000] (5:worker-3@Tremblay) updated shared result, which is now 4
59 >[  4.000000] (5:worker-3@Tremblay) released the mutex manually
60 >[  4.000000] (6:worker-4(mgr)@Jupiter) acquired the mutex with context manager
61 >[  4.000000] (5:worker-3@Tremblay) Bye now!
62 >[  5.000000] (6:worker-4(mgr)@Jupiter) updated shared result, which is now 5
63 >[  5.000000] (6:worker-4(mgr)@Jupiter) released the mutex after leaving the context manager
64 >[  5.000000] (6:worker-4(mgr)@Jupiter) Bye now!
65 >[  5.000000] (1:master@Tremblay) The final result is: 5
66
67 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 3 --trials-before-success 2 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
68 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
69 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
70 >[  0.000000] (3:worker-1@Tremblay) I just started
71 >[  0.000000] (4:worker-2(mgr)@Jupiter) I just started
72 >[  1.000000] (3:worker-1@Tremblay) acquired the mutex manually
73 >[  1.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
74 >[  1.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
75 >[  2.000000] (3:worker-1@Tremblay) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
76 >[  2.000000] (3:worker-1@Tremblay) released the mutex manually
77 >[  2.000000] (4:worker-2(mgr)@Jupiter) acquired the mutex with context manager
78 >[  3.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
79 >[  3.000000] (4:worker-2(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
80 >[  3.000000] (4:worker-2(mgr)@Jupiter) released the mutex after leaving the context manager
81 >[  4.000000] (3:worker-1@Tremblay) acquired the mutex manually
82 >[  4.000000] (2:worker-0(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
83 >[  4.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
84 >[  5.000000] (3:worker-1@Tremblay) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
85 >[  5.000000] (3:worker-1@Tremblay) released the mutex manually
86 >[  5.000000] (4:worker-2(mgr)@Jupiter) acquired the mutex with context manager
87 >[  6.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
88 >[  6.000000] (4:worker-2(mgr)@Jupiter) ran in trouble while calculating: did not manage to find the correct answer. Will retry shortly.
89 >[  6.000000] (4:worker-2(mgr)@Jupiter) released the mutex after leaving the context manager
90 >[  7.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
91 >[  7.000000] (3:worker-1@Tremblay) acquired the mutex manually
92 >[  7.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
93 >[  7.000000] (2:worker-0(mgr)@Jupiter) Bye now!
94 >[  8.000000] (3:worker-1@Tremblay) updated shared result, which is now 2
95 >[  8.000000] (3:worker-1@Tremblay) released the mutex manually
96 >[  8.000000] (4:worker-2(mgr)@Jupiter) acquired the mutex with context manager
97 >[  8.000000] (3:worker-1@Tremblay) Bye now!
98 >[  9.000000] (4:worker-2(mgr)@Jupiter) updated shared result, which is now 3
99 >[  9.000000] (4:worker-2(mgr)@Jupiter) released the mutex after leaving the context manager
100 >[  9.000000] (4:worker-2(mgr)@Jupiter) Bye now!
101 >[  9.000000] (1:master@Tremblay) The final result is: 3