!22327 dataset add shared memory note

Merge pull request !22327 from xiefangqi/md_add_shared_memory_note
This commit is contained in:
i-robot 2021-08-25 06:19:48 +00:00 committed by Gitee
commit 823a2baeb0
2 changed files with 4 additions and 0 deletions

View File

@ -448,6 +448,9 @@ def set_enable_shared_mem(enable):
"""
if not isinstance(enable, bool):
raise TypeError("enable must be of type bool.")
logger.warning("The shared memory is on, multiprocessing performance will be improved. "
"Note: the required shared memory can't exceeds 80% of the available shared memory. "
"You can reduce max_rowsize or reduce num_parallel_workers to reduce shared memory usage.")
_config.set_enable_shared_mem(enable)

View File

@ -3582,6 +3582,7 @@ def _check_shm_usage(num_worker, queue_size, max_rowsize, num_queues=1):
if shm_estimate_usage >= threshold_ratio * shm_available:
raise RuntimeError(
"Insufficient shared memory available. Required: {}, Available: {}. "
"The required memory can't exceed 80% of the available shared memory. "
"Recommend to set_enable_shared_mem to False, reduce max_rowsize or reduce num_parallel_workers."
.format(shm_estimate_usage, shm_available))
except FileNotFoundError: