@@ -227,13 +227,21 @@ def postprocess_outputs(self, golden_out, result):
227227
228228
229229def run_test (module_tester , dynamic , device ):
230+ import multiprocessing
231+
230232 tempdir = tempfile .TemporaryDirectory (
231233 prefix = module_tester .tmp_prefix , dir = "./shark_tmp/"
232234 )
233235 module_tester .temp_dir = tempdir .name
234236
235237 with ireec .tools .TempFileSaver (tempdir .name ):
236- module_tester .create_and_check_module (dynamic , device )
238+ p = multiprocessing .Process (
239+ target = module_tester .create_and_check_module ,
240+ args = (dynamic , device ),
241+ )
242+ p .start ()
243+ p .join ()
244+ return p
237245
238246
239247class SharkModuleTest (unittest .TestCase ):
@@ -339,10 +347,7 @@ def test_module(self, dynamic, device, config):
339347 pytest .xfail (
340348 reason = "Numerics Issues: https://github.com/nod-ai/SHARK/issues/388"
341349 )
342- if config ["model_name" ] == "mobilenet_v3_small" and device in [
343- "metal" ,
344- "vulkan" ,
345- ]:
350+ if config ["model_name" ] == "mobilenet_v3_small" :
346351 pytest .xfail (
347352 reason = "Numerics Issues: https://github.com/nod-ai/SHARK/issues/388"
348353 )
@@ -417,9 +422,5 @@ def test_module(self, dynamic, device, config):
417422 # We must create a new process each time we benchmark a model to allow
418423 # for Tensorflow to release GPU resources. Using the same process to
419424 # benchmark multiple models leads to OOM.
420- p = multiprocessing .Process (
421- target = run_test , args = (self .module_tester , dynamic , device )
422- )
423- p .start ()
424- p .join ()
425- assert not p .exitcode
425+
426+ run_test (self .module_tester , dynamic , device )
0 commit comments