mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Add workspace.RunPlanInBackground (#9637)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/9637 Adding a method to run plan in background. The intended use is to run BlueWhale's data reading & preprocessing net in background while the GPU is training. Reviewed By: MisterTea Differential Revision: D8906439 fbshipit-source-id: b1c73ca7327e2d87a8f873924e05ab3d161a3f1e
This commit is contained in:
committed by
Facebook Github Bot
parent
1003ccfa15
commit
01581037dc
@ -83,6 +83,15 @@ class TestWorkspace(unittest.TestCase):
|
||||
workspace.RunPlan(plan.Proto().SerializeToString()), True)
|
||||
self.assertEqual(workspace.HasBlob("testblob"), True)
|
||||
|
||||
def testRunPlanInBackground(self):
|
||||
plan = core.Plan("test-plan")
|
||||
plan.AddStep(core.ExecutionStep("test-step", self.net))
|
||||
background_plan = workspace.RunPlanInBackground(plan)
|
||||
while not background_plan.is_done():
|
||||
pass
|
||||
self.assertEqual(background_plan.is_succeeded(), True)
|
||||
self.assertEqual(workspace.HasBlob("testblob"), True)
|
||||
|
||||
def testConstructPlanFromSteps(self):
|
||||
step = core.ExecutionStep("test-step-as-plan", self.net)
|
||||
self.assertEqual(workspace.RunPlan(step), True)
|
||||
|
Reference in New Issue
Block a user