diff --git a/src/parallel/app.py b/src/parallel/app.py index 28a8e4d..391ca97 100644 --- a/src/parallel/app.py +++ b/src/parallel/app.py @@ -107,7 +107,7 @@ def post_network(): request.files["file"].save(training.delta) training.patch() - + training.computed_images += clients[token].performance # Préparation de la réponse data = {} data["status"] = "ok" @@ -132,7 +132,7 @@ def post_network(): data["nb_elem"] = 0 data["start"] = 0 data["instruction"] = "sleep" - data["sleep_time"] = 0.2 + data["sleep_time"] = 0.02 return data diff --git a/src/parallel/structures.py b/src/parallel/structures.py index 33cc2fd..1e186b1 100644 --- a/src/parallel/structures.py +++ b/src/parallel/structures.py @@ -32,7 +32,7 @@ class Client: """ Donne un travail au client """ - if training.nb_images == training.cur_image: + if training.nb_images <= training.computed_images: if training.batchs == training.cur_batch: raise NoMoreJobAvailableError raise TryLaterError @@ -54,6 +54,8 @@ class Training: self.batchs = batchs self.cur_batch = 1 self.cur_image = 0 + self.computed_images = 0 + self.lock_test = False self.dataset = dataset self.test_set = test_set self.cache = cache @@ -89,6 +91,10 @@ class Training: """ Teste les performances du réseau avant le batch suivant """ + if self.lock_test: + return + + self.lock_test = True if not os.path.isfile("out/main"): subprocess.call(["./make.sh", "build", "main"]) @@ -101,9 +107,13 @@ class Training: ]) self.cur_batch += 1 self.cur_image = 0 + self.computed_images = 0 if self.cur_batch >= self.batchs: print("Done.") os._exit(0) + + self.lock_test = False + return def patch(self):