From 99c06b98018bdf0e5629a67a5296de4c2cdbc0f7 Mon Sep 17 00:00:00 2001 From: ougongchang Date: Mon, 14 Dec 2020 19:35:08 +0800 Subject: [PATCH] Specify a maxinmum number of OpenBLAS threads Environment variables are used to specify a maximum number of OpenBLAS threads. In ubuntu(GPU) environment, numpy will use too many threads for computing, it may affect the start of the summary process. Notice: At present, the performance of setting the thread to 2 has been tested to be more suitable. If it is to be adjusted, it is recommended to test according to the scenario first a --- mindspore/train/summary/_writer_pool.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mindspore/train/summary/_writer_pool.py b/mindspore/train/summary/_writer_pool.py index 9b828b8665..04709808da 100644 --- a/mindspore/train/summary/_writer_pool.py +++ b/mindspore/train/summary/_writer_pool.py @@ -31,6 +31,16 @@ except ValueError: import multiprocessing as ctx +# Environment variables are used to specify a maximum number of OpenBLAS threads: +# In ubuntu(GPU) environment, numpy will use too many threads for computing, +# it may affect the start of the summary process. +# Notice: At present, the performance of setting the thread to 2 has been tested to be more suitable. +# If it is to be adjusted, it is recommended to test according to the scenario first +os.environ['OPENBLAS_NUM_THREADS'] = '2' +os.environ['GOTO_NUM_THREADS'] = '2' +os.environ['OMP_NUM_THREADS'] = '2' + + def _pack_data(datadict, wall_time): """Pack data according to which plugin.""" result, summaries, step = [], [], None