@@ -85,8 +85,6 @@ async def test_choose():
85
85
assert_type (result , int )
86
86
assert result2 == result3
87
87
88
- await proc .stop ()
89
-
90
88
91
89
@pytest .mark .timeout (60 )
92
90
async def test_stream ():
@@ -96,8 +94,6 @@ async def test_stream():
96
94
97
95
assert 8 == sum ([await x for x in v .value .stream ()])
98
96
99
- await proc .stop ()
100
-
101
97
102
98
class To (Actor ):
103
99
@endpoint
@@ -120,8 +116,6 @@ async def test_mesh_passed_to_mesh():
120
116
assert len (all ) == 4
121
117
assert all [0 ] != all [1 ]
122
118
123
- await proc .stop ()
124
-
125
119
126
120
@pytest .mark .timeout (60 )
127
121
async def test_mesh_passed_to_mesh_on_different_proc_mesh ():
@@ -133,9 +127,6 @@ async def test_mesh_passed_to_mesh_on_different_proc_mesh():
133
127
assert len (all ) == 4
134
128
assert all [0 ] != all [1 ]
135
129
136
- await proc .stop ()
137
- await proc2 .stop ()
138
-
139
130
140
131
@pytest .mark .timeout (60 )
141
132
async def test_actor_slicing ():
@@ -152,9 +143,6 @@ async def test_actor_slicing():
152
143
153
144
assert result [0 ] == result [1 ]
154
145
155
- await proc .stop ()
156
- await proc2 .stop ()
157
-
158
146
159
147
@pytest .mark .timeout (60 )
160
148
async def test_aggregate ():
@@ -165,8 +153,6 @@ async def test_aggregate():
165
153
r = await acc .accumulate ()
166
154
assert r == 4
167
155
168
- await proc .stop ()
169
-
170
156
171
157
class RunIt (Actor ):
172
158
@endpoint
@@ -184,8 +170,6 @@ async def test_rank_size():
184
170
assert 1 == await acc .accumulate (lambda : current_rank ()["gpus" ])
185
171
assert 4 == await acc .accumulate (lambda : current_size ()["gpus" ])
186
172
187
- await proc .stop ()
188
-
189
173
190
174
class SyncActor (Actor ):
191
175
@endpoint
@@ -201,51 +185,41 @@ async def test_sync_actor():
201
185
r = await a .sync_endpoint .choose (c )
202
186
assert r == 5
203
187
204
- await proc .stop ()
205
-
206
188
207
189
@pytest .mark .timeout (60 )
208
- async def test_sync_actor_sync_client () -> None :
190
+ def test_sync_actor_sync_client () -> None :
209
191
proc = local_proc_mesh (gpus = 2 )
210
192
a = proc .spawn ("actor" , SyncActor ).get ()
211
193
c = proc .spawn ("counter" , Counter , 5 ).get ()
212
194
r = a .sync_endpoint .choose (c ).get ()
213
195
assert r == 5
214
196
215
- await proc .stop ()
216
-
217
197
218
198
@pytest .mark .timeout (60 )
219
- async def test_proc_mesh_size () -> None :
199
+ def test_proc_mesh_size () -> None :
220
200
proc = local_proc_mesh (gpus = 2 )
221
201
assert 2 == proc .size ("gpus" )
222
- # proc.initialized.get()
223
- # await proc.stop()
224
202
225
203
226
204
@pytest .mark .timeout (60 )
227
- async def test_rank_size_sync () -> None :
205
+ def test_rank_size_sync () -> None :
228
206
proc = local_proc_mesh (gpus = 2 )
229
207
r = proc .spawn ("runit" , RunIt ).get ()
230
208
231
209
acc = Accumulator (r .run , 0 , operator .add )
232
210
assert 1 == acc .accumulate (lambda : current_rank ()["gpus" ]).get ()
233
211
assert 4 == acc .accumulate (lambda : current_size ()["gpus" ]).get ()
234
212
235
- await proc .stop ()
236
-
237
213
238
214
@pytest .mark .timeout (60 )
239
- async def test_accumulate_sync () -> None :
215
+ def test_accumulate_sync () -> None :
240
216
proc = local_proc_mesh (gpus = 2 )
241
217
counter = proc .spawn ("counter" , Counter , 1 ).get ()
242
218
counter .incr .broadcast ()
243
219
acc = Accumulator (counter .value , 0 , operator .add )
244
220
r = acc .accumulate ().get ()
245
221
assert r == 4
246
222
247
- await proc .stop ()
248
-
249
223
250
224
class CastToCounter (Actor ):
251
225
@endpoint
@@ -254,7 +228,7 @@ def doit(self, c: Counter):
254
228
255
229
256
230
@pytest .mark .timeout (60 )
257
- async def test_value_mesh () -> None :
231
+ def test_value_mesh () -> None :
258
232
proc = local_proc_mesh (gpus = 2 )
259
233
counter = proc .spawn ("counter" , Counter , 0 ).get ()
260
234
counter .slice (hosts = 0 , gpus = 1 ).incr .broadcast ()
@@ -265,8 +239,6 @@ async def test_value_mesh() -> None:
265
239
n = proc .spawn ("ctc" , CastToCounter ).get ()
266
240
assert list (x ) == n .slice (gpus = 0 ).doit .call_one (counter ).get ()
267
241
268
- await proc .stop ()
269
-
270
242
271
243
@pytest .mark .timeout (60 )
272
244
def test_rust_binding_modules_correct () -> None :
@@ -333,8 +305,6 @@ async def test_actor_tls() -> None:
333
305
assert 4 == await am .get .call_one ()
334
306
assert 4 == await am .get_async .call_one ()
335
307
336
- await pm .stop ()
337
-
338
308
339
309
class TLSActorFullSync (Actor ):
340
310
"""An actor that manages thread-local state."""
@@ -364,8 +334,6 @@ async def test_actor_tls_full_sync() -> None:
364
334
365
335
assert 4 == await am .get .call_one ()
366
336
367
- await pm .stop ()
368
-
369
337
370
338
class AsyncActor (Actor ):
371
339
def __init__ (self ):
@@ -392,8 +360,6 @@ async def test_async_concurrency():
392
360
await am .no_more .call ()
393
361
await fut
394
362
395
- await pm .stop ()
396
-
397
363
398
364
async def awaitit (f ):
399
365
return await f
@@ -755,7 +721,7 @@ async def send(self, port: Port[int]):
755
721
756
722
757
723
@pytest .mark .timeout (60 )
758
- async def test_port_as_argument () -> None :
724
+ def test_port_as_argument () -> None :
759
725
proc_mesh = local_proc_mesh (gpus = 1 )
760
726
s = proc_mesh .spawn ("send_alot" , SendAlot ).get ()
761
727
send , recv = Channel [int ].open ()
@@ -765,8 +731,6 @@ async def test_port_as_argument() -> None:
765
731
for i in range (100 ):
766
732
assert i == recv .recv ().get ()
767
733
768
- await proc_mesh .stop ()
769
-
770
734
771
735
@pytest .mark .timeout (15 )
772
736
async def test_same_actor_twice () -> None :
@@ -783,8 +747,6 @@ async def test_same_actor_twice() -> None:
783
747
"gspawn failed: an actor with name 'dup' has already been spawned" in error_msg
784
748
), f"Expected error message about duplicate actor name, got: { error_msg } "
785
749
786
- await pm .stop ()
787
-
788
750
789
751
class TestActorMeshStop (unittest .IsolatedAsyncioTestCase ):
790
752
async def test_actor_mesh_stop (self ) -> None :
@@ -811,13 +773,11 @@ def add(self, port: "Port[int]", b: int) -> None:
811
773
812
774
813
775
@pytest .mark .timeout (60 )
814
- async def test_ported_actor ():
776
+ def test_ported_actor ():
815
777
proc_mesh = local_proc_mesh (gpus = 1 ).get ()
816
778
a = proc_mesh .spawn ("port_actor" , PortedActor ).get ()
817
779
assert 5 == a .add .call_one (2 ).get ()
818
780
819
- await proc_mesh .stop ()
820
-
821
781
822
782
async def _recv ():
823
783
return (7 , 2 , 3 )
0 commit comments