[Enhancement] Set Num thread to 0 (#36)

* [Docs] update batch size

* [Enhancement] Set Num thread to 0

* set omp mkl threads numbers

* set cls omp mkl threads numbers

* add comments
pull/45/head
Linyiqi 2022-01-27 20:19:14 +08:00 committed by GitHub
parent 555a348f97
commit 66d92a5abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -3,7 +3,7 @@ line_length = 79
multi_line_output = 0
known_standard_library = setuptools
known_first_party = mmfewshot
known_third_party = mmcls,mmcv,mmdet,numpy,pytest,pytorch_sphinx_theme,terminaltables,torch,typing_extensions
known_third_party = cv2,mmcls,mmcv,mmdet,numpy,pytest,pytorch_sphinx_theme,terminaltables,torch,typing_extensions
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY

View File

@ -5,6 +5,7 @@ import os
import os.path as osp
import time
import cv2
import mmcv
import torch
from mmcls import __version__
@ -17,6 +18,11 @@ from mmfewshot.classification.apis import train_model
from mmfewshot.classification.datasets import build_dataset
from mmfewshot.utils import get_root_logger
# disable multithreading to avoid system being overloaded
cv2.setNumThreads(0)
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
def parse_args():
parser = argparse.ArgumentParser(description='Train a model')

View File

@ -6,6 +6,7 @@ import os.path as osp
import time
import warnings
import cv2
import mmcv
import torch
from mmcv import Config, DictAction
@ -20,6 +21,11 @@ from mmfewshot.detection.datasets import build_dataset
from mmfewshot.detection.models import build_detector
from mmfewshot.utils import get_root_logger
# disable multithreading to avoid system being overloaded
cv2.setNumThreads(0)
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
def parse_args():
parser = argparse.ArgumentParser(description='Train a FewShot model')