From 219d000ec16ef9b8bf389483a3a3ada250a362b5 Mon Sep 17 00:00:00 2001 From: Moritz Gunz Date: Wed, 30 Aug 2023 14:20:00 +0200 Subject: [PATCH] Fix number of CPUs for AdvancedTreeSearch (#448) Specifying `cpu=2` lead the job to still only consume 100% (un-normalized, so only one core) of CPU, because `OMP_NUM_THREADS=1`. Removing the division by two leads the job to consume the desired 200%, i.e. 2 cores. --- recognition/advanced_tree_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recognition/advanced_tree_search.py b/recognition/advanced_tree_search.py index 3996d854..0e91f89c 100644 --- a/recognition/advanced_tree_search.py +++ b/recognition/advanced_tree_search.py @@ -239,7 +239,7 @@ def create_files(self): self.feature_flow.write_to_file("feature.flow") util.write_paths_to_file(self.out_lattice_bundle, self.out_single_lattice_caches.values()) extra_code = "export OMP_NUM_THREADS={0}\nexport TF_DEVICE='{1}'".format( - math.ceil(self.cpu / 2), "gpu" if self.use_gpu else "cpu" + math.ceil(self.cpu), "gpu" if self.use_gpu else "cpu" ) self.write_run_script(self.exe, "recognition.config", extra_code=extra_code)