Browse Source

!14815 python3.8 run mindspore retinaface resnet50 is slower than python3.7

From: @xiefangqi
Reviewed-by: @liucunwei,@heleiwang
Signed-off-by: @liucunwei
pull/14815/MERGE
mindspore-ci-bot Gitee 5 years ago
parent
commit
77ba527eaa
11 changed files with 12 additions and 1 deletions
  1. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/space_to_depth_base.h
  2. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/space_to_batch_fp32.h
  3. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/gather_parameter.h
  4. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/gatherNd_int8.h
  5. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/gather_int8.h
  6. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h
  7. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/sigmoid_int8.h
  8. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/squeeze_int8.h
  9. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/unsqueeze_int8.h
  10. +0
    -0
      mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/space_to_depth_parameter.h
  11. +12
    -1
      mindspore/dataset/engine/datasets.py

+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/space_to_depth_base.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/space_to_batch_fp32.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/gather_parameter.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/gatherNd_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/gather_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/sigmoid_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/squeeze_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/unsqueeze_int8.h View File


+ 0
- 0
mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/space_to_depth_parameter.h View File


+ 12
- 1
mindspore/dataset/engine/datasets.py View File

@@ -27,6 +27,7 @@ import signal
import time
import uuid
import multiprocessing
from multiprocessing.pool import RUN
import queue
from enum import Enum
from functools import partial
@@ -1997,6 +1998,9 @@ class BatchDataset(Dataset):
self.per_batch_map = _PythonCallable(self.per_batch_map, idx, self.process_pool)
self.hook = _ExceptHookHandler()
atexit.register(_mp_pool_exit_preprocess)
# If python version greater than 3.8, we need to close ThreadPool in atexit for unclean pool teardown.
if sys.version_info >= (3, 8):
atexit.register(self.process_pool.close)

def __del__(self):
if hasattr(self, 'process_pool') and self.process_pool is not None:
@@ -2230,7 +2234,11 @@ class _PythonCallable:
self.idx = idx

def __call__(self, *args):
if self.pool is not None and self.pool._state == 0 and check_iterator_cleanup() is False: # pylint: disable=W0212
# note here: the RUN state of python3.7 and python3.8 is different:
# python3.7: RUN = 0
# python3.8: RUN = "RUN"
# so we use self.pool._state == RUN instead and we can't use _state == 0 any more.
if self.pool is not None and self.pool._state == RUN and check_iterator_cleanup() is False: # pylint: disable=W0212
# This call will send the tensors along with Python callable index to the process pool.
# Block, yield GIL. Current thread will reacquire GIL once result is returned.
result = self.pool.apply_async(_pyfunc_worker_exec, [self.idx, *args])
@@ -2384,6 +2392,9 @@ class MapDataset(Dataset):
self.operations = iter_specific_operations
self.hook = _ExceptHookHandler()
atexit.register(_mp_pool_exit_preprocess)
# If python version greater than 3.8, we need to close ThreadPool in atexit for unclean pool teardown.
if sys.version_info >= (3, 8):
atexit.register(self.process_pool.close)

def __del__(self):
if hasattr(self, 'process_pool') and self.process_pool is not None:


Loading…
Cancel
Save