From 053c86723c8b017d4605bf57acd247488285b972 Mon Sep 17 00:00:00 2001 From: Xinghai Sun Date: Tue, 8 Aug 2017 12:15:18 +0800 Subject: [PATCH] Reset default multi-thread/process number to half of cpu count() for speedup. --- deep_speech_2/data_utils/data.py | 2 +- deep_speech_2/evaluate.py | 4 ++-- deep_speech_2/infer.py | 2 +- deep_speech_2/train.py | 2 +- deep_speech_2/tune.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deep_speech_2/data_utils/data.py b/deep_speech_2/data_utils/data.py index fe064b80..34f32019 100644 --- a/deep_speech_2/data_utils/data.py +++ b/deep_speech_2/data_utils/data.py @@ -65,7 +65,7 @@ class DataGenerator(object): max_freq=None, specgram_type='linear', use_dB_normalization=True, - num_threads=multiprocessing.cpu_count(), + num_threads=multiprocessing.cpu_count() // 2, random_seed=0): self._max_duration = max_duration self._min_duration = min_duration diff --git a/deep_speech_2/evaluate.py b/deep_speech_2/evaluate.py index fb7211fc..592b7b52 100644 --- a/deep_speech_2/evaluate.py +++ b/deep_speech_2/evaluate.py @@ -45,12 +45,12 @@ parser.add_argument( help="Use gpu or not. (default: %(default)s)") parser.add_argument( "--num_threads_data", - default=multiprocessing.cpu_count(), + default=multiprocessing.cpu_count() // 2, type=int, help="Number of cpu threads for preprocessing data. (default: %(default)s)") parser.add_argument( "--num_processes_beam_search", - default=multiprocessing.cpu_count(), + default=multiprocessing.cpu_count() // 2, type=int, help="Number of cpu processes for beam search. (default: %(default)s)") parser.add_argument( diff --git a/deep_speech_2/infer.py b/deep_speech_2/infer.py index 8fd27dce..df5953e5 100644 --- a/deep_speech_2/infer.py +++ b/deep_speech_2/infer.py @@ -45,7 +45,7 @@ parser.add_argument( help="Number of cpu threads for preprocessing data. (default: %(default)s)") parser.add_argument( "--num_processes_beam_search", - default=multiprocessing.cpu_count(), + default=multiprocessing.cpu_count() // 2, type=int, help="Number of cpu processes for beam search. (default: %(default)s)") parser.add_argument( diff --git a/deep_speech_2/train.py b/deep_speech_2/train.py index 080f57d2..aff61937 100644 --- a/deep_speech_2/train.py +++ b/deep_speech_2/train.py @@ -86,7 +86,7 @@ parser.add_argument( help="Trainer number. (default: %(default)s)") parser.add_argument( "--num_threads_data", - default=multiprocessing.cpu_count(), + default=multiprocessing.cpu_count() // 2, type=int, help="Number of cpu threads for preprocessing data. (default: %(default)s)") parser.add_argument( diff --git a/deep_speech_2/tune.py b/deep_speech_2/tune.py index a17be30f..328d67a1 100644 --- a/deep_speech_2/tune.py +++ b/deep_speech_2/tune.py @@ -51,7 +51,7 @@ parser.add_argument( help="Number of cpu threads for preprocessing data. (default: %(default)s)") parser.add_argument( "--num_processes_beam_search", - default=multiprocessing.cpu_count(), + default=multiprocessing.cpu_count() // 2, type=int, help="Number of cpu processes for beam search. (default: %(default)s)") parser.add_argument( -- GitLab